TransWikia.com

Remove figure numerotation

TeX - LaTeX Asked on June 17, 2021

I tried to put two images side by side on my front page (so without caption), and this is how I did. The result is good but the problem is that, even if there’s no caption, the next figure in my document starts as "Figure 2". It seems that, even without caption, my figure is still taken into account. How could I fix this ?

Thanks in advance,

Adrien

begin{figure}[H]
centering
begin{subfigure}[b]{0.47textwidth}
centering
includegraphics[scale = 0.4]{Logo Mammouths.PNG}
end{subfigure}
begin{subfigure}[b]{0.47textwidth}
centering
includegraphics[scale = 0.3]{Logo CAP.png}
end{subfigure}
end{figure}

2 Answers

You need to change the figure numbering, for example:

documentclass{article}
usepackage{subcaption}
usepackage{graphicx}


begin{document}
begin{figure}
centering
begin{subfigure}[b]{0.47textwidth}
centering
includegraphics[scale = 0.4]{example-image-a}
end{subfigure}
begin{subfigure}[b]{0.47textwidth}
centering
includegraphics[scale = 0.3]{example-image-b}
end{subfigure}
end{figure}

setcounter{figure}{0} % <-- Important part!

begin{figure}
centering
includegraphics[scale = 0.4]{example-image}
caption{The numbering is correct}
end{figure}
end{document}

enter image description here

Answered by Luis Turcio on June 17, 2021

The real reason the issue you've encountered arises is because you are abusing and mis-using the figure and subfigure machinery. Running an instruction such as setcounter{figure}{0} is the equivalent to applying a band-aid. Wouldn't it be nicer to avoid accidents that cause bleeding?

Why do I say that you're abusing the figure and subfigure machinery? There are two clear signs. First, by applying the [H] placement specifier, you're making sure the figure object won't "float" (in the LaTeX-specific sense of the word). But the floating mechanism for table and figure objects is one of the main reasons for even using these objects. Second, you don't provide caption directives anywhere in the figure or subfigure environments. The captioning mechanism is the second main reason for using table and figure environments.

Thus, instead of writing

begin{figure}[H]
centering
begin{subfigure}[b]{0.47textwidth}
centering
includegraphics[scale = 0.4]{example-image-a}
end{subfigure}
begin{subfigure}[b]{0.47textwidth}
centering
includegraphics[scale = 0.3]{example-image-b}
end{subfigure}
end{figure}

you really ought to be writing

noindent
begin{minipage}{textwidth}
centering
begin{minipage}[b]{0.47textwidth}
centering
includegraphics[scale = 0.4]{example-image-a}
end{minipage}
hfill % <-- new
begin{minipage}[b]{0.47textwidth}
centering
includegraphics[scale = 0.3]{example-image-b}
end{minipage}
end{minipage}

or, better still,

noindent
begin{minipage}[b]{0.47textwidth}
includegraphics[width=linewidth]{example-image-a}
end{minipage}hfill
begin{minipage}[b]{0.47textwidth}
includegraphics[width=linewidth]{example-image-b}
end{minipage}

Moral of the story: Don't use figure (and subfigure) environments unless you have to.

Answered by Mico on June 17, 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