[OS X TeX] Beginner problem with lstlisting

Herb Schulz herbs at wideopenwest.com
Wed Feb 16 12:50:50 EST 2005

On 2/16/05 11:40 AM, "Doug Fields" <dfields-macosx-tex-0205 at pexicom.com>

> Many thanks for the replies so far. That got me started and all is
> well. (The rest now is a transcript of how I got it working in case
> people search the list in the future.)
> Upon investigating the contents of my file (second.tex) which was
> simply cut/pasted from Safari, I noted that it had a whole bunch of bad
> characters (c2 a0 byte sequences, presumably Unicode for non-breaking
> spaces   I'm guessing). Using tr to convert those to spaces, and
> removing the lines mentioned, I got a file which produced through two
> steps seemingly correct looking output in a PDF.


I also had that problem.

> That said, the "latex" still gave me warnings about which I'm wondering:
> LaTeX Warning: Reference `eqn:random' on page 1 undefined on input line
> 9.
> LaTeX Warning: There were undefined references.
> LaTeX Warning: Label(s) may have changed. Rerun to get cross-references
> right.
> I'm assuming this is because \ref{eqn:random} appears before
> \label{eqn:random}, which would seem to be the thing rendered as (1)
> for the equation.

Exactly. To get cross references correct you need two passes through latex.
If you use a bibxliography, a table of contents, etc., it might need three

> Running the exact same command line again fixes the problem. Is there a
> way to tell "latex" to two-pass the file instead of one-passing it, if
> it deems it necessary? No matter, at this point it works, and that's
> the important thing.

No way directly. You can write a shell script for CLI, an engine for TeXShop
or a project in iTeXMac for that.

> Thanks for the help.
> Doug

A very helpful bunch of folks here.

Good Luck,

Herb Schulz
(herbs at wideopenwest.com)

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>

More information about the MacOSX-TeX mailing list