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

geolsoft at mail.ru geolsoft at mail.ru
Wed Aug 18 18:54:14 CEST 2004


On Tue, Aug 17, 2004 at 11:03:48PM +0200, Rodolfo Medina wrote:
> 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
> 


If I understand correctly, you need to include all .aux files found in current
directory.  If you have some kind of sed available on your system you can write
a simple shell script which will generate `auxil.tex' behind the scenes (or
better `aux.lst', to keep it from mixing with your .tex files), and run tex
twice on all *.tex files:


--------------------start of build.sh--------------------
#!/bin/sh

TEX=tex
TEX_FLAGS="--interaction nonstopmode"

cat /dev/null > aux.lst
for file in *.tex; do
  $TEX $TEX_FLAGS $file
done;
ls *.aux | sed 's/.*/\\input &/' > aux.lst
echo
for file in *.tex; do
  $TEX $TEX_FLAGS $file
done;
--------------------end of build.sh--------------------


If you use make to manage your builds, you can do the same using Makefile like
the following (this one is for GNU Make):


--------------------start of Makefile--------------------
TEX_FILES := $(wildcard ./*.tex)
TEX_FLAGS  = --interaction nonstopmode

DVI_FILES := $(patsubst %.tex,%.dvi,$(TEX_FILES))

.PHONY: all

all: $(DVI_FILES)

$(DVI_FILES): aux.lst
	for file in $(TEX_FILES); do \
	  $(TEX) $(TEX_FLAGS) $$file; \
	done
	rm aux.lst

aux.lst:
	cat /dev/null > aux.lst
	for file in $(TEX_FILES); do \
	  $(TEX) $(TEX_FLAGS) $$file; \
	done
	@echo
	ls *.aux | sed 's/.*/\\input &/' > aux.lst
	@echo
--------------------end of Makefile--------------------


Try this on file1.tex and file2.tex:


--------------------start of file1.tex--------------------
\input eplain
{\catcode`@=11
\input aux.lst }
\definexref{label}{Hallo!}{}
\bye
--------------------end of file1.tex--------------------


--------------------start of file2.tex--------------------
\input eplain
{\catcode`@=11
\input aux.lst }
\refn{label}
\bye
--------------------end of file2.tex--------------------


Best regards,
Oleg Katsitadze



More information about the tex-eplain mailing list