General ⇒ How can I write to and read from an AUX file?
How can I write to and read from an AUX file?
How can I write to and read from an AUX file? I'm using LaTeX from NiKTeX 2.5, and I've tried this simple example to start, which gives me an error message:
\documentclass{article}
\begin{document}
\makeatletter
\immediate\write\@auxout{foo}
\end{document}
Can someone help me out?
Alternatively, is there some online tutorial somewhere about how to write to and read from an AUX file? I can't seem to find one.
Thanks so much,
Nate
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
How can I write to and read from an AUX file?
Code: Select all
\documentclass{article}
\begin{document}
% This writes the file myfile.tmp.
% It will contain three lines
\newwrite\outputstream
\immediate\openout\outputstream=myfile.tmp
\immediate\write\outputstream{foo 1}
\immediate\write\outputstream{foo 2}
\immediate\write\outputstream{\string\textbf{foo 3}}
\immediate\closeout\outputstream
% This reads myfile.tmp and writes its contents
\newread\inputstream
\immediate\openin\inputstream=myfile.tmp
\immediate\read\inputstream to \auxcommand
This is the first line of the file: \auxcommand
\immediate\read\inputstream to \auxcommand
This is the second line of the file: \auxcommand
\immediate\read\inputstream to \auxcommand
This is the third line of the file: \auxcommand
\immediate\closein\inputstream
\end{document}
How can I write to and read from an AUX file?
This works for me for simple things:
Code: Select all
\protected@write\@auxout{}{%
% What's to be written here.
}
Code: Select all
\protected@write\@auxout{}{%
\string\@mycommand{arg}{arg}
}
-John