Text Formattingignore caption style from list of figures

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
gdoglz
Posts: 2
Joined: Tue Mar 23, 2010 4:31 am

ignore caption style from list of figures

Post by gdoglz »

hi there,

When adding figures or tables, I'm editing the \caption entry in order to add formating to the caption text (and distinguish it from the main text) in the following form:

\caption{\sffamily \footnotesize blah blah blah}

However, when I create the LOF, the caption text in the list maintains the format style applied in the caption entry (i.e. \sffamily \footnotesize).

I was wondering if there is any option to ignore the applied style in the LOF and use another format style, such as \textnormal \normalsize ?

I've tried tocloft but have only been able to change the style of the list numbers, not the caption title itself. For example

Current output:
1.1 (<- in '\textnormal\normalsize' style) - blah blah blah (<- in '\sffamily\footnotesize' style)

Desired output:
1.1 (<- in '\textnormal\normalsize' style) - blah blah blah (<- in '\textnormal\normalsize' style).

Thanks in advance

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

ignore caption style from list of figures

Post by gmedina »

Hi,
gdoglz wrote:...
\caption{\sffamily \footnotesize blah blah blah}
...
it is not a good idea to modify the caption font atributes like that. You can use the features provided by the caption package. A little example:

Code: Select all

\documentclass{book}
\usepackage{caption}
\captionsetup{font=sf,size=footnotesize}

\begin{document}
\listoffigures

\begin{figure}[!ht]
  \centering
  \rule{4cm}{2cm}
  \caption{this is just a caption for test figure one.}
  \label{fig:test1}
\end{figure}

\begin{figure}[!ht]
  \centering
  \rule{4cm}{2cm}
  \caption{this is just a caption for test figure two.}
  \label{fig:test2}
\end{figure}

\end{document}
Please note that the changes affect only the captions and not the entries in the LoF.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
gdoglz
Posts: 2
Joined: Tue Mar 23, 2010 4:31 am

Re: ignore caption style from list of figures

Post by gdoglz »

Brilliant! Thanks a lot!!
Post Reply