[OS X TeX] Beginner problem with lstlisting

Doug Fields dfields-macosx-tex-0205 at pexicom.com
Wed Feb 16 12:40:32 EST 2005


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.

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.

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.

Thanks for the help.

Doug

Transcript:

AdmiralOSX:~/Documents/TeX$ tr '\302\240' '  ' <second.tex >second3.tex
AdmiralOSX:~/Documents/TeX$ latex second3.tex
This is pdfeTeX, Version 3.141592-1.20b-2.2 (Web2C 7.5.3)
entering extended mode
(./second3.tex
LaTeX2e <2003/12/01>
Babel <v3.8d> and hyphenation patterns for american, nohyphenation,  
loaded.
(/usr/local/teTeX/share/texmf.tetex/tex/latex/base/article.cls
Document Class: article 2004/02/16 v1.4f Standard LaTeX document class
(/usr/local/teTeX/share/texmf.tetex/tex/latex/base/size10.clo))
No file second3.aux.

LaTeX Warning: Reference `eqn:random' on page 1 undefined on input line  
9.

[1] (./second3.aux)

LaTeX Warning: There were undefined references.


LaTeX Warning: Label(s) may have changed. Rerun to get cross-references  
right.

  )
Output written on second3.dvi (1 page, 1400 bytes).
Transcript written on second3.log.
AdmiralOSX:~/Documents/TeX$ latex second3.tex
This is pdfeTeX, Version 3.141592-1.20b-2.2 (Web2C 7.5.3)
entering extended mode
(./second3.tex
LaTeX2e <2003/12/01>
Babel <v3.8d> and hyphenation patterns for american, nohyphenation,  
loaded.
(/usr/local/teTeX/share/texmf.tetex/tex/latex/base/article.cls
Document Class: article 2004/02/16 v1.4f Standard LaTeX document class
(/usr/local/teTeX/share/texmf.tetex/tex/latex/base/size10.clo))  
(./second3.aux)
[1] (./second3.aux) )
Output written on second3.dvi (1 page, 1348 bytes).
Transcript written on second3.log.
AdmiralOSX:~/Documents/TeX$ dvipdf second3.dvi second3.pdf


On Feb 16, 2005, at 11:42 AM, Bruno Voisin wrote:

> Le 16 févr. 05, à 17:25, Doug Fields a écrit :
>
>> I apologize for posting such a beginner problem, as I'm just  
>> learning. I managed to get a simple hello world working with latex  
>> and the DVI to PDF conversion tools (command line) happily, but then  
>> following a setup tutorial here:
>>
>> http://www.cs.wright.edu/~jslater/mac-tex/mac-tex-intro/ 
>> mactexintro.html
>>
>> I was unable to get the more complicated example to work due to an  
>> error with the initial line:
>>
>> \begin{lstlisting}
>
> I don't think this line is significant. Looking at the source (the  
> HTML code) for this web page, it seems to have been generated  
> automatically from a LaTeX file using TeX4ht:
>
> <meta name="generator" content="TeX4ht  
> (http://www.cis.ohio-state.edu/~gurari/TeX4ht/mn.html)">
> <meta name="originator" content="TeX4ht  
> (http://www.cis.ohio-state.edu/~gurari/TeX4ht/mn.html)">
>
> It seems something went wrong during the conversion process,  
> generating the two lines:
>
> \begin{lstlisting}
> \end{lstlisting}
>
> which shouldn't really be there (a LaTeX document should begin with  
> \documentclass). This is at least the impression I get from looking at  
> the HTML source for the example document:
>
> <table width="100%"
> class="verbatim"><tr class="verbatim"><td
> class="verbatim"><div class="verbatim">
> \begin{lstlisting}
>  <br />\documentclass{article}
>  <br />\author{me}
>  <br />\date{\today}
>  <br />\title{My First Document}
>  <br />
>  <br />\begin{document}
> [...]
>  <br />\end{document}
>  <br />\end{lstlisting}
>  <br />
> </div>
> </td></tr></table>
>
> Hope this helps,
>
> Bruno Voisin
> --------------------- 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>
>
>
>

--------------------- 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