4

I have figure captions like this:

\documentclass{book}
\usepackage{graphicx}

\begin{document}
    
    \listoffigures
    
    \begin{figure}
        \centering
        \includegraphics[width=12cm]{example-image-a}
        \caption{Vacuum electrostatic surface potential of bovine lactoferrin (1BLF). The circled blue area corresponds to the N1 subdomain and contains the antimicrobial peptide precursors for lactoferricin and lactoferrampin. Vacuum electrostatic surface potential was generated in PyMOL.}
        \label{fig:Lf_electrostatic}
    \end{figure}

\end{document}

But in my list of figures at the start of my thesis, they render like so:

enter image description here

I would like the list of figures to only show "Vacuum electrostatic surface potential of bovine lactoferrin (1BLF). Should I separate this into a different markup tag? Or how can I go about doing this so it doesn't write out the whole caption?

9
  • 3
    Try \caption[Vacuum electrostatic surface potential of bovine lactoferrin (1BLF)]{...}
    – Roland
    Oct 22, 2021 at 2:11
  • Cool, that works for the list but it seems to remove the title from the figure itself. Any way to keep it in the figure?
    – Vranvs
    Oct 22, 2021 at 2:18
  • 1
    For future questions, please always provide a full MWE starting with \documentclass{...} and loading all necessary packages.
    – Roland
    Oct 22, 2021 at 2:18
  • What do you mean with "it removes it from the figure itself". See my example below. The title is still in the figure.
    – Roland
    Oct 22, 2021 at 2:19
  • Yes -- Thank you. I didn't realize I had to do [Title]{Title. Caption}. I just did [Title]{Caption}. Cheers
    – Vranvs
    Oct 22, 2021 at 2:23

3 Answers 3

6

Note you need to compile twice.

\documentclass{book}
\usepackage{graphicx}

\begin{document}
    
    \listoffigures
    
    \begin{figure}
        \centering
        \includegraphics[width=12cm]{example-image-a}
        \caption[Vacuum electrostatic surface potential of bovine lactoferrin (1BLF)]{Vacuum electrostatic surface potential of bovine lactoferrin (1BLF). The circled blue area corresponds to the N1 subdomain and contains the antimicrobial peptide precursors for lactoferricin and lactoferrampin. Vacuum electrostatic surface potential was generated in PyMOL.}
        \label{fig:Lf_electrostatic}
    \end{figure}

\end{document}

enter image description here enter image description here

1
  • Interesting! Not very DRY-friendly :-) but it should work. Thanks so much
    – Vranvs
    Oct 22, 2021 at 2:18
3

You could choose to stick the graph's legend below the graph itself and keep the caption text short and snappy. A beneficial side-effect will be that you won't have to fiddle with the optional argument of \caption.

enter image description here

\documentclass{book}
\usepackage{graphicx}
\hyphenation{anti-microb-ial}
\begin{document}
    
\listoffigures
    
\chapter{Uno}

\begin{figure}[ht!]

\includegraphics[width=\textwidth]{example-image-a}
        
The circled blue area corresponds to the N1 subdomain and contains 
the antimicrobial peptide precursors for lactoferricin and lactoferrampin. 
Vacuum electrostatic surface potential was generated in PyMOL.

\caption{Vacuum electrostatic surface potential of bovine lactoferrin (1BLF). }
\label{fig:Lf_electrostatic}

\end{figure}

\end{document}
0

Just for fun:

\documentclass{book}
\usepackage{graphicx}

\newcommand{\savenumberline}{}% reserve global name

\makeatletter
\renewcommand*\l@figure[2]% #1 = title with \numberline, #2 = page number
{\bgroup% use local registers
  \setbox0=\vbox{\setlength{\hsize}{\dimexpr \textwidth-\@pnumwidth-3.8em}%
    \def\numberline##1{\xdef\savenumberline{##1}}%
    #1}%
  \ifdim\ht0>\baselineskip
    \setbox1=\vsplit0 to \ht\strutbox
    \setbox2=\vbox{\unvbox1}% restore original height
    \@dottedtocline{1}{1.5em}{2.3em}{\numberline{\savenumberline}\box2}{#2}%
  \else
    \@dottedtocline{1}{1.5em}{2.3em}{#1}{#2}% default
  \fi
\egroup}
\makeatother

\begin{document}
    
    \listoffigures
    
    \begin{figure}
        \centering
        \includegraphics[width=12cm]{example-image-a}
        \caption{Vacuum electrostatic surface potential of bovine lactoferrin (1BLF). The circled blue area corresponds to the N1 subdomain and contains the antimicrobial peptide precursors for lactoferricin and lactoferrampin. Vacuum electrostatic surface potential was generated in PyMOL.}
        \label{fig:Lf_electrostatic}
    \end{figure}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .