# Reledmac : print endnotes from an external document

I'd like to have my critical edition in one document, and the endnotes (from the package reledmac) belonging to this document printed in an other one, in the same way that it's possible to have cross-references between two documents using the command \externaldocument and the xr package. Is there a way to achieve this and to make the following exemple working ?

File1 : Edition

\documentclass[11pt, a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[LGR,T1]{fontenc}
\usepackage{reledmac}

\begin{document}

\beginnumbering

\pstart

This is an \edtext{Exemple}
{\lemma{exemple}
\Aendnote{This is my note}}.

\pend

\endnumbering

\end{document}


File 2: Notes.tex

\documentclass[11pt, a4paper]{book}
\usepackage{reledmac}
\usepackage{reledpar}
\usepackage[utf8]{inputenc}
\usepackage[LGR,T1]{fontenc}
\externaldocument{Edition} % .tex file with my edition
\usepackage{xr}

\begin{document}

\doendnotes{A} % endnotes from CriticalEdition.tex

\end{document}

• Your edition file doesn't compile without error for me. Does it work for you? – Ulrike Fischer Feb 26 '18 at 11:25
• Yes, sorry. It should work correctly now. – Jean Feb 26 '18 at 18:50
• I had to go, but I will answer to you tomorrow. There is a solution, I think. – Maïeul Feb 26 '18 at 19:07

The \doendnotes macro is programmed to input endote file based on the main .tex file name.

We could add feature to customize that. For this, please open an issue on github reledmac page.

However, it is easy to create your custom \doexternalendnotes to input your file Edition.**end

In the preamble of your Note.tex file, add the following lines, after loading reledmac.

\let\doexternalendnotes\doendnotes%Copy \doendnotes to \doexternalendnotes
\patchcmd{\doexternalendnotes}%Remplace \jobname by a fixed name, e.g Edition
{\jobname}%
{Edition}%
{}%
{}%


And so you can use \doexternalendnotes{A}.

So

\documentclass[11pt, a4paper]{book}
\usepackage{reledmac}
\usepackage{reledpar}
\usepackage[utf8]{inputenc}
\usepackage[LGR,T1]{fontenc}
\usepackage{xr}
\externaldocument{Edition} % .tex file with my edition
\let\doexternalendnotes\doendnotes
\patchcmd{\doexternalendnotes}%
{\jobname}%
{Edition}%
{}%
{}%
\begin{document}
\doexternalendnotes{A} % endnotes from CriticalEdition.tex

\end{document}


You must do all the run needed for Edition.tex before running note.tex