1 % \iffalse meta-comment
4 % The LaTeX3 Project and any individual authors listed elsewhere
7 % This file is part of the LaTeX base system.
8 % -------------------------------------------
10 % It may be distributed and/or modified under the
11 % conditions of the LaTeX Project Public License, either version 1.3c
12 % of this license or (at your option) any later version.
13 % The latest version of this license is in
14 % http://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of LaTeX
16 % version 2005/12/01 or later.
18 % This file has the LPPL maintenance status "maintained".
20 % The list of all files belonging to the LaTeX base distribution is
21 % given in the file `manifest.txt'. See also `legal.txt' for additional
24 % The list of derived (unpacked) files belonging to the distribution
25 % and covered by LPPL is defined by the unpacking scripts (with
26 % extension .ins) which are part of the distribution.
32 %% Copyright (C) 1987 by Leslie Lamport
33 %% Copyright (C) 1994--1997 LaTeX3 project, Johannes Braams
34 %% all rights reserved.
37 \ProvidesFile{alltt.dtx}
39 %<package>\NeedsTeXFormat{LaTeX2e}
40 %<package>\ProvidesPackage{alltt}
41 %<driver>\ProvidesFile{alltt.drv}
42 %\ProvidesFile{alltt.dtx}
43 [1997/06/16 v2.0g defines alltt environment]
46 \documentclass{ltxdoc}
48 \providecommand{\Lenv}[1]{\textsf{#1}}
49 \providecommand{\pkg}[1]{\texttt{#1}}
50 \providecommand{\file}[1]{\texttt{#1}}
56 % \changes{v2.0g}{1997/06/16}{A few documentation fixes (PR 2520)}
57 % \changes{v2.0d}{1995/04/02}{A few documentation fixes (PR 1517)}
59 % \GetFileInfo{alltt.dtx}
60 % \title{The \texttt{alltt} environment\thanks{This file
61 % has version number \fileversion, last
62 % revised \filedate.}}
63 % \author{Johannes Braams}
65 % \MaintainedByLaTeXTeam{latex}
69 % This package defines the \Lenv{alltt} environment, which is like
70 % the \Lenv{verbatim} environment except that |\|, |{|, and |}|
71 % have their usual meanings.
73 % Thus, other commands and environments can appear within an
74 % \Lenv{alltt} environment.
77 % \section{Introduction}
80 % Here are some things you may want to do in an \Lenv{alltt}
83 % \item Change fonts--e.g., by typing |{\em emphasized text\/}|
85 % \item Insert text from a file \file{foo.tex} by typing
86 % |\input{foo}|. Beware that each |<return>| starts a new line, so
87 % if \file{foo.tex} ends with a |<return>| you can wind up with an
88 % extra blank line if you're not careful.
90 % \item Insert a math formula. Note that |$| just produces a dollar
91 % sign, so you'll have to type |\(...\)| or |\[...\]|. Also, |^|
92 % and |_| just produce their characters; use |\sp| or |\sb| for
93 % super- and subscripts, as in |\(x\sp{2}\)|.
98 % \section{The Implementation}
104 % \begin{environment}{alltt}
105 % The \Lenv{alltt} environment is similar to the \Lenv{verbatim}
106 % environment, except that |\|, |{| and |}| have their usual
108 % \changes{v2.0b}{1994/10/29}{Added a missing \cs{dospecials}}
109 % \changes{v2.0c}{1995/01/27}{Reset \cs{dospecials} after its changed
110 % version is executed}
111 % \changes{v2.0e}{1995/05/13}{brought definition up to date with the
112 % verbatim environment}
113 % \changes{v2.0e}{1995/05/13}{Save and restore (in math mode) the
114 % definition of the \texttt{'} character}
119 \newenvironment{alltt}{%
126 \leftskip\@totalleftmargin
129 \parfillskip\@flushglue
135 \leavevmode\null\@@par\penalty\interlinepenalty
138 \ifhmode\@@par\penalty\interlinepenalty\fi
145 % \changes{v2.0f}{1995/07/24}{Added setting of the \cs{catcode} of the
146 % \texttt{'} character}
148 \everymath\expandafter{\the\everymath
149 \catcode`\'=12 \let~\org@prime}
150 \everydisplay\expandafter{\the\everydisplay
151 \catcode`\'=12 \let~\org@prime}
152 \let\org@dospecials\dospecials
153 \g@remfrom@specials{\\}
154 \g@remfrom@specials{\{}
155 \g@remfrom@specials{\}}
158 \let\dospecials\org@dospecials
159 \frenchspacing\@vobeyspaces
160 \everypar \expandafter{\the\everypar \unpenalty}}
165 % \begin{macro}{\g@remfrom@specials}
166 % In the old implementation of the \pkg{alltt} package a fixed
167 % |\dospecials| was used. However nowadays the |\dospecials|
168 % command might contain more special characters at run-time then as
169 % was defined in the format. Therefore we remove the necessary
170 % special character from |\dospecials| at the start of the
171 % \Lenv{alltt} environment. For this we need a macro. Remember that
172 % the list of special characters in |\dospecials| contains the
173 % control sequence |\do| between the characters. We use that to
174 % check whether a character has to be removed.
176 % The macro |\g@remfrom@specials| takes one argument, the chracter
177 % to be removed from the list.
179 \def\g@remfrom@specials#1{%
181 % We build up a new list in |\@new@speicals|.
185 % The command |\@remove| compares its argument with the argument of\\
186 % |\g@remfrom@specials|.
191 % When they are not the same the argument of |\@remove| is added
192 % (together with |\do|) to the new list.
194 \g@addto@macro\@new@specials{\do ##1}\fi}
196 % Now we |\let| |\do| be equal to |\@remove| and execute
199 \let\do\@remove\dospecials
201 % All that's left is to make |\dospecials| point to the new list.
203 \let\dospecials\@new@specials