7

Having lots of figures and tables in my document, I have created two commands \source and \notes to format the source of the figure/table and add any notes (see MWE). The body text has double line spacing, how can I reduce the line spacing to one-half or single line spacing in my newly defined \notes environment?

\documentclass[a4paper, 12pt]{report}

\usepackage[english,frenchb]{babel}
\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage{subcaption}

\linespread{1.6} %Setting double spacing for document

%---- Create 'source' and 'notes' commands ----%
\newcommand{\source}[1]{\vspace{-1.5em}
\captionsetup{justification=justified} \caption*{\raggedright\textnormal{\footnotesize{\textit{#1}}}}}

\newcommand{\notes}[1]{\vspace{-0.5em} 
% Would like 1.5 spacing for 'notes' environment
\captionsetup{justification=justified} \caption*{\textnormal{\scriptsize{\textit{#1}}}}}

\linespread{1.6}

\begin{document}

\begin{figure}[h!]
\begin{center}
\caption{A figure}
\resizebox{!}{70mm}{\includegraphics{{example-image-a}}}
\end{center}
      \source{Source : source of figure.}
      \notes{Notes : Some very long notes spread over several lines of which I would like to reduce linespacing. Some very long notes spread over several lines of which I would like to reduce linespacing. Some very long notes spread over several lines of which I would like to reduce linespacing. Some very long notes spread over several lines of which I would like to reduce linespacing.}
\end{figure}

Lots and lots of text. Lots and lots of text. Lots and lots of text. Lots and lots of text. Lots and lots of text. Lots and lots of text. Lots and lots of text. Lots and lots of text. Lots and lots of text. Lots and lots of text. Lots and lots of text. Lots and lots of text. Lots and lots of text. Lots and lots of text. Lots and lots of text. Lots and lots of text. Lots and lots of text. Lots and lots of text. Lots and lots of text. 

\end{document}

2 Answers 2

4

Just add \linespread{0.0} (for single-spacing, or any other number as you like) to your definition of the \notes macro.

\documentclass{report}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{lipsum}

\linespread{1.6}

\newcommand{\source}[1]{%
    \vspace{-1.5em}%
    \captionsetup{justification=justified}%
    \caption*{\raggedright\footnotesize\textit{#1}}%
}

\newcommand{\notes}[1]{%
    \linespread{0.0}\vspace{-0.5em}%
    \captionsetup{justification=justified}%
    \caption*{\scriptsize\textit{#1}}%
}

\begin{document}

\begin{figure}[h!]
    \begin{center}
        \caption{A figure}
        \includegraphics[height=70mm]{example-image-a}
    \end{center}
    \source{Source : source of figure.}
    \notes{Notes : \lipsum[1]}
\end{figure}

\lipsum[2]

\end{document}

enter image description here

1
  • While this is a quick solution using the approach you used in the question, you should really have a look at egreg's solution - there he shows the better way of choosing the line spacing.
    – Tiuri
    Commented Aug 18, 2017 at 9:17
5

Add the formatting instructions to \captionsetup and use setspace. Note that \linespread{1.6} is essentially the same as \doublespacing.

\documentclass[a4paper, 12pt]{report}

\usepackage[english,frenchb]{babel}
\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage{subcaption}
\usepackage{setspace}

\doublespacing

%---- Create 'source' and 'notes' commands ----%
\newcommand{\source}[1]{%
 \begingroup
 \captionsetup{justification=raggedright,font={footnotesize,it,onehalfspacing}}%
 \caption*{#1}%
 \endgroup
}

\newcommand{\notes}[1]{%
  \begingroup
  \captionsetup{justification=justified,font={scriptsize,it,onehalfspacing}}%
  \caption*{#1}%
  \endgroup
}

\begin{document}

\begin{figure}[htp!]
\centering
\caption{A figure}
\includegraphics[width=70mm]{example-image-a}

\source{Source : source of figure.}
\notes{Notes : Some very long notes spread over several lines of which 
  I would like to reduce linespacing. Some very long notes spread over
  several lines of which I would like to reduce linespacing. Some very
  long notes spread over several lines of which I would like to reduce
  linespacing. Some very long notes spread over several lines of which
  I would like to reduce linespacing.}
\end{figure}

Lots and lots of text. Lots and lots of text. Lots and lots of text. 
Lots and lots of text. Lots and lots of text. Lots and lots of text. 
Lots and lots of text. Lots and lots of text. Lots and lots of text. 
Lots and lots of text. Lots and lots of text. Lots and lots of text. 
Lots and lots of text. Lots and lots of text. Lots and lots of text. 
Lots and lots of text. Lots and lots of text. Lots and lots of text. 
Lots and lots of text. 

\end{document}

Doing this in a group will make the setting local.

enter image description here

You must log in to answer this question.

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