# [OS X TeX] Beginner problem with lstlisting

Doug Fields dfields-macosx-tex-0205 at pexicom.com
Wed Feb 16 11:25:19 EST 2005

Hello all,

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}

Trying the same thing in TeXShop gets the same error. I am using MacOS
X 10.3.8 and newly installed TeX with the steps below (from my setup
notes). As a note, I also have Fink on my computer, but did not use
that to install TeX. Details follow. I welcome any thoughts.

I didn't find anything I could use on Google. (That's not to say that
someone more knowledgeable couldn't have found something helpful, but
I'm not there yet.)

Error transcript:

~/Documents/TeX$latex second.tex This is pdfeTeX, Version 3.141592-1.20b-2.2 (Web2C 7.5.3) entering extended mode (./second.tex LaTeX2e <2003/12/01> Babel <v3.8d> and hyphenation patterns for american, nohyphenation, loaded. ! LaTeX Error: Environment lstlisting undefined. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.1 \begin{lstlisting} ? quit OK, entering \batchmode Example code: (from the web site) ~/Documents/TeX$ cat second.tex
\begin{lstlisting}
\documentclass{article}
\author{me}
\date{\today}
\title{My First Document}

\begin{document}
\maketitle
\section{My first section}
Now I'm up and running, see equation (\ref{eqn:random}).
$$\label{eqn:random} \alpha^{\beta}=\frac{\sqrt{\int_{0}^{\infty}x^2 dx}}{\beta}$$
A paragraph

Another paragraph.
Still the same paragraph. In the formatted document, this paragraph

will not have a line break after the first sentence.
\subsection{In more detail}\label{sec:subsectionmoredetail}
Subsection text. The indents don't have to be here,
but they help you see the document structure.
\end{document}
\end{lstlisting}

Setup steps: (per my install notes, I'm detailed about noting what goes
onto my PowerBook so I can remove it later in the case of problems)

*) Install TeX with the i-Installer, using II2.dmg
a) Install i-Installer 2.69.0 in Applications/Utilities
1) Keeps notes in the Documents/i-Packages directory - do not delete
b) Using it, install from the i-Directory at Yale:
c) FreeType 2 (release notes last changed 2004/01/14)
d) libwmf (last changed 2004/01/31)
e) GhostScript 8 (2004/12/20)
1) Add /usr/local/bin to environment? yes
f) ImageMagick (2004/02/07)
g) FontForge (2004/05/19)
h) TeX - the big one (2005/02/13)
1) Expert Install
2) 2005 Devel. (can change mind later, it says)
3) Select all packages (parts)
4) Configure what? Select the default
5) Select languages: american and nohyphenation
6) Paper size: Letter
7) (It didn't ask me to put it into the path?) It did put it into the
path
i) CM Super (for PostScript type 1 fonts) (2004/11/06)
NOTES:
a) Personal files should be stored in ~/Library/texmf
b) folder structure inside ~/Library/texmf should mimic that inside
/Library/teTeX/share/texmf

*) Install TeXShop 1.35e
a) Drag to Applications
b) Drag the "texmf" to ~/Library from the DMG
c) the example from
http://www.cs.wright.edu/~jslater/mac-tex/mac-tex-intro/
mactexintro.html DOES NOT WORK

Many thanks for any insight.

Cheers,

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