\caption[shortcaption]{longcaption}
, it seems to behave differently between the Figure and Table environments?Note - I have created a command in the preamble so that I get a short caption only in the LOF, then for the actual figure the short caption is repeated as a 'title', and the long caption contains more details:
Code: Select all
\newcommand{\figCaption}[2]{\caption[#1]{\textbf{#1}. #2}}
Code: Select all
Figure 1: \textbf{Effect of adding drug X to live cells}. Drug dosage 10 mg for 1 hour, etc etc etc.
This is my thesis master document (I've cut out all the unnecessary packages); the example figures obviously won't be added but it seems the environment/float/caption is created ok without the actual figure.
It's MikTex 2.9 and I'm compiling with PdfTex
Code: Select all
\documentclass[a4paper, oneside, 11pt, openany]{book}
\usepackage{booktabs}
% for nicer looking tables; required if using the Excel2Latex macro
\usepackage[font=small,labelfont=bf]{caption}
% puts captions in small, with label in bold font
\captionsetup[table]{skip=4pt}
% change table caption to be a bit closer (default 10pt)
%Custom caption: short cap(bold) followed by long cap
\newcommand{\figCaption}[2]{\caption[#1]{\textbf{#1}. #2}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\mainmatter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\listoffigures
\section{Figure -- uses custom caption command}
\begin{figure}[htbp]
\begin{center}
%\includegraphics[scale=1]{chapter1/example_figure.pdf}
\figCaption{Figure:ShortCaption}{Figure:LongCaption}
\label{example_figure}
\end{center}
\end{figure}
\section{Figure -- uses built-in caption}
\begin{figure}[htbp]
\begin{center}
%\includegraphics[scale=1]{chapter1/example_figure.pdf}
\caption[Figure short cap]{Figure long cap}
\label{example_figure2}
\end{center}
\end{figure}
\listoftables
\section{Table -- uses custom command}
\begin{table}[htbp]
\centering
\figCaption[Table with short caption][Table long caption]
\begin{tabular}{rr}
\toprule
Name & Time \\
\midrule
Tom & 55 sec \\
Tom & 55 sec \\
Tom & 55 sec \\
Tom & 55 sec \\
Tom & 55 sec \\
\bottomrule
\end{tabular}%
\label{table:example1}
\end{table}%
\section{Table -- uses built-in caption}
\begin{table}[htbp]
\centering
\caption[shortcaption]{longcaption}
\begin{tabular}{rr}
\toprule
Name & Time \\
\midrule
Tom & 55 sec \\
Tom & 55 sec \\
Tom & 55 sec \\
Tom & 55 sec \\
Tom & 55 sec \\
\bottomrule
\end{tabular}%
\end{table}%
\end{document}