Showing posts with label Tables. Show all posts
Showing posts with label Tables. Show all posts

09 June 2015

\usepackage{} -- threeparttable, Add Footnotes to Tables, Separate From Document Footnotes

\usepackage[para,online,flushleft]{threeparttable} % Custom captions under/above floats in tables or figures.

The threeparttable Package Documentation (PDF).
    
% [para] --Notes come one-after-another without line breaks.
% [flushleft] -- No hanging indentation on notes.
% [online] -- \item tag is printed normal size, not superscript.
...

\begin{table}[]   
\small    % Changes overall font size of the table
    \caption
{Table caption.}     % \label must immediately follow \caption % \captionof doesn't work here.    \label{tab:table_label}           \centering    % Centering works and is preferred.  PDF shows the use of \begin{center}    \begin{threeparttable}    % Changes overall font size of the table
    \begin{tabular}{lccccccc}
    \toprule    \multicolumn{6}{c}{Table Name} \\ % 6-column table.        \midrule          & \multicolumn{2}{c}{Column Group 1 Name} & \multicolumn{2}{c}{Column Group 2 Name} & \\ % Blank before the first & allows for a 'blank' column name.  Same with the blank after the last &.  Two multi-columns.
        \cmidrule(r){2-3}    % This gives a mid-rule for the grouped multi-column.
        \cmidrule(r){4-5}
          & Column Name 1a & Column Name 1b  & Column Name 2a & Column Name 2b & Column Name 3 \\
        \cmidrule(r){2-3}
        \cmidrule(r){4-5}
        \cmidrule(r){6-6}    % This gives a mid-rule for the last single column.
        Row Name A\tnote{$\dag$} & Value A1a & Value A1b & & Value A2a & Value A2b & & Value A3 \\    % \tnote{1}, \tnote(a) also work.
        Row Name B\tnote{$\ddag$} & Value B1a & Value B1b & & Value B2a & Value B2b & & Value B3 \\
    \bottomrule    \end{tabular}
    \begin{tablenotes}
        \item[$\dag$]{\footnotesize{Footnote Text for $\dag$.}} \item[$\ddag$]{\footnotesize{Footnote Text for $\ddag${\color{Crimson}This still works.}}}   

    \end{tablenotes}
    \end{threeparttable}
\end{table}

...

This is the only option that didn't interfere with the document footnotes or numbering.  Footnotes appear at the bottom of the table much like an un-numbered second caption might.

05 April 2015

\usepackage {} -- Float (for Figures, Tables, and Captions)

 \usepackage{float} % Required for tables and figures in the multi-column environment - they need to be placed in specific locations with the [H] (e.g. \begin{table}[H])  
\renewcommand{\textfraction}{0.20} % \textfraction ≥ 0.15
     % 0.20 is the default, meaning floats will not cover more than 80% of text page.
\renewcommand{\topfraction}{0.70} % \topfraction ≤ 1 - \textfraction
     % 0.70 is default; prevents float with height > 70% of \textheight placed at top of text page.
\renewcommand{\bottomfraction}{0.30} % \bottomfraction ≤ (1 - \textfraction) AND ≤  \topfraction
     % 0.30 is default; prevents float with height > 30% of \textheight placed at bottom of text page.
\renewcommand{\floatpagefraction}{0.50} % \floatpagefraction ≤ (\bottomfraction - 0.05)
     % 0.50 is default; minimum fraction of float page that must be occupied by floats.


__________
 
A 'float' makes a container for a figure or table with a caption, and ensures that neither the element nor the caption is broken across multiple pages.  LaTeX does its best to ensure nice layout, but it's not always good at keeping relevant items on the same page.  Beware of attempting to force float placements.  If LaTeX cannot place one, it will usually have issues with the following ones as well.  Float specifier [options].

The \renewcommand options need not be specified if no changes are made.  If used, they are placed in the preamble.  More on customizing floats in CTAN's epslatex.pdf. 

04 April 2015

\label{} for internal referencing, e.g. Figure and Table numbering.

\label{fig:Lname2000_Fig7b} "fig" is a user-set class.  I also use "tbl" for tables.  "Lname2000_Fig7b" is user set too, but I recommend you adopt a naming algorithm that makes labels and citations easy to remember.

\label MUST be on the line immediately following \caption to work. 

\captionof{element}{Caption text.} vs \caption{Caption text.}

\captionof{figure}{Caption text.} vs \caption{Caption text.} ... _NEED REF_ These have different purposes/effects. 
\captionof{table} or other elements work in this manner.