22

I have the command \DoubleSpacing within the caption of many of my figures throughout my document. This command is provided by memoir.

...
\caption[]{\DoubleSpacing Here is a figure caption}
...

I would like to replace this command by some other command, say aux_command that I can alias to \DoubleSpacing or to a dummy command that does nothing (literally), at will, and in one single place. This would allow me to quickly turn on and off DoubleSpacing in the caption of my figures. How can I do that?

  • 3
    Don't double space your documents, if you're not required to by (absurd) rules. Never double space captions, even if the (absurd) rules seem to require it. – egreg Mar 25 '12 at 22:43
  • Thanks @egreg. Unfortuantely I am required to do this in the first drafts, which is why I know I will have to turn it off later. – Amelio Vazquez-Reina Mar 25 '12 at 22:46
  • 1
    \def\DoubleSpecing{} will change the command to do nothing. – yannisl Mar 25 '12 at 22:57

2 Answers2

23

While it might be possible to patch the \@makecaption inner command of memoir, the best thing to do is to have

\newcommand{\CaptionDS}{\DoubleSpacing}
%\newcommand{\CaptionDS}{}

and use \CaptionDS in captions. When doing the final version, you simply switch the comments (or remove \CaptionDS altogether, which will be easier with a "search and replace").

egreg
  • 1,121,712
  • 2
    I think I will accept this question because it's the one that directly answers the question, although I should point out Alan's answer also fit perfectly the specifics of my problem. – Amelio Vazquez-Reina Mar 25 '12 at 23:10
19

Instead of aliasing the \DoubleSpacing command and using it inside every caption, you should set up your caption properly using memoir's hooks for caption style:

\documentclass{memoir}
\captionstyle{\DoubleSpacing}
\begin{document}
\chapter{}
\begin{figure}
\caption{This is a caption that will be double spaced as you require. It will have a caption that is doublespaced as you require.}
\end{figure}

\end{document}

This way you don't have to do any search and replace, and you can change the caption setup once in the preamble.

Alan Munn
  • 218,180