0

I have a single file containing appendix and manuscript. For the submission, I'd have to split both parts into two separate files. However, there are few hundreds of references from appendix to manuscript and back, as in the simplified MWE, which would create undefined references if I just split them and compile independently:

\documentclass[reqno, a4paper,11pt]{amsart}
\usepackage{xcolor}
\title{Manuscript and appendix}

\usepackage[bookmarks=false]{hyperref} \hypersetup{ colorlinks = true, citecolor =green!70!black, linkcolor=green!70!black }

\begin{document} \maketitle

\section{Some important section}\label{sec:Important}

Because of eq. \eqref{didntfit} in Appendix \ref{sec:Unimportant}...

\appendix

\section{Some formulae}\label{sec:Unimportant}

We prove here \begin{align} a^2+b^2= c^2 \label{didntfit} \end{align} which was the main tool in Sec. \ref{sec:Important}

\end{document}

What this give is enter image description here

and I wish two files as follows, without manually giving the number/letter assigned to referred equations and sections, keeping the hyperlinks inside each part (manuscript-manuscript and appendix-appendix hyperlinks kept) but only printing the number/letter of a cross-reference appendix<->manuscript.

enter image description here enter image description here

c.p.
  • 4,636
  • LaTeX has a command \input{file-name}. It literally inserts a part of a code into the current file. – Celdor Sep 12 '22 at 08:44
  • @Celdor Ok, but I want the opposite. I had originally done the appendix inside the same document of the manuscript. I have to submit two documents, one with the manuscript, other with the appendix, keeping the references from one to the other. – c.p. Sep 12 '22 at 08:46
  • 1
    Oh, I see. Perhaps xr is what you are up to (See the FAQ) – Celdor Sep 12 '22 at 08:50
  • As an alternative you can use \include to generate the whole thing, and than do two runs with different \includeonly (and maybe changed title). Or just use pdfjam or pdftk or a PDF editing tool to split the PDF into two parts. – cabohah Jun 09 '23 at 13:29
  • @cabohah thanks, but part of the question is that they should compile independently. – c.p. Jun 09 '23 at 14:15

1 Answers1

0

David Carlisle's xr package does it.

The next file is SE_Question_Ap, the appendix-independent file.

\documentclass[reqno, a4paper,11pt]{amsart}

\usepackage{xr} \externaldocument{SE_Question_Split} \usepackage{xcolor} \title{Appendix}

\usepackage[bookmarks=false]{hyperref} \hypersetup{ colorlinks = true, citecolor =green!70!black, linkcolor=green!70!black } % \hypersetup{}

\begin{document} \maketitle

% \section{Some important section}\label{sec:Important} % % Because of eq. (1) in Appendix A. %

\appendix

\section{Some formulae}\label{sec:Unimportant}

We prove here \begin{align} a^2+b^2\neq c^2 \label{didntfit} \end{align} which was the main tool in Sec. \ref{sec:Important} \end{document}

The next file is SE_Question_Split.

\documentclass[reqno, a4paper,11pt]{amsart}

\usepackage{xr} \externaldocument{SE_Question_Split_App} \usepackage{xcolor} \title{Manuscript and appendix}

\usepackage[bookmarks=false]{hyperref} \hypersetup{ colorlinks = true, citecolor =green!70!black, linkcolor=green!70!black } % \hypersetup{}

\begin{document} \maketitle

\section{Some important section}\label{sec:Important}

Because of eq. \eqref{didntfit} in Appendix \ref{sec:Unimportant}

% \appendix % % \section{Some formulae}\label{sec:Unimportant} % % We prove here % \begin{align} % a^2+b^2\neq c^2 \label{didntfit} % \end{align} % which was the main tool in Sec. \ref{sec:Important}

\end{document}

c.p.
  • 4,636