[tex-eplain] Cross references between two different files?

Rodolfo Medina romeomedina at libero.it
Tue Aug 17 23:03:48 CEST 2004

Rodolfo Medina wrote:

>Hi, everyone.
>I'm a plain TeX user. By typing
>					\input eplain
>at the beginning of my file, and using the eplain command
>					\definexref,
>I obtain beautiful cross references all over the file, and I'm very happy
>about them.
>Now, my question is:
>would it be possible (and how?) to create cross references also between two
>different files?
>For example, let's have file1.tex and file2.tex.
>In file1.tex I write, say,
>					\definexref{label}{exercise 1}{}.
>If I write
>					\ref{label}
>in file1.tex, everything goes well and, after processing twice the
>I get the cross reference in the DVI file;
>but if I write
>					\ref{label}
>in file2.tex instead of in file1.tex, and then I run tex over file1.tex and
>I won't get the cross reference.
>I hope I managed to explain the matter!
>Would there be an alternative way to get the cross reference between
>file1.tex and file2.tex?
>If not, then it is not very useful breaking a large file into small pieces.
>Thanks very much to anyone who can respond.
>	Rodolfo
Karl Berry replied:

>Hi Rodolfo,
>    If not, then it is not very useful breaking a large file into small
>Usually, even though a large file may be broken into several pieces, you
>still run one top-level file that includes everything.  In this case,
>there should be no problem to have xref's in the different files.
>If that's not your situation, it might work for file1.tex to say
>something like:
>{\catcode`@=11 \input file2.aux}
>and vice versa.  I haven't tried it.

Rodolfo Medina replies:

I did this way:
Suppose file1.tex and file2.tex in the same directory.
In that directory I created a file named auxil.tex, containig the lines:

\input file1.aux
\input file2.aux

. Then in the eplain.tex I replaced "\input \jobname.aux" with "\input
named myeplain.tex this slightly modified version of eplain.tex
and put it in the same directory of file1.tex and file2.tex.
In file1.tex I wrote:

\input myeplain

, and in file2.tex:

\input myeplain

, then run twice tex over file1 and file2
and obtained the cross reference between two different files.
The only inconvenience is that the user has to write the auxil.tex by hand.
Would it have been a better solution to the matter?
Maybe such a feature would be worth being created in a future release of


More information about the tex-eplain mailing list