1

The answer to a question asked Jan 16 '13 at 4:54 by @manish continued into a discussion on how to set caption parameters locally. The suggestion that this would be done using \captionsetup[figure]{..} or \captionsetup[table]{..} inside the figure or table environment does not work for me either. How can this be done?

\documentclass{article}
\usepackage[demo]{graphicx} %% Remove [demo] in your file
%\usepackage{caption}
%\captionsetup[table]{font=small,skip=0pt}     %% Adjust here
%or equivalently 
\usepackage[font=small,skip=0pt]{caption}

\begin{document}

Some text...

\begin{figure}[htb]
\captionsetup[figure]{font=large,skip=10pt}
\begin{center}
\includegraphics[height=1in,width=1in,angle=-90]{foo}
\caption{This is a figure.}
\end{center}
\end{figure}

More text...

\begin{figure}[htb]
\captionsetup[figure]{font=small,skip=0pt}
\begin{center}
\includegraphics[height=1in,width=1in,angle=-90]{foo}
\caption{This is another figure.}
\end{center}
\end{figure}

Still more text...
\begin{table}[htb]
\centering
\caption{This is a table.}
\begin{tabular}{|c|c|}
\hline
    % after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
    1 & 2 \\
    4 & 7 \\
    \hline
\end{tabular}
\end{table}

More text...

\end{document}
  • 1
    Please add a link to the question before! – Mensch Mar 5 at 3:22
1

Following the documentation of package caption, chapter 1, you have to use

\captionsetup{font=large,skip=10pt}

instead

\captionsetup[figure]{font=large,skip=10pt}
%            ^^^^^^^^

So with the following MWE

\documentclass{article}
\usepackage[demo]{graphicx} %% Remove [demo] in your file
%\usepackage{caption}
%\captionsetup[table]{font=small,skip=0pt}     %% Adjust here
%or equivalently 
\usepackage[font=small,skip=0pt]{caption}

\begin{document}

Some text...

\begin{figure}[htb]
  \centering
  \includegraphics[height=1in,width=1in,angle=-90]{foo}
  \captionsetup{font=large,skip=10pt} % <===============================
  \caption{This is a figure.}
\end{figure}

More text...

\begin{figure}[htb]
\captionsetup{font=small,skip=-10pt} % <================================
\begin{center}
\includegraphics[height=1in,width=1in,angle=-90]{foo}
\caption{This is another figure.}
\end{center}
\end{figure}

Still more text...
\begin{table}[htb]
\centering
\caption{This is a table.}
\begin{tabular}{|c|c|}
\hline
    % after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
    1 & 2 \\
    4 & 7 \\
    \hline
\end{tabular}
\end{table}

More text...

\end{document}

you get the result (I only used -10pt to make the second changing better visable):

resulting pdf

  • … and as the statement is inside the specific environment, it works for table just the same. – Reinhard Neuwirth Mar 5 at 5:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.