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.
33 %% Copyright (C) 1987 by Leslie Lamport
34 %% Copyright (C) 1994--1997 LaTeX3 project, Johannes Braams
35 %% all rights reserved.
38 \ProvidesFile{alltt.dtx}
40 %<package>\NeedsTeXFormat{LaTeX2e}
41 %<package>\ProvidesPackage{alltt}
42 %<driver>\ProvidesFile{alltt.drv}
43 %\ProvidesFile{alltt.dtx}
44 [1997/06/16 v2.0g defines alltt environment]
47 \documentclass{ltxdoc}
49 \providecommand{\Lenv}[1]{\textsf{#1}}
50 \providecommand{\pkg}[1]{\texttt{#1}}
51 \providecommand{\file}[1]{\texttt{#1}}
57 % \changes{v2.0g}{1997/06/16}{A few documentation fixes (PR 2520)}
58 % \changes{v2.0d}{1995/04/02}{A few documentation fixes (PR 1517)}
60 % \GetFileInfo{alltt.dtx}
61 % \title{The \texttt{alltt} environment\thanks{This file
62 % has version number \fileversion, last
63 % revised \filedate.}}
64 % \author{Johannes Braams}
66 % \MaintainedByLaTeXTeam{latex}
70 % This package defines the \Lenv{alltt} environment, which is like
71 % the \Lenv{verbatim} environment except that |\|, |{|, and |}|
72 % have their usual meanings.
74 % Thus, other commands and environments can appear within an
75 % \Lenv{alltt} environment.
78 % \section{Introduction}
81 % Here are some things you may want to do in an \Lenv{alltt}
84 % \item Change fonts--e.g., by typing |{\em emphasized text\/}|
86 % \item Insert text from a file \file{foo.tex} by typing
87 % |\input{foo}|. Beware that each |<return>| starts a new line, so
88 % if \file{foo.tex} ends with a |<return>| you can wind up with an
89 % extra blank line if you're not careful.
91 % \item Insert a math formula. Note that |$| just produces a dollar
92 % sign, so you'll have to type |\(...\)| or |\[...\]|. Also, |^|
93 % and |_| just produce their characters; use |\sp| or |\sb| for
94 % super- and subscripts, as in |\(x\sp{2}\)|.
99 % \section{The Implementation}
105 % \begin{environment}{alltt}
106 % The \Lenv{alltt} environment is similar to the \Lenv{verbatim}
107 % environment, except that |\|, |{| and |}| have their usual
109 % \changes{v2.0b}{1994/10/29}{Added a missing \cs{dospecials}}
110 % \changes{v2.0c}{1995/01/27}{Reset \cs{dospecials} after its changed
111 % version is executed}
112 % \changes{v2.0e}{1995/05/13}{brought definition up to date with the
113 % verbatim environment}
114 % \changes{v2.0e}{1995/05/13}{Save and restore (in math mode) the
115 % definition of the \texttt{'} character}
120 \newenvironment{alltt}{%
127 \leftskip\@totalleftmargin
130 \parfillskip\@flushglue
136 \leavevmode\null\@@par\penalty\interlinepenalty
139 \ifhmode\@@par\penalty\interlinepenalty\fi
146 % \changes{v2.0f}{1995/07/24}{Added setting of the \cs{catcode} of the
147 % \texttt{'} character}
149 \everymath\expandafter{\the\everymath
150 \catcode`\'=12 \let~\org@prime}
151 \everydisplay\expandafter{\the\everydisplay
152 \catcode`\'=12 \let~\org@prime}
153 \let\org@dospecials\dospecials
154 \g@remfrom@specials{\\}
155 \g@remfrom@specials{\{}
156 \g@remfrom@specials{\}}
159 \let\dospecials\org@dospecials
160 \frenchspacing\@vobeyspaces
161 \everypar \expandafter{\the\everypar \unpenalty}}
166 % \begin{macro}{\g@remfrom@specials}
167 % In the old implementation of the \pkg{alltt} package a fixed
168 % |\dospecials| was used. However nowadays the |\dospecials|
169 % command might contain more special characters at run-time then as
170 % was defined in the format. Therefore we remove the necessary
171 % special character from |\dospecials| at the start of the
172 % \Lenv{alltt} environment. For this we need a macro. Remember that
173 % the list of special characters in |\dospecials| contains the
174 % control sequence |\do| between the characters. We use that to
175 % check whether a character has to be removed.
177 % The macro |\g@remfrom@specials| takes one argument, the chracter
178 % to be removed from the list.
180 \def\g@remfrom@specials#1{%
182 % We build up a new list in |\@new@speicals|.
186 % The command |\@remove| compares its argument with the argument of\\
187 % |\g@remfrom@specials|.
192 % When they are not the same the argument of |\@remove| is added
193 % (together with |\do|) to the new list.
195 \g@addto@macro\@new@specials{\do ##1}\fi}
197 % Now we |\let| |\do| be equal to |\@remove| and execute
200 \let\do\@remove\dospecials
202 % All that's left is to make |\dospecials| point to the new list.
204 \let\dospecials\@new@specials