TransWikia.com

Wrong numbering figures in subfiles

TeX - LaTeX Asked on January 3, 2021

I have a document structured as a main file with subfiles as chapters.

Even if I just have one picture the numbering of the picture start as 1.1 in the sub file and 2.1 from the main file (and list of figure).

I have a second picture that is purposely without label and caption. But even commenting its code it does not change anything. So, the problem is not here.

I suspect that the problem is given by the subfile… I have the impression the picture/label is read two times when compiling. However, I didn’t manage to solve this in any way.

Portion of the Main file:

%LIST OF FIGURES
listoffigures


%File where are those pictures
subfile{./tex/theories.tex}

Subfile with picture:

providecommand{main}{..}
documentclass[../phd_main.tex]{subfiles}

begin{document}
bla bla bla......

begin{figure}[hbtp]
vspace{-100pt}
caption{Interactions Between bla bla}
label{fig:interactions_between_post}
makebox[linewidth]{
includegraphics[width=1.6linewidth]{./img/interactions-1.png}
}
end{figure}

begin{figure}[hbtp]
vspace{-100pt}
makebox[linewidth]{
includegraphics[width=1.6linewidth]{./img/interactions-2.png}
}
end{figure}

end{document}

I had to do some workaround. In theory they are supposed to be one picture, but since it is large I split it in two, in two pages. However, I guess this should not be the problem.

One Answer

ok... this is funny... I just realized that the automatic numbering includes the number of the chapter as a first number. So 1.1 is the first image of the first chapter, 8.3 is the third image of the chapter eight. Everything all right then... This was not very intuitive. I spent a couple of days on this. I missing some ABC.

Answered by pat on January 3, 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