0

I need to submit a paper to a journal which asks a main.tex without the supplemental section, and a separate pdf for the supplemental.

Right now I have main.tex and supp.tex for these two documents.

(1) The issue is that there are "joint" information I need in the documents. For instance in main.tex, I need to reference to labels defined in supp.tex.

(2) I also need to make sure that the theorem/properties numbering between main.tex and supp.tex are consistant. For instance if main.tex ends with theorem 3, supp.tex should start with theorem 4.

(3) The last problem is that some theorems in the supplemental are the same as in the main.tex: hence they should have the same numbering.

For (1): a solution I found is the xr package. For (3): if the same theorem appeared in the same .tex I could use restatable, but my problem here is different as I have two different files.

What is the simplest way to solve my issue? I think it is a quite common one regarding journal submissions but I haven't found a clear answer to these problems combined.

StarBucK
  • 181
  • Do you think you can provide code for a minimal document we can compile to reproduce the problem? (Or you can provide code for two minimal documents if you're not sure how to provide them both in one.) – cfr Dec 12 '23 at 01:35

1 Answers1

0

I'll tackle here questions (1) and (2). For (3) there are a number of related questions (e.g. https://tex.stackexchange.com/a/51288/105447, How do I repeat a theorem number?), I'm not sure how they behave across documents but this is anyway beyond my expertise.

I'm not sure if there's no better method, and the one I'm proposing here involves some manual work (in the sense that you have to cater for any counter(s) you want to pass over from one document to the other), but this approach seems reasonable. It boils down to setting a label in your main.tex at the end of the document storing the counter of interest, then using xr to retrieve all your labels in supp.tex and use that label to restore the counter with refcount's \setcounterref.

main.tex:

\documentclass{article}

\usepackage{amsmath,amsthm} \newtheorem{theorem}{Theorem} \usepackage{hyperref}

\makeatletter \AddToHook{enddocument}{% \def@currentlabel{\arabic{theorem}}% \label{last-theorem}% } \makeatother

\begin{document}

\setcounter{theorem}{5} % just as an example

\begin{theorem}\label{th:main-last} my theorem \end{theorem}

\end{document}

supp.tex:

\documentclass{article}

\usepackage{amsmath,amsthm} \newtheorem{theorem}{Theorem} \usepackage{xr-hyper} \usepackage{hyperref}

\externaldocument[main-]{main} \setcounterref{theorem}{main-last-theorem}

\begin{document}

I can reference any labels from main.tex: \ref{main-th:main-last}

And the theorem counter follows the sequence from main.tex: \begin{theorem}\label{th:supp-first} my theorem \end{theorem}

\end{document}

And the output of the latter is:

enter image description here

gusbrs
  • 13,740