TransWikia.com

Combination of 'changing the caption of Figure' and 'List of anything'

TeX - LaTeX Asked on September 4, 2021

In the paper I am writing, I need:

  1. part of the captions ‘Example 1’ instead of ‘Fig.1’ as the caption of some pictures (Not all the figures, so usepackage[figurename=Example.]{caption} is not suitbale). This requirement is similar to Change the caption name of a specific figure.

  2. At the same time, I need both the List of Figures and List of Examples. I found the way to insert ‘List of Anything’ such as List of Anything.

But how could I be able to combine the two requirements: 1. Change few particular caption to Example; 2. Insert a List of Example after contents.

Thank you very much for any suggestions.

— For the comments from Peter —

I cannot include the code in the comment as it is too long. Simply replace the “memoir” with “book” then you will see the problem. I have no idea why it is so difficult to understand what I mean (below code). BTW, thank you for your previous answer. Goodbye from a KYM (Kind Young Man).

documentclass{book}
usepackage{lipsum}
usepackage{graphicx}
newlistof{listofexamples}{loe}{List of Examples}
newfloat{example}{loe}{Example}

begin{doument}
frontmatter
tableofcontents
listoffigures
listofexamples

mainmatter
chapter{First}
lipsum[1]

begin{figure}
centering
 %includegraphics... for a picture
caption{A picture}
end{figure}

begin{example}
centering
%includegraphics... for an illustration
caption{An illustration}
end{example}

end{document}

For others meet the same problem, I find float environment and list of anything might be helpful.

One Answer

The memoir class (covers the book, report and article classes) lets you do this (set up a new List of... and new float environment).

First for the List of Examples:

newlistof{listofexamples}{loe}{List of Examples}

which will create a commandlistofexamples which when called in the document will produce a heading List of Examples followed by data from an .loe file (just like listoffigures produces List of Figures followed by data from a .lof file).

Then for your examples create a new Example float (like the Figure float):

newfloat{example}{loe}{Example}

after which

begin{example}
% contents of the example
caption{A caption for the example}
end{example}

will act like a Figure but with its own caption style and numbering.

Here is a fuller example (but remove any typos):

documentclass{memoir}
usepackage{lipsum}
usepackage{graphicx}
newlistof{listofexamples}{loe}{List of Examples}
newfloat{example}{loe}{Example}

begin{doument}
frontmatter
tableofcontents
listoffigures
listofexamples

mainmatter
chapter{First}
lipsum[1]

begin{figure}
centering
 %includegraphics... for a picture
caption{A picture}
end{figure}

begin{example}
centering
%includegraphics... for an illustration
caption{An illustration}
end{example}

end{document}

For more detailed information see the documentation (> texdoc memoir sections 9.3 and 10.1)

On the other hand there might be a package that lets you do something similar.

Answered by Peter Wilson on September 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP