÷ƒ’À;è TeX output 1998.01.17:2006‹ÿÿÿÿ y ý£ ? þ’kQóDÓítG®G®cmr17¹A–7tNew“ImplemenŒqtation“of“LŸüdú‘úKGóX«Q cmr12ºAŽŽ‘¹”¹T‘ý[™Ÿ¸-EŽ‘;gX'sŽŸ‘q6ïó߆µTG® cmtt12¿verbatim–7t¹and“¿verbatim*“¹En•Œqvironmen“ts.ŽŸ’ß„]ºRainer‘ê¨Sc¬rh‘ú opfŽŽ¤’²P Zenš¬rtrum–ê¨fSŽ‘ùÌvur“Daten˜v˜erarbSŽeitungŽŽ¡’ËÀder–ê¨Univ¬rersit‘ú at“MainzŽŽ¡’¨æÑAnselm-F›ÿVran•¬rtz-v“on-Ben“tzel-W˜eg‘ê¨12ŽŽ¡’Ü”çD-55099‘ê¨MainzŽŽ¡’¸F‘ÿVederal–ê¨Republic“of“German¬ryŽŽ¡’¬ò_In¬rternet:‘8àó߆µT cmtt12ÆSchoepf@Uni-Mainz.DEŽŽŽŽŽŸgßü’ß/ºBernd‘ê¨Raic¬rhleŽŽ¤’ؾVStettener–ê¨Str.“73ŽŽ¡’ÉЂD-73732‘ê¨W‘ú alden¬rbronnŽŽ¡’¸F‘ÿVederal–ê¨Republic“of“German¬ryŽŽ¡‘rHÃIn¬rternet:‘8àÆraichle@azu.Informatik.Uni-Stuttgart.DEŽŽŽŽŽŸKßü’áȺChris‘ê¨Ro¬rwleyŽŽ¤’ÍJThe–ê¨OpSŽen“Univ•¬rersit“yŽŽ¡’Û‘ZP¬rarsifal‘ê¨CollegeŽŽ¡’ÞKLFinc¬rhley‘ê¨RoadŽŽ¡’­¶ London–ê¨NW3“7BG,“England,“UKŽŽ¡’©ÛøIn¬rternet:‘8àÆC.A.Rowley@open.ac.ukŽŽŽŽŽŸ^37’æ º1997/04/30ŽŸ$’ï!Kót ‰: cmbx9ÈAbstractŽŸ¬Ñ‘xßüóo´‹Ç cmr9ÇThis––!pacš¾9k‘ÿ|rage“reimplemen˜ts“the“LŸýó5‘ü«‡ó¹Aa¨cmr6ÁAŽŽ‘© ÇT‘þuAŸïÿEŽ‘˜ŸX“ó ߤN cmtt9Ëverbatim“Çand“Ëverbatim*“Çen˜vi-ޤ ‘kronmenš¾9ts.‘EÑIn–#addition“it“pro˜vides“a“Ëcomment“Çen˜vironmen˜t“that“skips“an˜yŽ¡‘kcommands–ºor“text“bAÇet•¾9w“een–ºË\begin{comment}“Çand“the“next“Ë\end{comment}Ç.Ž¡‘kIt–Talso“de nes“the“command“Ëverbatiminput“Çto“input“a“whole“ le“v¾9erbatim.ŽŸ!Ä‘Ró"ÂÖN ff cmbx12Í1Ž‘jLËUsage‘ffnotesŽŸç‘RóKñ`y cmr10²LŸýó5‘üffóÙ“ Rcmr7±AŽŽ‘͉²T‘þU>Ÿ'EŽ‘ãxX's–ÝÐó#ßêŸ'EŽ‘ãxX“has“to“read“all“the“text“bGet•¸ãw“een–nÔthe“Î\begin{verbatim}“²and“theŽ¡‘kÎ\end{verbatim}–z<²bGefore“it“can“output“anš¸ãything,‘ƒvlong“v˜erbatim“listings“ma˜yŽ¡‘ko•¸ãv“er o“w–UUT‘þU>Ÿ'EŽ‘ãxX's“memory‘ÿ*ª.Ž©™š‘RWhereas–ymthe“ rst“of“these“pšGoin¸ãts“can“b˜e“considered“only“a“minor“n¸ãuisance“theŽ¡‘Rother–UUone“is“a“real“limitation.Ž¡‘aThis–ìpacš¸ãk‘ÿqÇage“ le“con˜tains“a“reimplemen˜tation“of“the“Îverbatim“²and“Îverbatim*Ž¡‘R²en•¸ãvironmen“ts›Ì whic“h˜o“v“ercomes˜these˜restrictions.‘ÕìThere˜is,›é¹ho“w“ev“er,˜one‘Ì incom-Ž¡‘Rpatibilit•¸ãy›jPbGet“w“een˜the˜old˜and˜the˜new˜implemen“tations˜of˜these˜en“vironmen“ts:‘üDtheŽ¡‘Rold–ÛCvš¸ãersion“w˜ould“treat“text“on“the“same“line“as“the“Î\end{verbatim}“²commandŽ¡‘Ras–UUif“it“wš¸ãere“on“a“line“b˜y“itself.ަ’¢½Òó$ò"V cmbx10ÏThis–ÕTnew“v®9ersion“will“simply“ignore“it.ަ‘R²(This–‡•is“the“price“one“has“to“paš¸ãy“for“the“remo˜v‘ÿqÇal“of“the“old“Îverbatim“²en˜vironmen˜t'sŽ¡‘Rsize–UUlimitations.)‘qÇIt“will,“ho•¸ãw“ev“er,–UUissue“a“w¸ãarning“message“of“the“formŽŸ™š‘RËLaTeX–¹–warning:“Characters“dropped“after“\end{verbatim*}!ަ‘R²This–¨üis“not“a“real“problem“since“this“text“can“easily“bGe“put“on“the“next“line“withoutŽ¡‘Ra ecting–UUthe“output.Ž¡‘aThis–hnew“implemenš¸ãtation“also“solv˜es“the“second“problem“men˜tioned“abGo˜v˜e:‘—?itŽ¡‘Ris–ͬpšGossible“to“lea•¸ãv“e–ͬspaces“(but“ó%ý': cmti10Ðnot‘À„²b˜egin“a“new“line)“b˜et•¸ãw“een–ͬthe“Î\end“²and“theŽ¡‘RÎ{verbatim}–UU²or“Î{verbatim*}²:ŽŸ™š‘RË\begin‘¹–{verbatim*}ޤ ‘`,ÂtestŽ¡‘`,ÂtestŽ¡‘R\end‘¹–{verbatim*}ަ‘a²Additionally–Šwš¸ãe“in˜troGduce“a“Îcomment“²en˜vironmen˜t,‘×;with“the“e ect“that“theޤ ‘Rtext›7GbGet•¸ãw“een˜Î\begin{comment}˜²and˜Î\end{comment}˜²is˜simply˜ignored,‘=JregardlessŽ¡‘Rof–Š1what“it“lošGoks“lik•¸ãe.‘.A“t–Š1 rst“sigh¸ãt“this“seems“to“b˜e“quite“di eren¸ãt“from“the“purp˜oseŽ¡‘Rof–´"vš¸ãerbatim“listing,‘ËÕbut“actually“the“implemen˜tation“of“these“t˜w˜o“concepts“turnsŽ¡‘Rout–gŽto“bšGe“v¸ãery“similar.‘¨qBoth“rely“on“the“fact“that“the“text“b˜et•¸ãw“een‘gŽÎ\begin{...}Ž¡‘R²and–±ÈÎ\end{...}“²is“read“bš¸ãy“T‘þU>Ÿ'EŽ‘ãxX“without“in˜terpreting“an˜y“commands“or“spGecialŽ¡‘Rcš¸ãharacters.‘\³The–remaining“di erence“bGet˜w˜een“Îverbatim“²and“Îcomment“²is“only“thatŽ¡‘Rthe–ÅStext“is“to“bšGe“t¸ãyp˜eset“in“the“ rst“case“and“to“b˜e“throš¸ãwn“a˜w˜a˜y“in“the“latter.‘AÇNoteŽ¡‘Rthat–UUthese“en•¸ãvironmen“ts–UUcannot“bGe“nested.Ž¡‘aÎ\verbatiminput–ß®²is“a“command“with“one“argumenš¸ãt“that“inputs“a“ le“v˜erbatim,Ž¡‘Ri.e.–UUthe“command“Îverbatiminput{xx.yy}“²has“the“same“e ect“asŽ©‘\ª®Î\begin{verbatim}Ž¡‘\ª®¸hÐContentsŽ’Š»®ofŽ’–>ƒtheŽ’¦œZ leŽ’¶¸Æó&ßêŸ'EŽ‘ãxX‘ü2Ÿÿó  b> cmmi10µ"ŽŽ‘.5 ²došGes“not“o er“a“go˜o˜d“in¸ãterface“to“pro-ޤ ‘Rgrammers.‘ÕIn–˾conš¸ãtrast,‘éXthis“pac˜k‘ÿqÇage“pro˜vides“a“simple“mec˜hanism“to“implemen˜tŽ¡‘Rsimilar–!Îfeatures,‘,the“Îcomment“²en•¸ãvironmen“t›!Îimplemen“ted˜here˜bGeing˜an˜example˜ofŽ¡‘Rwhat–UUcan“bGe“done“and“ho¸ãw.ŽŸüY‘Ró(ÂÖN  cmbx12Ó2.1Ž‘pÀSimple‘€examplesŽŸuT‘R²It–Ä_is“noš¸ãw“pGossible“to“use“the“Îverbatim“²en˜vironmen˜t“to“de ne“en˜vironmen˜ts“of“y˜ourŽ¡‘Ro¸ãwn.‘qÇE.g.,Ž©÷W‘V¹–Ë\newenvironment{myverbatim}%ޤ ‘`,Â{\endgraf\noindent‘¹–MYVERBATIM:%Ž¡‘dæX\endgraf\verbatim}%Ž¡‘`,Â{\endverbatim}ŽŸ÷W‘R²can–UUbGe“used“afterwš¸ãards“lik˜e“the“Îverbatim“²en˜vironmen˜t,“i.e.ަ‘RË\begin‘¹–{myverbatim}Ž¡‘[s,testŽ¡‘[s,testŽ¡‘R\end‘¹–{myverbatim}ŽŸ÷W‘R²Another›UUw•¸ãa“y˜to˜use˜it˜is˜to˜writeަ‘RË\let\foo=\commentŽ¡‘R\let\endfoo=\endcommentŽŸ÷W‘R²and–³hfrom“that“pGoinš¸ãt“on“en˜vironmen˜t“Îfoo“²is“the“same“as“the“commen˜t“en˜vironmen˜t,ޤ ‘Ri.e.–UUev¸ãerything“inside“its“b•Go“dy–UUis“ignored.Ž¡‘aY‘ÿ*ªou–#maš¸ãy“also“add“spGecial“commands“after“the“Î\verbatim“²macro“is“in˜v˜ok˜ed,Ž¡‘Re.g.ަ‘RË\newenvironment{myverbatim}%ޤ ‘[s,{\verbatim\myspecialverbatimsetup}%Ž¡‘[s,{\endverbatim}ޤ÷W‘R²though–yš¸ãou“ma˜y“w˜an˜t“to“learn“abšGout“the“ho˜ok“Î\every@verbatim“²at“this“p˜oin¸ãt.Ž© ‘RHo•¸ãw“ev“er,–UUthere“are“still“a“n•¸ãum“bGer–UUof“restrictions:Ž¡‘^8ä1.ŽŽŽ‘kY‘ÿ*ªou–‹Qm¸ãust“not“use“the“Î\begin“²orthe“Î\end“²command“inside“a“de nition,‘˜Ðe.g.ަ‘kthe–UUfolloš¸ãwing“t˜w˜o“examples“will“Ðnot‘H-²w˜ork:ŽŸõ-‘kË\newenvironment{myverbatim}%ޤ ‘k{\endgraf\noindent MYVERBATIM:%Ž¡‘k \endgraf\begin{verbatim}}%Ž¡‘k{\end{verbatim}}Ž¡‘k\newenvironment{fred}Ž¡‘k{\begin{minipage}{30mm}\verbatim}Ž¡‘k{\endverbatim\end{minipage}}ŽŽŽŒ‹® y ý£‘RÒV‘ÿ*ªerbatim–UUst¸ãyle“option’þê²4ŽŽ ? ýä‘kIf–@Âyš¸ãou“try“these“examples,‘xT‘þU>Ÿ'EŽ‘ãxX“will“repGort“a“\runa˜w˜a˜y“argumen˜t"“error.‘—Moreޤ ‘kgenerally‘ÿ*ª,‘ "it–rÔis“not“pGossible“to“use“Î\begin².–ªª.“.“Î\end–rÔ²or“the“related“en•¸ãvironmen“tsŽ¡‘kin–EZthe“de nition“of“the“new“en•¸ãvironmen“t.‘lsInstead,‘HŒthe–EZcorrect“w•¸ãa“y–EZto“de neŽ¡‘kthis›UUen•¸ãvironmen“t˜w“ould˜bGeŽ©‘kË\newenvironment{fred}ޤ ‘k{\minipage{30mm}\verbatim}Ž¡‘k{\endverbatim\endminipage}ŽŸ‘^8ä²2.ŽŽŽ‘kY‘ÿ*ªou–õ€canÐnot‘èX²use“the“Îverbatim“²en•¸ãvironmen“t–õ€inside“user“de ned“Ðc‘ÿ}'ommands‘Ò!²;ŽŸ ‘ke.g.,ަ‘kË\newcommand{\verbatimfile}[1]%Ž¡‘k {\begin{verbatim}\input{#1}\end{verbatim}}ޤ‘k²došGes–UUÐnot‘H-²w¸ãork;“nor“do˜esަ‘kË\newcommand{\verbatimfile}[1]{\verbatim\input{#1}\endverbatim}Ž¡‘^8ä²3.ŽŽŽ‘kThe–{name“of“the“newly“de ned“en•¸ãvironmen“t›{m“ust˜not˜con“tain˜c“haractersޤ ‘kwith–ȵcategory“coGde“other“than“11“(letter)“or“12“(other),‘%or“this“will“notŽ¡‘kw¸ãork.ŽŸþ6‘RÓ2.2Ž‘pÀThe‘€in terfacesŽŸuT‘R²Let–‡nus“start“with“the“simple“things.‘-%Sometimes“it“ma¸ãy“bšGe“necessary“to“use“a“sp˜ecialŽ¡‘Rtš¸ãypGeface–šúfor“y˜our“v˜erbatim“text,‘À@or“pšGerhaps“the“usual“computer“mo˜dern“t¸ãyp˜ewriterŽ¡‘RshapGe–UUin“a“reduced“size.Ž¡‘aY‘ÿ*ªou–˜žmaš¸ãy“select“this“b˜y“rede ning“the“macro“Î\verbatim@font².‘;£This“macro“isŽ¡‘Rexecuted–*at“the“bGeginning“of“evš¸ãery“v˜erbatim“text“to“select“the“fon˜t“shapGe.‘c`Do“notŽ¡‘Ruse– it“for“other“purpGoses;‘Å}if“yš¸ãou“ nd“y˜ourself“abusing“this“y˜ou“ma˜y“w˜an˜t“to“readŽ¡‘RabšGout–UUthe“Î\every@verbatim“²ho˜ok“b˜elo¸ãw.Ž¡‘aBy–“default,‘¢…Î\verbatim@font“²switcš¸ãhes“to“the“t˜ypGewriter“fon˜t“and“disables“theŽ¡‘Rligatures–UUcon¸ãtained“therein.Ž¡‘aThere–Ðis“a“hoGok“(i.e.“a“tokš¸ãen“register)“called“Î\every@verbatim“²whose“con˜ten˜tsŽ¡‘Rare–b‰inserted“inš¸ãto“T‘þU>Ÿ'EŽ‘ãxX's“mouth“just“bGefore“ev˜ery“v˜erbatim“text.‘™cPlease“use“theŽ¡‘RÎ\addto@hook–UU²macro“to“add“something“to“this“hoGok.‘qÇIt“is“used“as“follo¸ãws:ޤ‘\ª®Î\addto@hook¸hÐnameŽ‘»³ofŽ‘*>ˆtheŽ‘:œ_ho‘ÿ}'ok‘¸iŽ‘Rÿ‰Î{¸hÐc‘ÿ}'ommandsŽ‘4µútoŽ‘@z:b‘ÿ}'eŽ‘Läadde‘ÿ}'d‘‰¸iŽ‘iôzÎ}Ž¡‘a²After–jall“spGeci c“setup,‘Gïlikš¸ãe“switc˜hing“of“category“cošGdes,‘Gïhas“b˜een“done,‘Gïtheޤ ‘RÎ\verbatim@start–Ðj²macro“is“called.‘ãThis“starts“the“main“loGop“of“the“scanningŽ¡‘Rmec•¸ãhanism›UÞimplemen“ted˜here.‘sbAn“y˜other˜en“vironmen“t˜that˜w“an“ts˜to˜mak“e˜use˜ofŽ¡‘Rthis–UUfeature“should“execute“this“macro“as“its“last“action.Ž¡‘aThese–x_are“the“things“that“concern“the“start“of“a“vš¸ãerbatim“en˜vironmen˜t.‘ÚäOnceŽ¡‘Rthis–Õ(and“other)“setup“has“bšGeen“done,‘î­the“co˜de“in“this“pac¸ãk‘ÿqÇage“reads“and“pro˜cessesŽ¡‘Rcš¸ãharacters–UUfrom“the“input“stream“in“the“follo˜wing“w˜a˜y:ŽŽŽŒ‹ y ý£‘RÒV‘ÿ*ªerbatim–UUst¸ãyle“option’þê²5ŽŽ ? ýä‘^8ä1.ŽŽŽ‘kBefore–© the“ rst“c¸ãharacter“of“an“input“line“is“read,‘ýùit“executes“the“macroޤ ‘kÎ\verbatim@startline².Ž©‘^8ä2.ŽŽŽ‘kAfter–™some“cš¸ãharacters“ha˜v˜e“bGeen“read,‘©êthe“macro“Î\verbatim@addtoline“²isŽ¡‘kcalled–JOwith“these“cš¸ãharacters“as“its“only“argumen˜t.‘nThis“ma˜y“happGen“sev˜eralŽ¡‘ktimes–UUpGer“line“(when“an“Î\end“²command“is“presen¸ãt“on“the“line“in“question).ަ‘^8ä3.ŽŽŽ‘kWhen–Zæthe“end“of“the“line“is“reac¸ãhed,‘œJthe“macro“Î\verbatim@processlineŽ¡‘k²is–iäcalled“to“proGcess“the“cš¸ãharacters“that“Î\verbatim@addtoline“²has“accum˜u-Ž¡‘klated.ަ‘^8ä4.ŽŽŽ‘kFinally‘ÿ*ª,‘Vìthere–Všis“the“macro“Î\verbatim@finish“²that“is“called“just“bGefore“theŽ¡‘ken•¸ãvironmen“t–UUis“ended“b¸ãy“a“call“to“the“Î\end“²macro.ަ‘aT‘ÿ*ªo–ææmakš¸ãe“this“clear“let“us“consider“the“standard“Îverbatim“²en˜vironmen˜t.‘LøIn“thisŽ¡‘Rcase–UUthe“three“macros“abGo•¸ãv“e–UUare“de ned“as“follo¸ãws:ަ‘^8ä1.ŽŽŽ‘kÎ\verbatim@startline–UU²clears“the“cš¸ãharacter“bu er“(a“tok˜en“register).ަ‘^8ä2.ŽŽŽ‘kÎ\verbatim@addtoline–UU²adds“its“argumenš¸ãt“to“the“c˜haracter“bu er.ަ‘^8ä3.ŽŽŽ‘kÎ\verbatim@processline–²tš¸ãypGesets“the“c˜haracters“accum˜ulated“in“the“bu er.ަ‘RWith–Ûïthis“it“is“vš¸ãery“simple“to“implemen˜t“the“Îcomment“²en˜vironmen˜t:‘~úin“this“caseŽ¡‘RÎ\verbatim@startline–D²and“Î\verbatim@processline“²are“de ned“to“bGe“no-opsŽ¡‘Rwhereas–UUÎ\verbatim@addtoline“²discards“its“argumen¸ãt.Ž¡‘aLet's–ºuse“this“to“de ne“a“v‘ÿqÇarianš¸ãt“of“the“Îverbatim“²en˜vironmen˜t“that“prin˜tsŽ¡‘Rline›ýn•¸ãum“bGers˜in˜the˜left˜margin.‘­ÀAssume˜that˜this˜w“ould˜bGe˜done˜b“y˜a˜coun“terŽ¡‘Rcalled–øäÎVerbatimLineNo².‘\tAssuming“that“this“counš¸ãter“w˜as“initialized“propGerly“b˜yŽ¡‘Rthe›UUen•¸ãvironmen“t,˜Î\verbatim@processline˜²w“ould˜bGe˜de ned˜in˜this˜case˜asŽŸ‘RË\def\verbatim@processline{%ޤ ‘[s,\addtocounter{VerbatimLineNo}{1}%Ž¡‘[s,\leavevmodeŽ¡‘[s,\llap{\theVerbatimLineNo\‘¹–\hskip\@totalleftmargin}%Ž¡‘[s,\the\verbatim@line\par}ަ‘a²A‘¸Ëfurther–¸äpGossibilitš¸ãy“is“to“de ne“a“v‘ÿqÇarian˜t“of“the“Îverbatim“²en˜vironmen˜t“thatޤ ‘RbGoš¸ãxes–È and“cen˜ters“the“whole“v˜erbatim“text.‘ÉìNote“that“the“bGo˜xed“text“should“bGeŽ¡‘Rless–UUthan“a“page“otherwise“yš¸ãou“ha˜v˜e“to“c˜hange“this“example.ŽŸ‘RË\def\verbatimboxed#1{\begingroupޤ ‘[s,\def\verbatim@processline{%Ž¡‘dæX{\setbox0=\hbox{\the\verbatim@line}%Ž¡‘iŸî\hsize=\wd0Ž¡‘iŸî\the\verbatim@line\par}}%Ž¡‘[s,\setbox0=\vbox{\parskip=0pt\topsep=0pt\partopsep=0ptŽ¡’¢Rö\verbatiminput{#1}}%Ž¡‘[s,\begin{center}\fbox{\box0}\end{center}%Ž¡‘V¹–\endgroup}ŽŽŽŒ‹(ò y ý£‘RÒV‘ÿ*ªerbatim–UUst¸ãyle“option’þê²6ŽŽ ? ýä‘aAs–ºÐa“ nal“nonš¸ãtrivial“example“w˜e“describGe“the“de nition“of“an“en˜vironmen˜tޤ ‘Rcalled–MfÎverbatimwrite².‘o"It“writes“all“text“in“its“b•Go“dy–Mfto“a“ le“whose“name“is“giv¸ãenŽ¡‘Ras–w@an“argumenš¸ãt.‘׈W‘ÿ*ªe“assume“that“a“stream“n˜um˜bGer“called“Î\verbatim@out“²hasŽ¡‘Ralready–UUbGeen“reservš¸ãed“b˜y“means“of“the“Î\newwrite“²macro.Ž¡‘aLet's–UUbGegin“with“the“de nition“of“the“macro“Î\verbatimwrite².Ž©‘RË\def\verbatimwrite#1{%ŽŸ‘R²First–zwš¸ãe“call“Î\@bsphack“²so“that“this“en˜vironmen˜t“doGes“not“in uence“the“spacing.Ž¡‘RThen–UUw¸ãe“opšGen“the“ le“and“set“the“category“co˜des“of“all“sp˜ecial“c¸ãharacters:ަ‘[s,Ë\@bsphackޤ ‘[s,\immediate\openout–¹–\verbatim@out“#1Ž¡‘[s,\let\do\@makeother\dospecialsŽ¡‘[s,\catcode`\^^M\activeŽŸ‘R²The–UUdefault“de nitions“of“the“macrosަ‘[s,Ë\verbatim@startlineŽ¡‘[s,\verbatim@addtolineŽ¡‘[s,\verbatim@finishŽŸ‘R²are–šalso“used“in“this“en•¸ãvironmen“t.‘#—Only–šthe“macro“Î\verbatim@processline“²hasŽŸ ‘Rto–UUbšGe“c¸ãhanged“b˜efore“Î\verbatim@start“²is“called:ަ‘[s,Ë\def\verbatim@processline{%Ž¡‘dæX\immediate\write\verbatim@out{\the\verbatim@line}}%Ž¡‘[s,\verbatim@start}ŽŸ‘R²The–ö»de nition“of“Î\endverbatimwrite“²is“vš¸ãery“simple:‘Bzw˜e“close“the“stream“and“callޤ ‘RÎ\@esphack–UU²to“get“the“spacing“righ¸ãt.ަ‘RË\def\endverbatimwrite{\immediate\closeout\verbatim@out\@esphack}ŽŸ!Ä‘RÍ3Ž‘jLËThe‘ffimplemenŒÌtationŽŸç‘R²The–ˆ‡vš¸ãery“ rst“thing“w˜e“do“is“to“ensure“that“this“ le“is“not“read“in“t˜wice.‘ \T‘ÿ*ªo“thisŽ¡‘Rend–d¹wš¸ãe“c˜hec˜k“whether“the“macro“Î\verbatim@@@“²is“de ned.‘ŸôIf“so,‘¨’w˜e“just“stopŽ¡‘Rreading–Ûthis“ le.‘\žThe“`pacš¸ãk‘ÿqÇage'“guard“here“allo˜ws“most“of“the“cošGde“to“b˜e“excludedŽ¡‘Rwhen–UUextracting“the“drivš¸ãer“ le“for“testing“this“pac˜k‘ÿqÇage.ŽŸ‘Uüs±1Ž‘\ª®ó©±Ê cmsy9Êhó)ÒoÇw cmss9Ôpack¾9ageŽ‘#g Êiޤ ‘Uüs±2Ž‘\ª®Ë\NeedsTeXFormat{LaTeX2e}Ž¡‘Uüs±3Ž‘\ª®Ë\ProvidesPackage{verbatim}Ž¡‘Uüs±4Ž‘tJœË[1997/04/30–¹–v1.5k“LaTeX2e“package“for“verbatim“enhancements]Ž¡‘Uüs±5Ž‘\ª®Ë\@ifundefined{verbatim@@@}{}{\endinput}ŽŸ‘a²W‘ÿ*ªe–ùˆuse“a“mecš¸ãhanism“similar“to“the“one“implemen˜ted“for“the“Î\comment².–ªª.“.ޤ ‘RÎ\endcomment–=E²macro“in“¸A‘þŸžqMŽ‘QS‘¿ü²-T‘þU>Ÿ'EŽ‘ãxXŽ‘0û”:‘A§W‘ÿ*ªe“input“one“line“at“a“time“and“c•¸ãhec“k–=Eif“itŽ¡‘Rconš¸ãtains– ìthe“Î\end{...}“²tok˜ens.‘YOThen“w˜e“can“decide“whether“w˜e“ha˜v˜e“reac˜hed“theŽ¡‘Rend–UUof“the“vš¸ãerbatim“text,“or“m˜ust“con˜tin˜ue.ŽŽŽŒ‹3÷ y ý£‘RÒV‘ÿ*ªerbatim–UUst¸ãyle“option’þê²7ŽŽ ? ýä‘RÓ3.1Ž‘pÀPreliminariesŽŸuT‘f Ë\every@verbatimŽŽŽ‘R²The–UUhoGok“(i.e.“tok¸ãen“register)“Î\every@verbatim“²is“initialized“to“¸hÐempty‘â}¸iŽ‘&õ².ޤ ü‘Uüs±6Ž‘\ª®Ë\newtoks\every@verbatimŽŸ ‘Uüs±7Ž‘\ª®Ë\every@verbatim={}Ž©ôD‘Lø\@makeotherŽŽŽ‘RÎ\@makeother–›Ú²takš¸ães“as“argumen˜t“a“c˜haracter“and“c˜hanges“its“category“coGde“to“12ŽŸ ‘R(other).Ž¡‘Uüs±8Ž‘\ª®Ë\def\@makeother#1{\catcode`#112\relax}ަ‘ ÙÌ\@vobeyspacesŽŽŽ‘R²The–¥¿macro“Î\@vobeyspaces“²causes“spaces“in“the“input“to“bGe“prin¸ãted“as“spaces“inŽŸ ‘Rthe‘UUoutput.Ž¡‘Uüs±9Ž‘\ª®Ë\begingroupޤ ‘R±10Ž‘adDË\catcode`\‘¹–=\active%Ž¡‘R±11Ž‘adDË\def\x{\def\@vobeyspaces{\catcode`\–¹–\active\let“\@xobeysp}}Ž¡‘R±12Ž‘adDË\expandafter\endgroup\xަ‘À$\@xobeyspŽŽŽ‘R²The–œ÷macro“Î\@xobeysp“²proGduces“exactly“one“space“in“the“output,‘Á×protected“againstޤ ‘Rbreaking–UUjust“bšGefore“it.‘qÇ(Î\@M“²is“an“abbreviation“for“the“n•¸ãum“b˜er‘UU10000.)ŽŸ ü‘R±13Ž‘\ª®Ë\def\@xobeysp{\leavevmode\penalty\@M\‘¹–}ަ‘ 6\verbatim@lineŽŽŽ‘R²W‘ÿ*ªe–õuse“a“newly“de ned“tok¸ãen“register“called“Î\verbatim@line“²that“will“bGe“used“asŽ¡‘Rthe–UUc¸ãharacter“bu er.ŽŸ ü‘R±14Ž‘\ª®Ë\newtoks\verbatim@lineަ‘a²The–•Rfolloš¸ãwing“four“macros“are“de ned“globally“in“a“w˜a˜y“suitable“for“theŽ¡‘RÎverbatim–UU²and“Îverbatim*“²en•¸ãvironmen“ts.ŽŸø.‘î€HË\verbatim@startlineŽŽ¡‘î€H\verbatim@addtolineŽŽŽŽ¡¡‘å \verbatim@processlineŽŽŽŽŽ‘RÎ\verbatim@startline–ëx²initializes“proGcessing“of“a“line“bš¸ãy“empt˜ying“the“c˜haracterŽ¡‘Rbu er‘UU(Î\verbatim@line²).Ž© ü‘R±15Ž‘\ª®Ë\def\verbatim@startline{\verbatim@line{}}ŽŸü‘RÎ\verbatim@addtoline–6²adds“the“tokš¸ãens“in“its“argumen˜t“to“our“bu er“registerŽ¡‘RÎ\verbatim@line–UU²without“expanding“them.ަ‘R±16Ž‘\ª®Ë\def\verbatim@addtoline#1{%ŽŸ ‘R±17Ž‘fÚË\verbatim@line\expandafter{\the\verbatim@line#1}}ŽŸü‘R²ProGcessing–ca“line“inside“a“Îverbatim“²or“Îverbatim*“²en•¸ãvironmen“t–cmeans“prin¸ãtingŽ¡‘Rit.‘?=Ending–™Òthe“line“means“that“wš¸ãe“ha˜v˜e“to“bGegin“a“new“paragraph.‘?=W‘ÿ*ªe“use“Î\parŽ¡‘R²for–1Pthis“purpGose.‘¸Note“that“Î\par“²is“rede ned“in“Î\@verbatim“²to“force“T‘þU>Ÿ'EŽ‘ãxX“in¸ãtoŽ¡‘Rhorizonš¸ãtal–¢moGde“and“to“insert“an“empt˜y“bGo˜x“so“that“empt˜y“lines“in“the“input“doŽ¡‘RappGear–UUin“the“output.ަ‘R±18Ž‘\ª®Ë\def\verbatim@processline{\the\verbatim@line\par}ŽŸôD‘ü­ \verbatim@finishŽŽŽ‘R²As–´'a“default,‘ËÜÎ\verbatim@finish“²proGcesses“the“remaining“c¸ãharacters.‘Ž>When“thisŽ¡‘Rmacro–èäis“called“wš¸ãe“are“facing“the“follo˜wing“problem:‘˜æwhen“the“Î\end{verbatim}Ž¡‘R²command–ëyis“encounš¸ãtered“Î\verbatim@processline“²is“called“to“proGcess“the“c˜har-Ž¡‘Racters–Z“preceding“the“command“on“the“same“line.‘If“there“are“none,‘[ãan“empt¸ãy“lineŽ¡‘Rwš¸ãould–UUbGe“output“if“w˜e“did“not“c˜hec˜k“for“this“case.ŽŽŽŒ‹>w y ý£‘RÒV‘ÿ*ªerbatim–UUst¸ãyle“option’þê²8ŽŽ ? ýä‘aIf–<>the“line“is“emptš¸ãy“Î\the\verbatim@line“²expands“to“nothing.‘ijT‘ÿ*ªo“test“this“w˜eޤ ‘Ruse–ä½a“tric¸ãk“similar“to“that“on“p.“376“of“the“T‘þU>Ÿ'EŽ‘ãxXb•Go“ok,‘ûBbut–ä½with“Î$².–ªª.“.“Î$–ä½²instead“of“theŽ¡‘RÎ!–ôf²tokš¸ãens.‘QxThese“Î$“²tok˜ens“can“nev˜er“ha˜v˜e“the“same“category“coGde“as“a“Î$“²tok˜en“thatŽ¡‘Rmigh¸ãt–³pšGossibly“app˜ear“in“the“tokš¸ãen“register“Î\verbatim@line²,‘*mas“suc˜h“a“tok˜en“willŽ¡‘Ralw•¸ãa“ys›dha“v“e˜b•Geen˜read˜with˜category˜co“de˜12˜(other).‘ôNote˜that˜Î\ifcat˜²expandsŽ¡‘Rthe–ñfolloš¸ãwing“tok˜ens“so“that“Î\the\verbatim@line“²is“replaced“b˜y“the“accum˜ulatedŽ¡‘Rc¸ãharactersŽ©‘R±19Ž‘\ª®Ë\def\verbatim@finish{\ifcat$\the\verbatim@line$\elseŽŸ ‘R±20Ž‘fÚË\verbatim@processline\fi}ŽŸþ6‘RÓ3.2Ž‘pÀThe–€Æverbatim“Óand“Æverbatim*“Óen• vironmen“tsŽŸuT‘ 6Ë\verbatim@fontŽŽŽ‘R²W‘ÿ*ªe–b‹start“bš¸ãy“de ning“the“macro“Î\verbatim@font“²that“is“to“select“the“fon˜t“and“toŽ¡‘Rset›å³fon•¸ãt-depGenden“t˜parameters.‘"âThen˜w“e˜go˜through˜Î\verbatim@nolig@list˜²toŽ¡‘Ra•¸ãv“oid–ècertain“ligatures.‘4£Î\verbatim@nolig@list“²is“a“macro“de ned“in“the“LŸýó5‘üff±AŽŽ‘͉²T‘þU>Ÿ'EŽ‘ãxX‘ü2Ÿÿµ"ŽŽŽ¡‘R²k¸ãernel–UUto“expand“toŽŸ‘dæXË\do\`\do\<\do\>\do\,\do\'\do\-ŽŸ‘R²All–UUthe“cš¸ãharacters“in“this“list“can“bGe“part“of“a“ligature“in“some“fon˜t“or“other.ަ‘R±21Ž‘\ª®Ë\def\verbatim@font{\normalfont\ttfamilyޤ ‘R±22Ž’¶pÐË\let\do\do@noligsŽ¡‘R±23Ž’¶pÐË\verbatim@nolig@list}ŽŸ‘Ž\@verbatimŽŽŽ‘R²The–VDmacro“Î\@verbatim“²sets“up“things“propGerly‘ÿ*ª.‘t“First“of“all,‘–the“tok¸ãens“of“theޤ ‘RÎ\every@verbatim–mD²hoGok“are“inserted.‘¹•Then“a“Îtrivlist“²en•¸ãvironmen“t–mDis“startedŽ¡‘Rand–ÓPits“ rst“Î\item“²command“inserted.‘ë¸Eac¸ãh“line“of“the“Îverbatim“²or“Îverbatim*Ž¡‘R²en•¸ãvironmen“t–UUwill“bGe“treated“as“a“separate“paragraph.ަ‘R±24Ž‘\ª®Ë\def\@verbatim{\the\every@verbatimŽŸ ‘R±25Ž‘fÚË\trivlist–¹–\item“\relaxŽŸ‘R²The–eúfolloš¸ãwing“extra“v˜ertical“space“is“for“compatibilit˜y“with“the“LŸýó5‘üff±AŽŽ‘͉²T‘þU>Ÿ'EŽ‘ãxXk˜ernel:‘“oth-Ž¡‘Rerwise,‘Vìusing–#hthe“Îverbatim“²pacš¸ãk‘ÿqÇage“c˜hanges“the“v˜ertical“spacing“of“a“ÎverbatimŽ¡‘R²en•¸ãvironmen“t–UUnested“within“a“Îquote“²en•¸ãvironmen“t.ަ‘R±26Ž‘fÚË\if@minipage\else\vskip\parskip\fiŽŸ‘R²The–Z§paragraph“parameters“are“set“appropriately:‘|jthe“pšGenalt¸ãy“at“the“b˜eginning“ofŽ¡‘Rthe›7en•¸ãvironmen“t,‘o}left˜and˜righ“t˜margins,‘o}paragraph˜inden“tation,‘o}the˜glue˜to˜ llŽ¡‘Rthe–‚last“line,‘Gand“the“vš¸ãertical“space“bGet˜w˜een“paragraphs.‘ø The“latter“space“has“toŽ¡‘RbGe–UUzero“since“wš¸ãe“do“not“w˜an˜t“to“add“extra“space“bGet˜w˜een“lines.ަ‘R±27Ž‘fÚË\@beginparpenalty‘¹–\predisplaypenaltyޤ ‘R±28Ž‘fÚË\leftskip\@totalleftmargin\rightskip\z@Ž¡‘R±29Ž‘fÚË\parindent\z@\parfillskip\@flushglue\parskip\z@ŽŸ‘R²There's–šone“pGoinš¸ãt“to“mak˜e“here:‘èRthe“Îlist“²en˜vironmen˜t“uses“T‘þU>Ÿ'EŽ‘ãxX's“Î\parshapeޤ ‘R²primitivš¸ãe–Gto“get“a“spGecial“inden˜tation“for“the“ rst“line“of“the“list.‘^ÃIf“the“list“bGeginsŽ¡‘Rwith–MÐa“Îverbatim“²en•¸ãvironmen“t–MÐthis“Î\parshape“²is“still“in“e ect.‘oETherefore“wš¸ãe“ha˜v˜eŽ¡‘Rto–tœreset“this“inš¸ãternal“parameter“explicitly–ÿ*ª.‘ÏW“e–tœcould“do“this“b˜y“assigning“0“toŽ¡‘RÎ\parshape².‘h›Ho•¸ãw“ev“er,‘¼-there–§œis“a“simpler“w•¸ãa“y–§œto“ac•¸ãhiev“e›§œthis:‘Tw“e˜simply˜tell˜T‘þU>Ÿ'EŽ‘ãxXŽŽŽŒ‹ Jr y ý£‘RÒV‘ÿ*ªerbatim–UUst¸ãyle“option’þê²9ŽŽ ? ýä‘Rto–­Œstart“a“new“paragraph.‘zlAs“is“explained“on“p.“103“of“the“T‘þU>Ÿ'EŽ‘ãxXb•Go“ok,‘Úthis‘­Œresetsޤ ‘RÎ\parshape–UU²to“zero.Ž©‘R±30Ž‘fÚË\@@parŽŸ‘R²W‘ÿ*ªe–dænoš¸ãw“ensure“that“Î\par“²has“the“correct“de nition,‘¨Énamely“to“force“T‘þU>Ÿ'EŽ‘ãxX“in˜toŽ¡‘Rhorizonš¸ãtal–чmoGde“and“to“include“an“empt˜y“bGo˜x.‘æ^This“is“to“ensure“that“empt˜yŽ¡‘Rlines–ªdo“appGear“in“the“output.‘pAfterw•¸ãards,‘ÿHw“e–ªinsert“the“Î\interlinepenaltyŽ¡‘R²since–=uT‘þU>Ÿ'EŽ‘ãxX“došGes“not“add“a“p˜enalt¸ãy“b˜et•¸ãw“een–=uparagraphs“(here:‘Blines)“bš¸ãy“its“o˜wnŽ¡‘Rinitiativš¸ãe.‘±ÅOtherwise–jªa“Îverbatim“²en˜vironmen˜t“could“bGe“brok˜en“across“pages“ev˜enŽ¡‘Rif–UUa“Î\samepage“²declaration“wš¸ãere“presen˜t.Ž¡‘aHo•¸ãw“ev“er,›Þin–êa“top-aligned“minipage,˜this“will“result“in“an“extra“empt¸ãy“lineŽ¡‘Radded–½úat“the“top.‘«µTherefore,‘Ø#a“sligh¸ãtly“more“complicated“construct“is“necessary‘ÿ*ª.Ž¡‘ROne–yeof“the“impGortan¸ãt“things“here“is“the“inclusion“of“Î\leavevmode“²as“the“ rst“macroŽ¡‘Rin–!the“ rst“line,›+„for“example,˜a“blank“v¸ãerbatim“line“is“the“ rst“thing“in“a“list“item.ަ‘R±31Ž‘fÚË\def\par{%ޤ ‘R±32Ž‘o‘Ë\if@tempswaŽ¡‘R±33Ž‘y2Ë\leavevmode\null\@@par\penalty\interlinepenaltyŽ¡‘R±34Ž‘o‘Ë\elseŽ¡‘R±35Ž‘y2Ë\@tempswatrueŽ¡‘R±36Ž‘y2Ë\ifhmode\@@par\penalty\interlinepenalty\fiŽ¡‘R±37Ž‘o‘Ë\fi}%ޤ‘R²But–î‹to“a•¸ãv“oid–î‹an“error“message“when“the“en•¸ãvironmen“t–î‹doGesn't“conš¸ãtain“an˜y“text,‘w˜eŽŸ ‘Rrede ne–UUÎ\@noitemerr“²whicš¸ãh“will“in“this“case“bGe“called“b˜y“Î\endtrivlist².ަ‘R±38Ž‘fÚË\def\@noitemerr{\@warning{No–¹–verbatim“text}}%Ž¡‘R²No•¸ãw›UUw“e˜call˜Î\obeylines˜²to˜mak“e˜the˜end˜of˜line˜c“haracter˜activ“e,ަ‘R±39Ž‘fÚË\obeylinesŽ¡‘R²c¸ãhange–UUthe“category“cošGde“of“all“sp˜ecial“c¸ãharacters,“to“12“(other).ަ‘R±40Ž‘fÚË\let\do\@makeother‘¹–\dospecialsŽ¡‘R²and–UUswitcš¸ãh“to“the“fon˜t“to“bGe“used.ަ‘R±41Ž‘fÚË\verbatim@fontŽ¡‘R²T‘ÿ*ªo›ã a•¸ãv“oid˜a˜breakpGoin“t˜after˜the˜lab•Gels˜b“o•¸ãx,‘yw“e˜remo“v“e˜the˜pGenalt“y˜put˜there˜b“yޤ ‘Rthe–UUlist“macros:‘qÇanother“use“of“Î\unpenalty²!ަ‘R±42Ž‘fÚË\everypar–¹–\expandafter{\the\everypar“\unpenalty}}ŽŸ‘À$\verbatimŽŽ¡‘Ž\verbatim*ŽŽŽŽŽ‘R²No•¸ãw›°@w“e˜de ne˜the˜toplev“el˜macros.‘‚‰Î\verbatim˜²is˜sligh“tly˜c“hanged:‘'žafter˜settingŽ¡‘Rup–UUthings“propGerly“it“calls“Î\verbatim@start².ަ‘R±43Ž‘\ª®Ë\def\verbatim{\@verbatim‘¹–\frenchspacing\@vobeyspaces\verbatim@start}ŽŸ‘RÎ\verbatim*–UU²is“de ned“accordingly‘ÿ*ª.ަ‘R±44Ž‘\ª®Ë\@namedef{verbatim*}{\@verbatim\verbatim@start}ŽŸ‘“b\endverbatimŽŽ¡‘ ÙÌ\endverbatim*ŽŽŽŽŽ‘R²T‘ÿ*ªo–Èåend“the“Îverbatim“²and“Îverbatim*“²en•¸ãvironmen“ts–Èåit“is“only“necessary“to“ nishŽ¡‘Rthe–UUÎtrivlist“²en•¸ãvironmen“t–UUstarted“in“Î\@verbatim².ަ‘R±45Ž‘\ª®Ë\let\endverbatim=\endtrivlistŽŸ ‘R±46Ž‘\ª®Ë\expandafter\let\csname–¹–endverbatim*\endcsname“=\endtrivlistŽŽŽŒ‹ X² y ý£‘RÒV‘ÿ*ªerbatim–UUst¸ãyle“option’ùꜲ10ŽŽ ? ýä‘RÓ3.3Ž‘pÀThe–€Æcomment“Óen• vironmen“tŽŸuT‘"yºË\commentŽŽŸ ‘Lø\endcommentŽŽŽŽŽ‘R²The–¤ïÎ\comment“²macro“is“similar“to“Î\verbatim*².‘6ûHo•¸ãw“ev“er,‘È6w“e–¤ïdo“not“need“to“switc¸ãhޤ ‘Rfonš¸ãts–‡or“set“spGecial“formatting“parameters“suc˜h“as“Î\parindent“²or“Î\parskip².‘#W‘ÿ*ªeŽ¡‘Rneed–konly“set“the“category“cošGde“of“all“sp˜ecial“c¸ãharacters“to“12“(other)“and“thatŽ¡‘Rof–ÄšÎ^^M‘Ä}²(the“end“of“line“cš¸ãharacter)“to“13“(activ˜e).‘¿•The“latter“is“needed“for“macroŽ¡‘Rparameter–Òdelimiter“matcš¸ãhing“in“the“in˜ternal“macros“de ned“bGelo˜w.‘F0In“con˜trast“toŽ¡‘Rthe–Ÿ'EŽ‘ãxX“that“Î\²,–ãûÎ{²,“and–ÇtÎ}“²are“the“lo˜w˜ercase“v˜ersions“of“Î!²,–ãûÎ[²,“and–ÇtÎ]².‘È#Then“w˜eŽ¡‘Rreplace–#ev¸ãery“ošGccurrence“of“Î\²,–AWÎ{²,“and–#Î}“²that“should“b˜e“read“with“category“co˜deŽ¡‘R12–¬rbš¸ãy“Î!²,–Â9Î[²,“and‘¬rÎ]²,“respGectiv˜ely‘ÿ*ª,“and–¬rgiv˜e“the“whole“list“of“tok˜ens“to“Î\lowercase²,Ž¡‘Rknoš¸ãwing–UUthat“category“coGdes“are“not“altered“b˜y“this“primitiv˜e!Ž¡‘aBut–#§ rst“wš¸ãe“ha˜v˜e“ensure“that“Î!²,–-—Î[²,“and–#§Î]“²themselv˜es“ha˜v˜e“the“correct“categoryŽ¡‘RcošGde!‘wT‘ÿ*ªo–¬oallo¸ãw“sp˜ecial“settings“of“these“co˜des“w¸ãe“hide“their“setting“in“the“macroŽ¡‘RÎ\vrb@catcodes².‘qÇIf–UUit“is“already“de ned“our“new“de nition“is“skippGed.ަ‘R±55Ž‘\ª®Ë\@ifundefined{vrb@catcodes}%ޤ ‘R±56Ž‘fÚË{\def\vrb@catcodes{%Ž¡‘R±57Ž‘tJœË\catcode`\!12\catcode`\[12\catcode`\]12}}{}ŽŸ‘R²This–§ëtricš¸ãk“allo˜ws“us“to“use“this“cošGde“for“applications“where“other“category“co˜desޤ ‘Rare–UUin“e ect.Ž¡‘aW‘ÿ*ªe–UUstart“a“group“to“kš¸ãeep“the“category“coGde“c˜hanges“loGcal.ަ‘R±58Ž‘\ª®Ë\begingroupޤ ‘R±59Ž‘adDË\vrb@catcodesŽ¡‘R±60Ž‘adDË\lccode`\!=`\\–¹–\lccode`\[=`\{“\lccode`\]=`\}ŽŽŽŒ‹ e  y ý£‘RÒV‘ÿ*ªerbatim–UUst¸ãyle“option’ùꜲ11ŽŽ ? ýä‘RW‘ÿ*ªe–[÷also“need“the“end-of-line“cš¸ãharacter“Î^^M²,“as“an“activ˜e“c˜haracter.‘…­If“w˜e“w˜ereޤ ‘Rto–°_simply“write“Î\catcode`\^^M=\active“²then“wš¸ãe“w˜ould“get“an“un˜w˜an˜ted“activ˜eŽ¡‘Rend–ï¼of“line“cš¸ãharacter“at“the“end“of“ev˜ery“line“of“the“follo˜wing“macro“de nitions.Ž¡‘RTherefore–¶awš¸ãe“use“the“same“tric˜k“as“abGo˜v˜e:‘3àw˜e“write“a“tilde“Î~“²instead“of“Î^^M‘¶H²andŽ¡‘Rpretend–ýSthat“the“latter“is“the“lo•¸ãw“ercase›ýSv‘ÿqÇarian“t˜of˜the˜former.‘iÁTh“us˜w“e˜ha“v“e˜toŽ¡‘Rensure–UUnoš¸ãw“that“the“tilde“c˜haracter“has“category“coGde“13“(activ˜e).Ž©‘R±61Ž‘adDË\catcode`\~=\active‘¹–\lccode`\~=`\^^MŽŸ‘R²The–>tuse“of“the“Î\lowercase“²primitivš¸ãe“leads“to“one“problem:‘æVthe“uppGercase“c˜haracterŽ¡‘R`ÎC²'‘>;needs–>Ato“bšGe“used“in“the“co˜de“b˜eloš¸ãw“and“its“case“m˜ust“bGe“preserv˜ed.‘jSo“w˜e“addŽ¡‘Rthe‘UUcommand:ަ‘R±62Ž‘adDË\lccode`\C=`\CŽŸ‘R²No•¸ãw›F£w“e˜start˜the˜tok“en˜list˜passed˜to˜Î\lowercase².‘E±W‘ÿ*ªe˜use˜the˜follo“wing˜littleŽ¡‘Rtricš¸ãk–ˆÿ(propGosed“b˜y“Bernd“Raic˜hle):‘ÙThe“v˜ery“ rst“tok˜en“in“the“tok˜en“list“w˜e“giv˜eŽ¡‘Rto–‚æÎ\lowercase“²is“the“Î\endgroup“²primitivš¸ãe.‘+£This“means“that“it“is“proGcessed“b˜y“T‘þU>Ÿ'EŽ‘ãxXŽ¡‘Rimmediately–íDafter“Î\lowercase“²has“ nished“its“opGeration,‘?th¸ãus“ending“the“groupŽ¡‘Rstarted–UUbš¸ãy“Î\begingroup“²abGo˜v˜e.‘qÇThis“a˜v˜oids“the“global“de nition“of“all“macros.ަ‘R±63Ž‘adDË\lowercase{\endgroupŽŸ‘f \verbatim@startŽŽŽ‘R²The– purpGose“of“Î\verbatim@start“²is“to“c•¸ãhec“k– whether“there“are“anš¸ãy“c˜haracters“onŽ¡‘Rthe–—_same“line“as“the“Î\begin{verbatim}“²and“to“pretend“that“they“w¸ãere“on“a“lineŽ¡‘Rb•¸ãy›æthemselv“es.‘È{On˜the˜other˜hand,‘NËif˜there˜are˜no˜c“haracters˜remaining˜on˜theŽ¡‘Rcurrenš¸ãt–§‰line“w˜e“shall“just“ nd“an“end“of“line“c˜haracter.‘7ÙÎ\verbatim@start“²pGerformsŽ¡‘Rits–Äétask“bš¸ãy“ rst“grabbing“the“follo˜wing“c˜haracter“(its“argumen˜t).‘À‚This“argumen˜tŽ¡‘Ris–UUthen“compared“to“an“activš¸ãe“Î^^M²,“the“end“of“line“c˜haracter.ަ‘R±64Ž‘o‘Ë\def\verbatim@start#1{%ޤ ‘R±65Ž‘y2Ë\verbatim@startlineŽ¡‘R±66Ž‘y2Ë\if\noexpand#1\noexpand~%ޤ‘R²If–V—this“is“true“wš¸ãe“transfer“con˜trol“to“Î\verbatim@“²to“proGcess“the“next“line.‘uŒW‘ÿ*ªe“useŽŸ ‘RÎ\next–UU²as“the“macro“whicš¸ãh“will“con˜tin˜ue“the“w˜ork.ަ‘R±67Ž’‚w^Ë\let\next\verbatim@Ž¡‘R²Otherwise,‘i»wš¸ãe–2tde ne“Î\next“²to“expand“to“a“call“to“Î\verbatim@“²follo˜w˜ed“b˜y“theޤ ‘Rcš¸ãharacter–ãþjust“read“so“that“it“is“reinserted“in˜to“the“text.‘ÁThis“means“that“thoseŽ¡‘Rcš¸ãharacters–O¼remaining“on“this“line“are“handled“as“if“they“formed“a“line“b˜y“themselv˜es.ަ‘R±68Ž‘y2Ë\else‘¹–\def\next{\verbatim@#1}\fiŽŸ‘R²Finally–UUw¸ãe“call“Î\next².ަ‘R±69Ž‘y2Ë\next}%ŽŸ‘Ž\verbatim@ŽŽŽ‘R²The–:èthree“macros“Î\verbatim@²,–@1Î\verbatim@@²,“and–:èÎ\verbatim@@@“²form“the“\mainŽ¡‘RlošGop"–™»of“the“Îverbatim“²en•¸ãvironmen“t.‘3?The–™»purp˜ose“of“Î\verbatim@“²is“to“read“exactlyŽ¡‘Rone–¾ëline“of“input.‘®‰Î\verbatim@@“²and“Î\verbatim@@@“²w¸ãork“together“to“ nd“outŽ¡‘Rwhether–ê¨the“four“c¸ãharacters“Î\end“²(all“with“category“cošGde“12“(other))“o˜ccur“in“thatŽ¡‘Rline.‘mIf–þiso,‘(®Î\verbatim@@@“²will“call“Î\verbatim@test“²to“c•¸ãhec“k–þiwhether“this“Î\endŽ¡‘R²is–Q‚part“of“Î\end{verbatim}“²and“will“terminate“the“en•¸ãvironmen“t–Q‚if“this“is“the“case.ŽŽŽŒ‹ rE y ý£‘RÒV‘ÿ*ªerbatim–UUst¸ãyle“option’ùꜲ12ŽŽ ? ýä‘ROtherwise–Äwš¸ãe“con˜tin˜ue“as“if“nothing“had“happGened.‘³So“let's“ha˜v˜e“a“loGok“at“theޤ ‘Rde nition–UUof“Î\verbatim@²:Ž© à ‘R±70Ž‘o‘Ë\def\verbatim@#1~{\verbatim@@#1!end\@nil}%ŽŸà ‘R²Note–Ùthat“the“Î!“²cš¸ãharacter“will“ha˜v˜e“bGeen“replaced“b˜y“a“Î\“²with“category“coGde“12Ž¡‘R(other)–«õbš¸ãy“the“Î\lowercase“²primitiv˜e“go˜v˜erning“this“cošGde“b˜efore“the“de nition“ofŽ¡‘Rthis–Ä7macro“actually“takš¸ães“place.‘AhThat“means“that“it“tak˜es“the“line,‘á=puts“Î\end“²(fourŽ¡‘Rc•¸ãharacter›æÈtok“ens)˜and˜Î\@nil˜²(one˜con“trol˜sequence˜tok“en)˜as˜a˜delimiter˜bGehindŽ¡‘Rit,–UUand“then“calls“Î\verbatim@@².ŽŸI%‘LøË\verbatim@@ŽŽŽ‘RÎ\verbatim@@–+P²takš¸ães“ev˜erything“up“to“the“next“oGccurrence“of“the“four“c˜haractersŽ¡‘RÎ\end–UU²as“its“argumen¸ãt.ަ‘R±71Ž‘o‘Ë\def\verbatim@@#1!end{%ŽŸà ‘R²That–%0means:‘}if“they“do“not“oGccur“in“the“original“line,‘Y&then“argumen¸ãt“Î#1“²is“theŽ¡‘Rwhole– input“line,‘5ùand“Î\@nil“²is“the“next“tok¸ãen“to“bšGe“pro˜cessed.‘ŒëHo•¸ãw“ev“er,‘5ùif‘ theŽ¡‘Rfour–¯gcš¸ãharacters“Î\end“²are“part“of“the“original“line,‘Зthen“Î#1“²consists“of“the“c˜haractersŽ¡‘Rin–rØfronš¸ãt“of“Î\end²,‘z8and“the“next“tok˜en“is“the“follo˜wing“c˜haracter“(alw˜a˜ys“remem˜bGerŽ¡‘Rthat–L©the“line“wš¸ãas“lengthened“b˜y“ v˜e“tok˜ens).‘nãWhatev˜er“Î#1“²ma˜y“bGe,‘Neit“is“v˜erbatimŽ¡‘Rtext,–UUso“Î#1“²is“added“to“the“line“curren¸ãtly“built.ަ‘R±72Ž‘}½ÈË\verbatim@addtoline{#1}%ŽŸà ‘R²The–²>next“tokš¸ãen“in“the“input“stream“is“of“spGecial“in˜terest“to“us.‘ ˆ‚ThereforeŽ¡‘RÎ\futurelet–UU²de nes“Î\next“²to“bšGe“equal“to“it“b˜efore“calling“Î\verbatim@@@².ަ‘R±73Ž‘}½ÈË\futurelet\next\verbatim@@@}%ŽŸI%‘“b\verbatim@@@ŽŽŽ‘RÎ\verbatim@@@–wײwill“noš¸ãw“read“the“rest“of“the“tok˜ens“on“the“curren˜t“line,‘€xup“to“theŽ¡‘R nal–UUÎ\@nil“²tok¸ãen.ަ‘R±74Ž‘o‘Ë\def\verbatim@@@#1\@nil{%ŽŸà ‘R²If–­íthe“ rst“of“the“abGo•¸ãv“e›­ít“w“o˜cases˜oGccurred,‘Äi.e.˜no˜Î\end˜²c“haracters˜w“ere˜on˜thatŽ¡‘Rline,–UUÎ#1“²is“emptš¸ãy“and“Î\next“²is“equal“to“Î\@nil².‘qÇThis“is“easily“c˜hec˜k˜ed.ަ‘R±75Ž‘}½ÈË\ifx\next\@nilŽŸà ‘R²If–'so,‘Êthis“wš¸ãas“a“simple“line.‘V W‘ÿ*ªe“ nish“it“b˜y“proGcessing“the“line“w˜e“accum˜ulated“soŽ¡‘Rfar.‘qÇThen–UUw¸ãe“prepare“to“read“the“next“line.ަ‘R±76Ž’‡0ôË\verbatim@processlineޤ ‘R±77Ž’‡0ôË\verbatim@startlineŽ¡‘R±78Ž’‡0ôË\let\next\verbatim@ޤà ‘R²Otherwise–UUwš¸ãe“ha˜v˜e“to“c˜hec˜k“what“follo˜ws“these“Î\end“²tok˜ens.ަ‘R±79Ž‘}½ÈË\elseŽ¡‘R²Before–ÛHwš¸ãe“con˜tin˜ue,‘ó±it's“a“go•Go“d–ÛHidea“to“stop“for“a“momen˜t“and“remem˜bGer“where“w˜eޤ ‘Rare:‘þkW‘ÿ*ªe›nœha•¸ãv“e˜just˜read˜the˜four˜c“haracter˜tok“ens˜Î\end˜²and˜m“ust˜no“w˜c“hec“k˜whetherŽ¡‘Rthe–Š]name“of“the“en•¸ãvironmen“t–Š](surrounded“bš¸ãy“braces)“follo˜ws.‘. T‘ÿ*ªo“this“end“w˜e“de neŽ¡‘Ra–€‹macro“called“Î\@tempa“²that“reads“exactly“one“c¸ãharacter“and“decides“what“to“doŽ¡‘Rnext.‘fÂThis–4Dmacro“should“do“the“folloš¸ãwing:‘a?skip“spaces“un˜til“it“encoun˜ters“either“aŽ¡‘Rleft–Çnbrace“or“the“end“of“the“line.‘BzBut“it“is“impGortanš¸ãt“to“remem˜bGer“whic˜h“c˜haractersŽ¡‘Rare–{7skippGed.‘ãnThe“Î\end¸hÐoptionalŽ‘*a‘sp–ÿ}'ac“es‘Ò!¸iŽ‘I«Î{“²cš¸ãharacters“ma˜y“bGe“part“of“the“v˜erbatimŽ¡‘Rtext,–UUi.e.“these“cš¸ãharacters“m˜ust“bGe“prin˜ted.ŽŽŽŒ‹ €R y ý£‘RÒV‘ÿ*ªerbatim–UUst¸ãyle“option’ùꜲ13ŽŽ ? ýä‘aAssume–UUfor“example“that“the“currenš¸ãt“line“con˜tainsŽŸ‘RË \end {AVeryLongEnvironmentName}ŽŸ‘R²As–2Rwš¸ãe“shall“soGon“see,‘9Sthe“scanning“mec˜hanism“implemen˜ted“here“will“not“ nd“outޤ ‘Rthat–¾this“is“text“to“bGe“prinš¸ãted“un˜til“it“has“read“the“righ˜t“brace.‘^êTherefore“w˜e“needŽ¡‘Ra›âˆw•¸ãa“y˜to˜accum“ulate˜the˜c“haracters˜read˜so˜that˜w“e˜can˜reinsert˜them˜if˜necessary‘ÿ*ª.Ž¡‘RThe–UUtok¸ãen“register“Î\@temptokena“²is“used“for“this“purpGose.Ž¡‘aBefore–wš¸ãe“do“this“w˜e“ha˜v˜e“to“get“rid“of“the“supGer uous“Î\end“²tok˜ens“at“the“endŽ¡‘Rof–ïýthe“line.‘OÿT‘ÿ*ªo“this“end“wš¸ãe“de ne“a“tempGorary“macro“whose“argumen˜t“is“delimitedŽ¡‘Rbš¸ãy–xKÎ\end\@nil“²(four“c˜haracter“tok˜ens“and“one“con˜trol“sequence“tok˜en)“to“bGe“usedŽ¡‘RbšGelo¸ãw–Åon“the“rest“of“the“line,‘$after“app˜ending“a“Î\@nil“²tok¸ãen“to“it.‘]B(Note“that“thisŽ¡‘Rtokš¸ãen–dãcan“nev˜er“appGear“in“Î#1².)‘ pW‘ÿ*ªe“use“the“follo˜wing“de nition“of“Î\@tempa“²to“getŽ¡‘Rthe–UUrest“of“the“line“(after“the“ rst“Î\end²).Ž© À‚‘R±80Ž’‡0ôË\def\@tempa##1!end\@nil{##1}%ŽŸÀ‚‘R²W‘ÿ*ªe–*menš¸ãtioned“already“that“w˜e“use“tok˜en“register“Î\@temptokena“²to“remem˜bGer“theŽ¡‘Rc•¸ãharacters›øw“e˜skip,‘ž in˜case˜w“e˜need˜them˜again.‘!¯W‘ÿ*ªe˜initialize˜this˜with˜the˜Î\endŽ¡‘R²w•¸ãe›UUha“v“e˜thro“wn˜a“w“a“y˜in˜the˜call˜to˜Î\@tempa².ަ‘R±81Ž’‡0ôË\@temptokena{!end}%ŽŸÀ‚‘R²W‘ÿ*ªe–lœshall“noš¸ãw“call“Î\verbatim@test“²to“proGcess“the“c˜haracters“remaining“on“theŽ¡‘Rcurrenš¸ãt–®6line.‘|kBut“w˜ait“a“momen˜t:‘#Šw˜e“cannot“simply“call“this“macro“since“w˜eŽ¡‘Rha•¸ãv“e–¤already“read“the“whole“line.‘»µTherefore“wš¸ãe“ha˜v˜e“to“ rst“expand“the“macroŽ¡‘RÎ\@tempa–›`²to“insert“them“again“after“the“Î\verbatim@test“²tokš¸ãen.‘CèA–›NÎ^^M“²c˜haracterŽ¡‘Ris–‚ÕappšGended“to“denote“the“end“of“the“line.‘úH(Remem¸ãb˜er“that“this“c¸ãharacter“comesŽ¡‘Rdisguised–UUas“a“tilde.)ަ‘R±82Ž’‡0ôË\def\next{\expandafter\verbatim@test\@tempa#1\@nil~}%ޤÀ‚‘R²That's–UUalmost“all,“but“wš¸ãe“still“ha˜v˜e“to“no˜w“call“Î\next“²to“do“the“w˜ork.ަ‘R±83Ž‘}½ÈË\fi‘¹–\next}%ŽŸA†‘ 6\verbatim@testŽŽŽ‘R²W‘ÿ*ªe–UUde ne“Î\verbatim@test“²to“in•¸ãv“estigate›UUev“ery˜tok“en˜in˜turn.ަ‘R±84Ž‘o‘Ë\def\verbatim@test#1{%Ž¡‘R²First–ä•of“all“wš¸ãe“set“Î\next“²equal“to“Î\verbatim@test“²in“case“this“macro“m˜ust“callŽŸ ‘Ritself–UUrecursiv¸ãely“in“order“to“skip“spaces.ަ‘R±85Ž’¤ Ë\let\next\verbatim@testŽ¡‘R²W‘ÿ*ªe›UUha•¸ãv“e˜to˜distinguish˜four˜cases:ŽŸ‘^8ä1.ŽŽŽ‘kThe–ºnext“tokš¸ãen“is“a“Î^^M²,“i.e.“w˜e“reac˜hed“the“end“of“the“line.‘£öThat“meansޤ ‘kthat–»ínothing“spGecial“wš¸ãas“found.‘¥Note“that“w˜e“use“Î\if“²for“the“follo˜wingŽ¡‘kcomparisons–UUso“that“the“category“coGde“of“the“cš¸ãharacters“is“irrelev‘ÿqÇan˜t.ŽŸ‘R±86Ž’©¤"Ë\if\noexpand#1\noexpand~%ŽŸ‘k²W‘ÿ*ªe–­ƒadd“the“cš¸ãharacters“accum˜ulated“in“tok˜en“register“Î\@temptokena“²to“theŽ¡‘kcurrenš¸ãt–VÄline.‘vSince“Î\verbatim@addtoline“²doGes“not“expand“its“argumen˜t,Ž¡‘kw•¸ãe›qha“v“e˜to˜do˜the˜expansion˜at˜this˜pGoin“t.‘sThen˜w“e˜Î\let˜\next˜²equal˜toŽ¡‘kÎ\verbatim@–UU²to“prepare“to“read“the“next“line.ŽŽŽŒ‹Ž y ý£‘RÒV‘ÿ*ªerbatim–UUst¸ãyle“option’ùꜲ14ŽŽ ? ýä‘R±87Ž’³NË\expandafter\verbatim@addtolineޤ ‘R±88Ž’¼ŠzË\expandafter{\the\@temptokena}%Ž¡‘R±89Ž’³NË\verbatim@processlineŽ¡‘R±90Ž’³NË\verbatim@startlineŽ¡‘R±91Ž’³NË\let\next\verbatim@Ž©‘^8ä²2.ŽŽŽ‘kA‘ùÜspace–úcš¸ãharacter“follo˜ws.‘_ÜThis“is“allo˜w˜ed,‘#3so“w˜e“add“it“to“Î\@temptokenaŽŸ ‘k²and‘UUcon•¸ãtin“ue.ŽŸ‘R±92Ž’©¤"Ë\else‘¹–\if\noexpand#1Ž¡‘R±93Ž’³NË\@temptokena\expandafter{\the\@temptokena#1}%ަ‘^8ä²3.ŽŽŽ‘kAn–oopGen“brace“folloš¸ãws.‘¿This“is“the“most“in˜teresting“case.‘¿W‘ÿ*ªe“m˜ust“no˜wޤ ‘kcollect–>²cš¸ãharacters“un˜til“w˜e“read“the“closing“brace“and“c˜hec˜k“whether“theyŽ¡‘kform–ÇÄthe“en•¸ãvironmen“t–ÇÄname.‘ÉThis“will“bGe“done“b¸ãy“Î\verbatim@testend²,Ž¡‘kso–EÆhere“wš¸ãe“let“Î\next“²equal“this“macro.‘CAgain“w˜e“will“proGcess“the“rest“ofŽ¡‘kthe–7Dline,‘oÀcš¸ãharacter“b˜y“c˜haracter.‘•The“c˜haracters“forming“the“name“of“theŽ¡‘ken•¸ãvironmen“t–,pwill“bGe“accum¸ãulated“in“Î\@tempc².‘÷W‘ÿ*ªe“initialize“this“macro“toŽ¡‘kexpand–UUto“nothing.ŽŸ‘R±94Ž’©¤"Ë\else‘¹–\if\noexpand#1\noexpand[%ޤ ‘R±95Ž’³NË\let\@tempc\@emptyŽ¡‘R±96Ž’³NË\let\next\verbatim@testendŽŸ‘k²Note–UUthat“the“Î[“²c¸ãharacter“will“bGe“a“Î{“²when“this“macro“is“de ned.ަ‘^8ä4.ŽŽŽ‘kAnš¸ãy–háother“c˜haracter“means“that“the“Î\end“²w˜as“part“of“the“v˜erbatim“text.ޤ ‘kAdd–the“cš¸ãharacters“to“the“curren˜t“line“and“prepare“to“call“Î\verbatim@“²toŽ¡‘kproGcess–UUthe“rest“of“the“line.ŽŸ‘R±97Ž’©¤"Ë\elseޤ ‘R±98Ž’³NË\expandafter\verbatim@addtolineŽ¡‘R±99Ž’¼ŠzË\expandafter{\the\@temptokena}%Ž¡‘N±100Ž’³NË\def\next{\verbatim@#1}%Ž¡‘N±101Ž’©¤"Ë\fi\fi\fiަ‘R²The–UUlast“thing“this“macro“došGes“is“to“call“Î\next“²to“con•¸ãtin“ue‘UUpro˜cessing.Ž©‘N±102Ž’¤ Ë\next}%ŽŸ‘÷ót\verbatim@testendŽŽŽ‘RÎ\verbatim@testend–ÔÙ²is“called“when“Î\end¸hÐoptionalŽ‘)»3sp–ÿ}'ac“es‘Ò!¸iŽ‘I¿Î{“²w¸ãas“seen.‘FóIts“task“is“toޤ ‘Rscan–›Kev¸ãerything“up“to“the“next“Î}“²and“to“call“Î\verbatim@@testend².‘3ÄIf“no“Î}“²is“foundŽ¡‘Rit–¹emš¸ãust“reinsert“the“c˜haracters“it“read“and“return“to“Î\verbatim@².‘øThe“follo˜wingŽ¡‘Rde nition–Õâis“similar“to“that“of“Î\verbatim@test²:‘ráit“takš¸ães“the“next“c˜haracter“andŽ¡‘Rdecides–UUwhat“to“do.ަ‘N±103Ž‘o‘Ë\def\verbatim@testend#1{%ŽŸ‘R²Again,–UUwš¸ãe“ha˜v˜e“four“cases:ŽŸ‘^8ä1.ŽŽŽ‘kÎ^^M²:–¨àAs“no“Î}“²is“found“in“the“currenš¸ãt“line,‘Ë^add“the“c˜haracters“to“the“bu er.‘8KT‘ÿ*ªoŽ¡‘ka•¸ãv“oid–æ;a“complicated“construction“for“expanding“Î\@temptokena“²and“Î\@tempcŽŽŽŒ‹›6 y ý£‘RÒV‘ÿ*ªerbatim–UUst¸ãyle“option’ùꜲ15ŽŽ ? ýä‘kwš¸ãe–.do“it“in“t˜w˜o“steps.‘ºQThen“w˜e“con˜tin˜ue“with“Î\verbatim@“²to“proGcess“theŽŸ ‘knext‘UUline.Ž©‘N±104Ž’ 0öË\if\noexpand#1\noexpand~%ޤ ‘N±105Ž’©¤"Ë\expandafter\verbatim@addtolineŽ¡‘N±106Ž’³NË\expandafter{\the\@temptokena[}%Ž¡‘N±107Ž’©¤"Ë\expandafter\verbatim@addtolineŽ¡‘N±108Ž’³NË\expandafter{\@tempc}%Ž¡‘N±109Ž’©¤"Ë\verbatim@processlineŽ¡‘N±110Ž’©¤"Ë\verbatim@startlineŽ¡‘N±111Ž’©¤"Ë\let\next\verbatim@ŽŸ‘^8ä²2.ŽŽŽ‘kÎ}²:‘<žCall–ëÎ\verbatim@@testend“²to“c•¸ãhec“k–ëif“this“is“the“righš¸ãt“en˜vironmen˜t“name.ަ‘N±112Ž’ 0öË\else\if\noexpand#1\noexpand]%Ž¡‘N±113Ž’©¤"Ë\let\next\verbatim@@testendŽŸ‘^8ä²3.ŽŽŽ‘kÎ\²:‘§This–}Åcš¸ãharacter“m˜ust“not“oGccur“in“the“name“of“an“en˜vironmen˜t.‘ëTh˜us“w˜eޤ ‘kstop–šûcollecting“cš¸ãharacters.‘B¸In“principle,‘¬dthe“same“argumen˜t“w˜ould“apply“toŽ¡‘kother–Ìöcš¸ãharacters“as“w˜ell,–êÞe.g.,“Î{².‘Ø«Ho˜w˜ev˜er,“Î\–Ìö²is“a“spGecial“case,‘êÞsince“it“ma˜yŽ¡‘kbGe–ò©the“ rst“cš¸ãharacter“of“Î\end².‘IÃThis“means“that“w˜e“ha˜v˜e“to“loGok“again“forŽ¡‘kÎ\end{¸hÐenvir‘ÿ}'onmentŽ‘=îóname‘À[¸iŽ‘Z¬Î}².‘m×Note–þ°that“wš¸ãe“pre xed“the“Î!“²b˜y“a“Î\noexpandŽ¡‘k²primitivš¸ãe,–UUto“protect“ourselv˜es“against“it“bGeing“an“activ˜e“c˜haracter.ަ‘N±114Ž’ 0öË\else\if\noexpand#1\noexpand!%ޤ ‘N±115Ž’©¤"Ë\expandafter\verbatim@addtolineŽ¡‘N±116Ž’³NË\expandafter{\the\@temptokena[}%Ž¡‘N±117Ž’©¤"Ë\expandafter\verbatim@addtolineŽ¡‘N±118Ž’³NË\expandafter{\@tempc}%Ž¡‘N±119Ž’©¤"Ë\def\next{\verbatim@!}%ŽŸ‘^8ä²4.ŽŽŽ‘kAnš¸ãy–òÝother“c˜haracter:‘@‹collect“it“and“con˜tin˜ue.‘PõW‘ÿ*ªe“cannot“use“Î\edef“²to“de neŽŸ ‘kÎ\@tempc–UU²since“its“replacemenš¸ãt“text“migh˜t“con˜tain“activ˜e“c˜haracter“tok˜ens.ަ‘N±120Ž’ 0öË\else‘¹–\expandafter\def\expandafter\@tempc\expandafterŽ¡‘N±121Ž’©¤"Ë{\@tempc#1}\fi\fi\fiŽŸ‘R²As–«bGefore,›$Íthe“macro“ends“b¸ãy“calling“itself,˜to“proGcess“the“next“c¸ãharacter“if“appro-ޤ ‘Rpriate.Ž©‘N±122Ž’‡0ôË\next}%ŽŸ‘ó9Þ\verbatim@@testendŽŽŽ‘R²Unlikš¸ãe–«Üthe“previous“macros“Î\verbatim@@testend“²is“simple:‘Õit“has“only“to“c˜hec˜kŽ¡‘Rif–UUthe“Î\end{².–ªª.“.“Î}–UU²matc¸ãhes“the“correspGonding“Î\begin{².–ªª.“.“Î}².ަ‘N±123Ž‘o‘Ë\def\verbatim@@testend{%ŽŸ‘R²W‘ÿ*ªe–Kuse“Î\next“²again“to“de ne“the“things“that“are“to“bšGe“done.‘TnRemem¸ãb˜er“thatŽ¡‘Rthe–ÄÊname“of“the“currenš¸ãt“en˜vironmen˜t“is“held“in“Î\@currenvir²,‘à§the“c˜haracters“ac-Ž¡‘Rcum•¸ãulated›¸çb“y˜Î\verbatim@testend˜²are˜in˜Î\@tempc².‘œ~So˜w“e˜simply˜compare˜theseŽ¡‘Rand–Ð[prepare“to“execute“Î\end{¸hÐcurr‘ÿ}'entŽ‘&"Èenvir‘ÿ}'onment‘òظiŽ‘aãÎ}“²macro“if“they“matc¸ãh.‘EtBeforeŽ¡‘Rwš¸ãe–߯do“this“w˜e“call“Î\verbatim@finish“²to“proGcess“the“last“line.‘W‘ÿ*ªe“de ne“Î\nextŽŽŽŒ‹¦ y ý£‘RÒV‘ÿ*ªerbatim–UUst¸ãyle“option’ùꜲ16ŽŽ ? ýä‘Rvia–Ç Î\edef“²so“that“Î\@currenvir“²is“replaced“bš¸ãy“its“expansion.‘ȧTherefore“w˜e“needŽ© ‘RÎ\noexpand–UU²to“inhibit“the“expansion“of“Î\end“²at“this“pGoin¸ãt.ŽŸ‘N±124Ž‘}½ÈË\ifx\@tempc\@currenvirޤ ‘N±125Ž’‡0ôË\verbatim@finishŽ¡‘N±126Ž’‡0ôË\edef\next{\noexpand\end{\@currenvir}%ޤ‘R²Without–^this“tricš¸ãk“the“Î\end“²command“w˜ould“not“bGe“able“to“correctly“c˜hec˜k“whetherަ‘Rits–éxargumenš¸ãt“matc˜hes“the“name“of“the“curren˜t“en˜vironmen˜t“and“y˜ou'd“get“anަ‘Rinš¸ãteresting–UULŸýó5‘üff±AŽŽ‘͉²T‘þU>Ÿ'EŽ‘ãxX“error“message“suc˜h“as:ŽŸ‘RË!–¹–\begin{verbatim*}“ended“by“\end{verbatim*}.ŽŸ‘R²But–Õ what“do“wš¸ãe“do“with“the“rest“of“the“c˜haracters,‘î¶those“that“remain“on“that“line?ަ‘RW‘ÿ*ªe–.hcall“Î\verbatim@rescan“²to“takš¸ãe“care“of“that.‘dÍIts“ rst“argumen˜t“is“the“name“ofަ‘Rthe›ëen•¸ãvironmen“t˜just˜ended,‘‚in˜case˜w“e˜need˜it˜again.‘3Î\verbatim@rescan˜²tak“esަ‘Rthe–æÝlist“of“c¸ãharacters“to“bšGe“repro˜cessed“as“its“second“argumenš¸ãt.‘&`(This“tok˜en“listަ‘Rwš¸ãas–ª«inserted“after“the“curren˜t“macro“b˜y“Î\verbatim@@@².)‘qÉSince“w˜e“are“still“in“anަ‘RÎ\edef–UU²wš¸ãe“protect“it“b˜y“means“ofÎ\noexpand².ŽŸ‘N±127Ž’»*fË\noexpand\verbatim@rescan{\@currenvir}}%Ž¡‘R²If–3°the“names“do“not“matc•¸ãh,‘:kw“e–3°reinsert“evš¸ãerything“read“up“to“no˜w“and“prepare“toަ‘Rcall–UUÎ\verbatim@“²to“proGcess“the“rest“of“the“line.Ž©‘N±128Ž‘}½ÈË\elseޤ ‘N±129Ž’‡0ôË\expandafter\verbatim@addtolineŽ¡‘N±130Ž’¤ Ë\expandafter{\the\@temptokena[}%Ž¡‘N±131Ž’¤ Ë\expandafter\verbatim@addtolineŽ¡‘N±132Ž’šLË\expandafter{\@tempc]}%Ž¡‘N±133Ž’‡0ôË\let\next\verbatim@Ž¡‘N±134Ž‘}½ÈË\fiŽŸ‘R²Finally–UUw¸ãe“call“Î\next².ަ‘N±135Ž‘}½ÈË\next}%ŽŸ‘ü­ \verbatim@rescanŽŽŽ‘R²In–Ù›principle“Î\verbatim@rescan“²could“bGe“used“to“analyse“the“c¸ãharacters“remain-ޤ ‘Ring–after“the“Î\end{...}“²command“and“pretend“that“these“w¸ãere“read“\propGerly",Ž¡‘Rassuming–*V\standard"“category“cošGdes“are“in“force.Ÿü^ÿ±1ŽŽ‘ßå²But“this“is“not“alw•¸ãa“ys‘*Vp˜ossibleŽ¡‘R(when–ÿÆthere“are“unmatcš¸ãhed“curly“braces“in“the“rest“of“the“line).‘UBBesides,‘âw˜e“thinkŽ¡‘Rthat–UWthis“is“not“wš¸ãorth“the“e ort:‘qËAfter“a“Îverbatim“²or“Îverbatim*“²en˜vironmen˜tŽ¡‘Ra–Ñ—new“line“in“the“output“is“bšGegun“an•¸ãyw“a“y‘ÿ*ª,‘ð¨and–Ñ—an“Î\end{comment}“²can“easily“b˜eŽ¡‘Rput–¦êon“a“line“bš¸ãy“itself.‘f‡So“there“is“no“reason“wh˜y“there“should“bGe“an˜y“text“here.Ž¡‘RF‘ÿ*ªor–#òthe“bšGene t“of“the“user“who“did“put“something“there“(a“commen¸ãt,‘W™p˜erhaps)Ž¡‘Rwš¸ãe–30simply“issue“a“w˜arning“and“drop“them.‘ YThe“methoGd“of“testing“is“explainedŽ¡‘Rin–¦AppšGendix“D,“p.“376“of“the“T‘þU>Ÿ'EŽ‘ãxXb˜o˜ok.‘»W‘ÿ*ªe“use“Î^^M‘w²instead“of“the“Î!“²c¸ãharacterŽ¡‘Rused–"there“since“this“is“a“cš¸ãharacter“that“cannot“appGear“in“Î#1².‘^ The“t˜w˜o“Î\noexpandŽ¡‘R²primitivš¸ães–UUare“necessary“to“a˜v˜oid“expansion“of“activ˜e“c˜haracters“and“macros.Ž¡‘aOne–2žextra“subtletš¸ãy“should“bGe“noted“here:‘`lremem˜bGer“that“the“tok˜en“list“w˜e“areŽ¡‘Rcurren¸ãtly– ïbuilding“will“ rst“bšGe“pro˜cessed“bš¸ãy“the“Î\lowercase“²primitiv˜e“bGefore“T‘þU>Ÿ'EŽ‘ãxXŽ‘RŸ‚‰ffÿrŸ J=‘ "5Ÿý-:Á1ŽŽŽ‘LÜó|{Ycmr8ÀRememšÃŽbŸ'EŽ‘ãxX'sŽ¡‘Rinput‘UUstac¸ãk.Ÿü^ÿ±2ŽŽŽ¦‘N161Ž‘o‘Ë\expandafter\verbatim@read@fileޤ ‘N±162Ž‘fÚË\fiŽ¡‘N±163Ž‘\ª®Ë}ŽŸ,©‘ 6\verbatiminputŽŽŽ‘RÎ\verbatiminput–íç² rst“starts“a“group“to“kš¸ãeep“fon˜t“and“category“c˜hanges“loGcal.ޤ ‘RThen–sRit“calls“the“macro“Î\verbatim@input“²with“additional“argumen¸ãts,‘zÑdepGendingŽ¡‘Ron–UUwhether“an“asterisk“follo¸ãws.ަ‘N±164Ž‘\ª®Ë\def\verbatiminput{\begingroupޤ ‘N±165Ž‘fÚË\@ifstar{\verbatim@input\relax}%Ž¡‘N±166Ž’‹êŠË{\verbatim@input{\frenchspacing\@vobeyspaces}}}ŽŸ,©‘f \verbatim@inputŽŽŽ‘RÎ\verbatim@input–ö² rst“c•¸ãhec“ks–öwhether“the“ le“exists,‘>Ÿusing“the“standard“macroޤ ‘RÎ\IfFileExists–]²whicš¸ãh“lea˜v˜es“the“name“of“the“ le“found“in“Î\@filef@und².‘ÃàThenŽ¡‘Rev¸ãerything–UUis“set“up“as“in“the“Î\verbatim“²macro.ަ‘N±167Ž‘\ª®Ë\def\verbatim@input#1#2{%ŽŸ ‘N±168Ž‘j×pË\IfFileExists–¹–{#2}{\@verbatim“#1\relaxŽŸd8‘R²Then–Ý¿it“reads“in“the“ le,‘Ù nishes“o “the“Îtrivlist“²en•¸ãvironmen“t–Ý¿started“b¸ãyŽ¡‘RÎ\@verbatim–Ó²and“closes“the“group.‘ZœThis“restores“ev¸ãerything“to“its“normal“settings.ަ‘N±169Ž‘o‘Ë\verbatim@readfile{\@filef@und}\endtrivlist\endgroup\@doendpe}%ŽŸd8‘R²If–8vthe“ le“is“not“found“a“more“or“less“helpful“message“is“prin¸ãted.‘ +The“ nalŽ¡‘RÎ\endgroup–UU²is“needed“to“close“the“group“started“in“Î\verbatiminput“²abGo•¸ãv“e.ަ‘N±170Ž‘j×pË{\typeout–¹–{No“file“#2.}\endgroup}}ŽŸ ‘N±171Ž‘\ª®Êhó5ùž" cmmi9É=Ôpack¾9ageŽ‘#g ÊiŽŸx‘RÓ3.6Ž‘pÀGetting–€vš erbatim“text“in˜to“argumen˜ts.ŽŸuT‘R²One›[Vw•¸ãa“y˜of˜ac“hieving˜this˜is˜to˜de ne˜a˜macro˜(command)˜whose˜expansion˜isŽ¡‘Rthe–»írequired“vš¸ãerbatim“text.‘¥ŽThis“command“can“then“bGe“used“an˜ywhere“that“theŽ¡‘Rvš¸ãerbatim–vðtext“is“required.‘Ö™It“can“bGe“used“in“argumen˜ts,‘Wev˜en“mo˜ving“ones,‘Wbut“itŽ¡‘Ris–UUfragile“(at“least,“the“v¸ãersion“here“is).Ž¡‘aHere–Üis“some“coGde“whicš¸ãh“claims“to“pro˜vide“this.‘ZôIt“is“a“m˜uc˜h“revised“v˜ersion“ofŽ¡‘Rsomething–UUI“(Chris)“did“abGout“2“yš¸ãears“ago.‘qÇMa˜ybGe“it“needs“further“revision.Ž¡‘aIt–²is“only“inš¸ãtended“as“an“extension“to“Î\verb²,‘Ò«not“to“the“Îverbatim“²en˜vironmen˜t.Ž¡‘RIt–iìshould“therefore,–™pšGerhaps,“treat–iìline-ends“similarly“to“whatev¸ãer“is“b˜est“for“Î\verb².Ž‘RŸ ž‰ffÿrŸ J=‘ "5Ÿý-:Á2ŽŽŽ‘LÜÀA‘²©standard–²âT‘þ•AŸ¸ãEŽ‘MX“wšÃŽould“rep–¹–Expect“``characters“dropped''Ž¡‘N±252Ž’‡0ôËwarning–¹–messages“in“this“test!“<====}Ž¡‘N±253Ž‘\ª®Ë\typeout{}Ž¡‘N±254ŽŽ¡‘N255Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±256Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±257Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±258Ž‘fÚË\begin{verbatim}Ž¡‘N±259Ž‘o‘ËtestŽ¡‘N±260Ž‘o‘Ë\end{verbatim*}Ž¡‘N±261Ž‘o‘ËtestŽ¡‘N±262Ž‘o‘Ë\end{verbatimŽ¡‘N±263Ž‘o‘Ëtest–¹–of“ligatures:“<`!`?`>Ž¡‘N±264Ž‘o‘Ë\endverbatimŽ¡‘N±265Ž‘o‘ËtestŽ¡‘N±266Ž‘o‘Ë\end‘ s,verbatimŽ¡‘N±267Ž‘o‘ËtestŽ¡‘N±268Ž‘o‘Ëtest–¹–of“end“of“line:Ž¡‘N±269Ž‘o‘Ë\endŽ¡‘N±270Ž‘o‘Ë{verbatim}Ž¡‘N±271Ž‘fÚË\end{verbatim}–¹–Further“text“to“be“typeset:“$\alpha$.Ž¡‘N±272Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±273Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±274Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±275Ž‘fÚË\begin{verbatim*}Ž¡‘N±276Ž‘o‘ËtestŽ¡‘N±277Ž‘o‘ËtestŽ¡‘N±278Ž‘fÚË\end‘¹–{verbatim*}Ž¡‘N±279Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±280Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±281Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±282Ž‘fÚË\begin{verbatim*}‘ s,bla‘¹–blaŽ¡‘N±283Ž‘o‘ËtestŽ¡‘N±284Ž‘o‘ËtestŽ¡‘N±285Ž‘fÚË\end‘¹–{verbatim*}ŽŽŽŒ‹éâ y ý£‘RÒV‘ÿ*ªerbatim–UUst¸ãyle“option’ùꜲ22ŽŽ ? ýä‘N±286Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“Textޤ ‘N±287Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±288Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±289Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±290ŽŽ¡‘N291Ž‘\ª®ËFirst–¹–of“Chris“Rowley's“fiendish“tests:Ž¡‘N±292Ž‘\ª®Ë\begin{verbatim}Ž¡‘N±293Ž‘\ª®Ëthe–¹–double“end“testŽ¡‘N±294Ž‘\ª®Ë\end\end{verbatim}‘ s,or–¹–even“\end“\end{verbatim}Ž¡‘N±295Ž‘\ª®Ë%Ž¡‘N±296Ž‘\ª®Ë%not‘¹–\end\ended??Ž¡‘N±297Ž‘\ª®Ë%\end{verbatim}Ž¡‘N±298ŽŽ¡‘N299Ž‘\ª®ËAnother–¹–of“Chris'“devils:Ž¡‘N±300Ž‘\ª®Ë\begin{verbatim}Ž¡‘N±301Ž‘\ª®Ëthe–¹–single“brace“testŽ¡‘N±302Ž‘\ª®Ë\end{not–¹–the“end\end{verbatim}Ž¡‘N±303Ž‘\ª®Ë%Ž¡‘N±304Ž‘\ª®Ë%not‘¹–\end}ed??Ž¡‘N±305Ž‘\ª®Ë%\end{verbatim}Ž¡‘N±306Ž‘\ª®ËBack–¹–to“my“own“tests:Ž¡‘N±307Ž‘fÚË\begin{myverbatim}Ž¡‘N±308Ž‘o‘ËtestŽ¡‘N±309Ž‘o‘ËtestŽ¡‘N±310Ž‘fÚË\end–¹–{myverbatim}“rest“of“lineŽ¡‘N±311Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±312Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±313Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±314ŽŽ¡‘N315Ž‘\ª®ËTest–¹–of“empty“verbatim:Ž¡‘N±316Ž‘\ª®Ë\begin{verbatim}Ž¡‘N±317Ž‘\ª®Ë\end{verbatim}Ž¡‘N±318Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±319Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±320Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±321Ž‘fÚË\begin‘¹–{verbatimlisting}{verbtest.tex}Ž¡‘N±322Ž‘o‘ËAdditonal–¹–verbatim“textŽ¡‘N±323Ž‘y2Ë...Ž¡‘N±324Ž‘fÚË\end{verbatimlisting}Ž¡‘N±325Ž‘\ª®ËAnd–¹–here“for“listing“a“file:Ž¡‘N±326Ž‘fÚË\verbatiminput{verbtest.tex}Ž¡‘N±327Ž‘\ª®ËAnd–¹–again,“with“explicit“spaces:Ž¡‘N±328Ž‘fÚË\verbatiminput*{verbtest.tex}Ž¡‘N±329Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±330Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±331Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±332Ž‘fÚË\begin{comment}Ž¡‘N±333Ž‘o‘ËtestŽ¡‘N±334Ž‘o‘Ë\end{verbatim*}Ž¡‘N±335Ž‘o‘ËtestŽŽŽŒ‹òˆ y ý£‘RÒV‘ÿ*ªerbatim–UUst¸ãyle“option’ùꜲ23ŽŽ ? ýä‘N±336Ž‘o‘Ë\end‘¹–{commentޤ ‘N±337Ž‘o‘ËtestŽ¡‘N±338Ž‘o‘Ë\endverbatimŽ¡‘N±339Ž‘o‘ËtestŽ¡‘N±340Ž‘o‘Ë\end‘ s,verbatimŽ¡‘N±341Ž‘o‘ËtestŽ¡‘N±342Ž‘fÚË\end–¹–{comment}“Further“text“to“be“typeset:“$\alpha$.Ž¡‘N±343Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±344Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±345Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±346Ž‘fÚË\begin{comment}‘ s,bla‘¹–blaŽ¡‘N±347Ž‘o‘ËtestŽ¡‘N±348Ž‘o‘ËtestŽ¡‘N±349Ž‘fÚË\end‘¹–{comment}Ž¡‘N±350Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±351Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±352Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±353Ž‘\ª®ËText–¹–Text“Text“Text“Text“Text“Text“Text“Text“Text“TextŽ¡‘N±354ŽŽ¡‘N355Ž‘\ª®Ë\begin{verbatimwrite}{verbtest.txt}Ž¡‘N±356Ž‘\ª®Ëasfa cmmi10óKñ`y cmr10óÙ“ Rcmr7ùßßßßßß