Showing posts with label Captions. Show all posts
Showing posts with label Captions. 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. 

\usepackage{} -- Caption

\usepackage[hang, small,font=sf,labelfont=bf,up,rm,textfont=it,up]{caption} % Custom captions under/above floats in tables or figures  _NEED REF_

...

hang indicates hanging indent (I think, because I've not found this exact usage indicated in any documentation yet).

small indicates the relative font size.  Something somewhere mentioned that using relative font size is preferable to an absolute font size -- I'm not sure why, and I'm certain that some journals and thesis departments require a particular font size, e.g. 10pt.

font=sf defines the fonts for the labelfont and textfont entirely.
    sf is sans-serif. 

labelfont=bf,up,rm defines the label, number, and separator, e.g. Figure 1:
     They will be (in this case) bold, upright, and Roman.  Roman is the default, however since I defined my captions as sf, rm here makes the labelfont serif.

textfont=it,up defines the font of the caption text, in this case italic and upright.