0

I'm trying to construct a figurenotes environment that should have \footnotesize and a different \linespread but can't seem to adjust the latter. My MWE is

\documentclass{article}
\usepackage{graphicx}
\newenvironment{figurenotes}{\linespread{2}\par\vspace{1em}\footnotesize\selectfont\emph{Notes.}}{}
\begin{document}
  \begin{figure}[tb]
    \caption{Pagodas}
    \label{fig:pagodas}
    \includegraphics[width=\linewidth]{pagodas}
    \begin{figurenotes}
      Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
      tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
      quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
      consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
      cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
      proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    \end{figurenotes}
  \end{figure}
\end{document}

Results: linespread unaffected

Fredrik P
  • 1,386
  • I don't see what you're missing: you asked for \linespread{2} and footnotesize. At first glance it seems to be the case. What's wriong with the result? – Bernard Jun 25 '20 at 15:04
  • The linespread command is ignored. The result is identical without it. – Fredrik P Jun 25 '20 at 15:57
  • But I realize that this question might already be answered here https://tex.stackexchange.com/questions/24562/restricting-linespread-to-an-environment – Fredrik P Jun 25 '20 at 15:59

1 Answers1

0

You're forgetting to add \par in the \end part of the environment.

With your code, the \par is executed at \end{figure}, when the \linespread{2} setting has been forgotten because figurenotes has alredy ended. What you get is the baseline skip for \normalsize.

\newenvironment{figurenotes}
  {\par\addvspace{1em}%
   \linespread{2}\footnotesize
   \emph{Notes.} \ignorespaces
  }
  {\par}% <-------  IMPORTANT

Note a few changes: \linespread{2} should only affect the table notes, so it should be issued after the initial \par. There's no need of \selectfont, because \footnotesize does it.

The space after \emph{Notes.} should be explicitly in the definition, otherwise input such as

\begin{figurenotes}This is a figure\end{figurenotes}

would have no space. With \ignorespaces we remove the possible spurious space that may come from the endline after \begin{figurenotes}.

enter image description here

egreg
  • 1,121,712