Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Using the caption package, one can suppress lot/lof entry with an empty optional argument for \caption. But the caption package is incompatible with memoir. How can I suppress lot/lof entries in memoir?

share|improve this question
1  
The caption pacakge is not incompatible with memoir, works just fine with it. memoir issues a warning telling users that when they use caption, memoir's own interface for configuring captions will no longer have any affect. –  daleif Jul 31 '12 at 13:34
    
The problem is: I'm working on my ctable package, which has an option cap= to set the entry for lot/lof. If it't empty, no entry should be made, like in the caption package. I can, of course \RequirePackage{caption} in ctable, but that would deprive memoir+ctable users of memoir's own caption facilities. –  Wybo Dekker Jul 31 '12 at 15:55
    
There are pros and cons. I do it myself in one of my packages, require caption, because it can do stuff that memoir` will not get close to any time soon. Plus I use caption for all my projects, eventhough I maintain memoir –  daleif Jul 31 '12 at 20:51
    
Why not make some of these features plugable, such that users can change them, think of callbacks. –  daleif Jul 31 '12 at 20:53
    
Thanks for all comments - I finally decided not to \Require caption inside ctable but let it to the user to do so. If he uses an empty cap option a warning will be issued suggesting caption inclusion. –  Wybo Dekker Aug 2 '12 at 19:51

1 Answer 1

up vote 7 down vote accepted

After daleif's comment, you can use the caption package and its list=no option:

\documentclass{memoir}
\usepackage{caption}

\begin{document}
\listoffigures

test text

\begin{figure}
\captionsetup{list=no}
\centering
\rule{3cm}{2cm}
\caption{A numbered and named caption}
\end{figure}

\begin{figure}
\centering
\rule{3cm}{2cm}
\caption*{An unnumbered and unnamed caption}
\end{figure}

\end{document}

enter image description here

Another option, within memoir, is to use \legend or \namedlegend:

\documentclass{memoir}

\begin{document}
\listoffigures

test text

\begin{figure}
\centering
\rule{3cm}{2cm}
\legend{A unnumbered and unnamed caption}
\end{figure}

\begin{figure}
\centering
\rule{3cm}{2cm}
\namedlegend{A unnumbered but named caption}
\end{figure}

\begin{figure}
\stepcounter{figure}
\centering
\rule{3cm}{2cm}
\legend{\figurename~\thefigure: A named and numbered caption}
\end{figure}

\end{document}

enter image description here

Another option is to define a command to change the lotdepth counter (lofdepth, in the case of figures) typeset the caption using the standard \caption command and then restoring the default value for the counter:

\documentclass{memoir}

\newcommand\NLcaption[1]{%
  \addtocontents{lot}{\setcounter{lotdepth}{0}}%
  \caption{#1}%
  \addtocontents{lot}{\setcounter{lotdepth}{1}}}

\begin{document}

\listoftables
Test text
\begin{table}
\NLcaption{Test caption}
\end{table}

\end{document}

enter image description here

share|improve this answer
    
See my comment to daleif above. I can, of course detect memoir and then use \legend instead of \caption, but it's argument would probably have to be more complicated than "\figurename~\thefigure: "? For example, the : would not honor any setting of \captiondelim. –  Wybo Dekker Jul 31 '12 at 16:01
    
@WyboDekker yes, obviously the label used in my example has to use \captiondelim (and other settings). I've added a new option to my answer providing another possibility that will honor the settings for standard captions. –  Gonzalo Medina Jul 31 '12 at 17:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.