1

I want the numbering on my figures to appear as e.g. "1.1" and not "I.1". In my setup, I have made a subfiles configuration like so:

MAIN.TEX:

\documentclass[a4paper]{memoir}
\usepackage{subfiles}
\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\thefigure}{\arabic{chapter}.\arabic{figure}}
\begin{document}
\mainmatter
\subfile{chap/ch1.tex} 
\end{document}

and in CH1.TEX:

\documentclass[../main.tex]{subfiles}
\begin{document}
\chapter{first}
\begin{figure}
  \caption{A dummy figure}
\end{figure}
\end{document}

Now, in the subfile, the numbering on the figure is "1.1" as wanted, but in the mainfile it is displayed "I.1". I have tried deleting the .aux files for both documents and recompiling, but it doesn't work. The above code comes from here.

I am using TexLive 2014 with TeXmaker 4.5 under Windows 7.

Any help is much appreciated!

EDIT:

I found out where the error in my code is hidden. In my main.tex I have putten a \mainmatter before calling \subfile{chap/ch1}, and that changes the label from 1.1 to I.1. Is it possible to somehow override this behaviour of the \mainmatter macro?

  • I get 1.1 in the mainfile. I think, your main.tex file is missing \usepackage{subfiles}. I find your numbering style confusing, too. If you want to display chapter numbers with Roman figures, this should be applied for the \thefigure as well – user31729 Jul 27 '16 at 14:46
  • I have loaded the subfiles package in my document, sorry for the confusing code above! I am not sure what you mean by applying the same procedure to the chapter numbers as well? – Bartuc Jul 27 '16 at 14:49
  • Please \meaning\thefigure after \begin{document} and see whether it reports long macro:->\arabic {chapter}.\arabic figure – user31729 Jul 27 '16 at 14:50
  • It does report "long macro:->\arabic {chapter}.\arabic figure" when I put the "\meaning\thefigure" code in the subfile. – Bartuc Jul 27 '16 at 14:55
  • In the mainfile, it displays macro:->\@nameuse {thechapter}.\arabic {figure} – Bartuc Jul 27 '16 at 14:58
2

Your code is missing \usepackage{subfiles}. Without it, it won't compile. With it, everything works fine.

\documentclass[a4paper]{memoir}
\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\thefigure}{\arabic{chapter}.\arabic{figure}}
\usepackage{subfiles}
\begin{document}
    \subfile{ch1.tex} 

    Figure \ref{dummy} and \ref{dumber}.

    \begin{figure}
        \caption{A dummy figure\label{dumber}}
    \end{figure}

\end{document}

and

\documentclass[../main.tex]{subfiles}
\begin{document}
\chapter{first}
\begin{figure}
  \caption{A dummy figure\label{dummy}}
\end{figure}
\end{document}
| improve this answer | |
  • I have loaded the subfiles package in my original code in my document, but it still displays 1.1 in the subfiles and I.1 in the mainfile. – Bartuc Jul 27 '16 at 15:02
  • Hmm, which versions? Use \listfiles in the preamble? – JPi Jul 27 '16 at 15:15
  • I haven't used \listfiles. What does that do? – Bartuc Jul 27 '16 at 15:21
  • It lists the packages that you have. There may have been bug fixes. – JPi Jul 27 '16 at 20:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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