Chapter11. Macros
\def\PickTwo#1#2{(#1,#2)}
takestwo argumentsand reproducesthemin parentheses.Thecall\PickTwo 12gives
‘(1,2)’.
Theactivityofsubstitutingthereplacementtextforamacroiscalledmacroexpansion.
11.2 Layoutofamacrodefinition
Amacrodefinitionconsistsof,insequence,
1.
anynumberof\global,\long,and\outerprefixes,
2.
adefcontrolsequence,oranythingthathasbeen\lettoone,
3.
acontrolsequenceoractivecharactertobedefined,
4.
possiblyaparametertextspecifyingamongotherthingshowmanyparameters
themacrohas,and
5.
areplacement textenclosed in explicitcharactertokenswith categorycodes1
and2,bydefault{and}inplainT
E
X.
After amacro definition is completed, any saved \afterassignmenttoken (seesec-
tion12.3.3)isinserted.
The‘expanding’definitions\edefand\xdefaretreatedinChapter12.
11.3 Prefixes
Therearethreeprefixesthatalterthestatusofthemacrodefinition:
\global Ifthedefinitionoccursinsideagroup,thisprefix makesthedefinitionglobal.
Thisprefixcanalsobeusedforassignmentsotherthanmacrodefinitions;infact,
formacrodefinitionsabbreviationsexistobviatingtheuseof\global:
\gdef\foo... isequivalentto \global\def\foo...
and
\xdef\foo... isequivalentto \global\edef\foo...
Iftheparameter\globaldefsispositive,allassignmentsareimplicitlyglobal;
if\globaldefsisnegativeany\globalprefixesareignored,and \gdefand
\xdefmakelocaldefinitions(seeChapter10).
\outer Themechanismof‘outer’macrosissupposedtofacilitatelocating(amongother
errors)unbalancedbraces:an\outermacroissupposedtoappearonlyinnon-
embeddedcontexts.Tobeprecise,itisnotallowedtooccur
in macroreplacement texts(but itcan appearinfor instance\edefafter
\noexpand,andafter\meaning),
inparametertexts,
inskippedconditionaltext,
inalignmentpreambles,and
inthebalancedtextofa\message,\write,etcetera.
110
VictorEijkhout–T
E
XbyTopic
Delete page pdf file - remove PDF pages in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Provides Users with Mature Document Manipulating Function for Deleting PDF Pages
delete pages pdf preview; delete pages from pdf
Delete page pdf file - VB.NET PDF Page Delete Library: remove PDF pages in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
Visual Basic Sample Codes to Delete PDF Document Page in .NET
delete pages pdf files; delete pages of pdf online
11.4. Thedefinitiontype
Forcertainapplications,however,itisinconvenientthatsomeoftheplainmacros
areouter,inparticularmacrossuchas\newskip.Oneremedyistoredefinethem,
withoutthe‘outer’option,whichisdoneforinstanceinLAT
E
X,butcleverertricks
arepossible.
\long Ordinarily,macroparametersarenotsupposedtocontain\partokens.Thisrestric-
tionisuseful (muchmoreso thanthe\outerdefinitions)inlocating forgotten
closingbraces.Forexample,T
E
Xwillcomplainabouta‘runawayargument’ in
thefollowingsequence:
\def\a#1{ ... #1 ... }
\a {This sentence should be in braces.
And this is not supposed to be part of the argument
Theemptylinegeneratesa\par,whichmostofthetimesmeansthataclosing
bracehasbeenforgotten.
Ifargumentstoaparticularmacroshouldbeallowedtocontain\partokens,then
themacromustbedeclaredtobe\long.
The\ifxtestforequalityoftokens(seeChapter13)takesprefixesintoaccountwhen
testingwhethertwotokenshavethesamedefinition.
11.4 Thedefinitiontype
Therearefour def control sequences in T
E
X: \def, \gdef, \edef,and \xdef.The
control sequence \gdefisasynonymfor \global\defand \xdefisa synonym for
\global\edef.The‘expandingdefinition’\edefistreatedinChapter12.
Thedifferencebetweenthevarioustypesofmacrodefinitionsisonlyrelevantatthetime
ofthedefinition.Whenamacroiscalledthereisnowayoftellinghowitwasdefined.
11.5 Theparametertext
Betweenthecontrolsequenceoractivecharactertobedefinedandtheopeningbraceof
thereplacementtext,aparametertextcanoccur.Thisspecifieswhetherthemacrohas
parameters,howmany,andhowtheyaredelimited.Theparametertextcannotcontain
explicitbraces.
Amacrocanhaveatmostnineparameters.Aparameterisindicatedbyaparametertoken,
consistingofamacroparametercharacter(thatis,acharacterofcategorycode6,inplain
T
E
X#)followedbyadigit1–9.Forinstance,#6denotesthesixthparameterofamacro.
Parametertokenscannotappearoutsidethecontextofamacrodefinition.
Intheparametertext,parametersmustbenumberedconsecutively,startingat1.Aspace
afteraparametertokenissignificant,bothintheparametertextandthereplacementtext.
Parameterscanbedelimitedorundelimited.Aparameteriscalledundelimitedifitisfol-
lowedimmediatelybyanotherparameterintheparametertextorbytheopeningbrace
ofthereplacementtext;itiscalleddelimitedifitisfollowedbyanyothertoken.
VictorEijkhout–T
E
XbyTopic
111
C# PDF File & Page Process Library SDK for C#.net, ASP.NET, MVC
C# File: Merge PDF; C# File: Split PDF; C# Page: Insert PDF pages; C# Page: Delete PDF pages; C# Read: PDF Text Extract; C# Read: PDF
delete a page from a pdf file; delete page on pdf document
VB.NET PDF File & Page Process Library SDK for vb.net, ASP.NET
your PDF document is unnecessary, you may want to delete this page adding a page into PDF document, deleting unnecessary page from PDF file and changing
delete pages from pdf acrobat; reader extract pages from pdf
Chapter11. Macros
Thetokens(zeroormore)thataresubstitutedforaparameterwhenamacroisexpanded
(or‘called’)arecalledthe‘argument’correspondingtothatparameter.
11.5.1 Undelimitedparameters
Whenamacrowithanundelimitedparameter,forinstanceamacro\foowithonepara-
meter
\def\foo#1{ ... #1 ...}
isexpanded,T
E
Xscansahead(withoutexpanding)untilanon-blanktokenisfound.Ifthis
tokenisnotan explicitleft brace, it istaken to betheargumentcorrespondingtothe
parameter.Otherwiseabalancedtextisabsorbedbyscanninguntilthematchingexplicit
rightbracehasbeenfound.Thisbalancedtextthenconstitutestheargument.
Anexamplewiththreeundelimitedparametersfollows:with
\def\foo#1#2#3{#1(#2)#3}
themacrocall\foo123gives‘1(2)3’;but\foo 1 2 3alsogivesthesameresult.Inthe
call
\foo123
thefirstspaceisskipped in theinputprocessorofT
E
X.Theargument correspondingto
thefirstparameteristhenthe1.InordertofindthesecondparameterT
E
Xthenskipsall
blanks,inthiscaseexactlyone.AssecondparameterT
E
Xfindsthenthe2.Similarlythe
thirdparameteris3.
Inordertopassseveraltokensasoneundelimitedargumentonecanusebraces.Withthe
abovedefinitionof\foothecall\foo a{bc}dgives‘a(bc)d’.Whentheargumentofa
macro isabalancedtextinsteadofasingletoken,thedelimitingbracesarenotinserted
whentheargumentisinsertedinthereplacementtext.Forexample:
\def\foo#1{\count0=1#1\relax}
\foo{23}
willexpandto\count0=123\relax,whichassignsthevalueof123tothecounter.On
theotherhand,thestatement
\count0=1{23}
wouldassign1andprint23.
11.5.2 Delimitedparameters
Apart fromenclosingitinbracesthereisanotherwaytopassasequenceoftokensasa
singleargumenttoamacro,namelybyusingdelimitedparameters.
Anynon-parametertokensintheparametertextoccurringafteramacroparameter(that
is,aftertheparameternumber following theparametercharacter)actasadelimiterfor
thatparameter.Thisincludesspacetokens:aspaceafteraparameternumberissignificant.
Delimitingtokenscanalsooccurbetweenthecontrolsequencebeingdefinedandthefirst
parametertoken#1.
112
VictorEijkhout–T
E
XbyTopic
C# PDF Page Insert Library: insert pages into PDF file in C#.net
page processing functions, such as how to merge PDF document files by C# code, how to rotate PDF document page, how to delete PDF page using C#
delete pages in pdf; delete page in pdf online
C# PDF File Split Library: Split, seperate PDF into multiple files
Besides, in the process of splitting PDF document, developers can also remove certain PDF page from target PDF file using C#.NET PDF page deletion API.
delete a page from a pdf without acrobat; delete page in pdf preview
11.5. Theparametertext
Charactertokensactingasdelimitersintheparametertexthaveboththeircharactercode
andcategorycodestored;thedelimitingcharactertokensoftheactualargumentshaveto
matchboth.Categorycodesofsuchcharactersmayincludesomethatcannormallyonly
appearinspecialcontexts;forinstance,afterthedefinition
\def\foo#1_#2^{...}
themacro\foocanbeusedoutsidemathmode.
Whenlookingfortheargumentcorrespondingtoadelimitedparameter,T
E
Xabsorbsall
tokenswithoutexpansion(butbalancingbraces)untilthe(exact sequenceof)delimiting
tokensisencountered.Thedelimitingtokensarenotpartoftheargument;theyareremoved
fromtheinputstreamduringthemacrocall.
11.5.3 Exampleswithdelimitedarguments
Asasimpleexample,
\def\DoASentence#1#2.{{#1#2.}}
definesamacrowithanundelimitedfirstparameter,andasecondparameterdelimitedby
aperiod.Inthecall
\DoASentence \bf This sentence is the argument.
theargumentsare:
#1<-\bf
#2<-This sentence is the argument
Notethattheclosingperiodisnotintheargument,butithasbeenabsorbed;itisnolonger
intheinputstream.
Acommonlyuseddelimiteris\par:
\def\section#1. #2\par{\medskip\noindent {\bf#1. #2\par}}
Thismacrohasafirstparameterthatisdelimitedby‘.’,andasecondparameterthatis
delimitedby\par.Thecall
\section 2.5. Some title
The text of the section...
willgive
#1<-2.5
#2<-Some title
Notethatthereisaspaceattheendofthesecondargumentgeneratedbythelineend.If
thisspaceisunwantedonemightdefine
\def\section#1. #2 \par{...}
with\pardelimitingthesecondargument.Thisapproach,however,precludestheuser’s
writingthe\parexplicitly:
\section 2.5 Some title\par
VictorEijkhout–T
E
XbyTopic
113
VB.NET PDF File Compress Library: Compress reduce PDF size in vb.
Since images are usually or large size, images size reducing can help to reduce PDF file size effectively. Delete unimportant contents Embedded page thumbnails.
delete pages from a pdf file; add and delete pages in pdf online
VB.NET PDF Page Insert Library: insert pages into PDF file in vb.
using RasterEdge.XDoc.PDF; Add and Insert a Page to PDF File Using VB. doc2.Save( outPutFilePath). Add and Insert Blank Page to PDF File Using VB.
delete pages pdf document; acrobat remove pages from pdf
Chapter11. Macros
Onewayoutofthisdilemmaisto write#2\unskiponallplacesinthedefinition text
wherethetrailingspacewouldbeunwanted.
Controlsequencesactingasdelimitersneednotbedefined,astheyareabsorbedwithout
expansion.Thus
\def\control#1\sequence{...}
isausefuldefinition,evenif\sequenceisundefined.
Theimportanceofcategorycodesindelimitedargumentsisshownbythefollowingexam-
ple:
\def\a#1 #2.{ ... }
\catcode‘\ =12
\a b c
d.
whichgives
\a #1 #2.-> ...
#1<- b c
#2<-d
Explanation:thedelimiterbetweenparameters1and2isaspaceofcategory10.Inbetween
aandbthereisaspaceofcategory12;thefirstspaceofcategory10isthespacethatis
generatedbythelineend.
Fora‘real-life’applicationofmatchingofcategorycodes,seetheexplanationof\newif
inChapter13,andtheexampleonpage35.
11.5.4 Emptyarguments
IftheuserspecifiesabalancedtextinbraceswhenT
E
Xexpectsamacroargument,that
textisusedastheargument.Thus,specifying{}willgiveanargumentthatisanemptylist
oftokens;thisiscalledan‘emptyargument’.
Emptyargumentscanalsoarisefromtheuseofdelimitedparameters.Forexample,after
thedefinition
\def\mac#1\ro{ ... }
thecall
\mac\ro
willgiveanemptyargument.
11.5.5 Themacroparametercharacter
WhenT
E
X’sinputprocessorscansamacrodefinitiontext,itinsertsaparametertokenfor
anyoccurrenceofamacroparametercharacterfollowedbyadigit.Ineffect,aparameter
tokeninthereplacementtext states‘insertparameternumbersuchandsuchhere’.Two
parametercharactersinarowarereplacedbyasingleone.
Thelatterfactcanbeusedfornestedmacrodefinitions.Thus
114
VictorEijkhout–T
E
XbyTopic
VB.NET PDF File Split Library: Split, seperate PDF into multiple
The VB.NET PDF document splitter control provides VB.NET developers an easy to use solution that they can split target multi-page PDF document file to one-page
delete pages pdf file; delete pdf pages
C# PDF File Compress Library: Compress reduce PDF size in C#.net
Since images are usually or large size, images size reducing can help to reduce PDF file size effectively. Delete unimportant contents Embedded page thumbnails.
delete a page from a pdf file; acrobat extract pages from pdf
11.5. Theparametertext
\def\a{\def\b#1{...}}
givesan errormessage because\awasdefined without parameters,and yet thereisa
parametertokeninitsreplacementtext.
Thefollowing
\def\a#1{\def\b#1{...}}
definesamacro\athatdefinesamacro\b.However,\bstilldoesnothaveanyparameters:
thecall
\a z
definesa macro \bwithout parameters,that hasto befollowed by az. Note that this
doesnotattempttodefineamacro\bz,becausethecontrolsequence\bhasalreadybeen
formedinT
E
X’sinputprocessorwhenthatinputlinewasread.
Finally,
\def\a{\def\b##1{...}}
definesamacro\bwithoneparameter.
Letusexaminethehandlingoftheparametercharacterinsomedetail.Consider
\def\a#1{ .. #1 .. \def\b##1{ ... }}
Whenthisisreadasinput,theinputprocessor
replacesthecharacters#1byparametertoken
1
,and
replacesthecharacters##by#
Amacrocallof\awillthenlettheinputprocessorscan
\def\b#1{ ... }
inwhichthetwocharacters#1arereplacedbyaparametertoken.
11.5.6 Bracedelimiting
Ordinarily,itisnotpossibletohaveleftorrightbracesintheparametertextofadefini-
tion.Thereisaspecialmechanism,however,thatcanmakethelastparameterofamacro
actasifitisdelimitedbyanopeningbrace.
Ifthelastparametertokenisfollowedbyaparametercharacter(#),whichinturnisfol-
lowedbytheopeningbraceofthereplacementtext,T
E
Xmakesthelastparameterbede-
limitedbyabeginning-of-groupcharacter.Furthermore,unlikeotherdelimitingtokensin
parametertexts,thisopeningbraceisnotremovedfromtheinputstream.
Consideranexample.Supposewewanttohaveamacro\everythatcanfilltokenlistsas
follows:
\every par{abc} \every display{def}
Thismacrocanbedefinedas
\def\every#1#{\csname every#1\endcsname}
In thefirst call above, theargument corresponding to theparameter isabc, so thecall
expandsto
\csname everypar\endcsname{abc}
whichgivesthedesiredresult.
VictorEijkhout–T
E
XbyTopic
115
Chapter11. Macros
11.6 Constructionofcontrolsequences
Thecommands\csnameand\endcsnamecanbeusedtoconstructacontrolsequence.
Forinstance
\csname hskip\endcsname 5pt
isequivalentto\hskip5pt.
Duringthisconstructionprocessallmacrosandotherexpandablecontrolsequencesbet-
ween\csnameand\endcsnameareexpandedasusual,untilonlyunexpandablecharacter
tokensremain.Avariationoftheaboveexample,
\csname \ifhmode h\else v\fi skip\endcsname 5pt
performsan\hskipor\vskipdependingonthemode.Thefinalresultoftheexpansion
shouldconsistofonlycharactertokens,buttheircategorycodesdonotmatter.Anunex-
pandablecontrolsequencegivesanerrorhere:T
E
Xwillinsertan\endcsnamerightbefore
itasanattemptaterrorrecovery.
With\csnameitispossibletoconstructcontrolsequencesthatcannotordinarilybewritten,
becausetheconstituentcharactertokensmay haveanothercategorythan11,letter.This
principlecanbeusedtohideinnercontrolsequencesofamacropackagefromtheuser.
\def\newcounter#1{\expandafter\newcount
\csname #1:counter\endcsname}
\def\stepcounter#1{\expandafter\advance
\csname #1:counter\endcsname 1\relax}
Intheseconddefinitionthe\expandafterissuperfluous,butitdoesno
harm,anditisconceptuallyclearer.
Thenameoftheactualcountercreatedby\newcountercontainsacolon,sothatittakes
someefforttowritethiscontrolsequence.Ineffect,thecounterisnowhiddenfromthe
user,whocanonly accessitthroughcontrol sequencessuchas\stepcounter.Bythe
way,themacro\newcountisdefined\outerintheplainformat,sotheabovedefinition
of\newcountercanonlybewrittenafter\newcounthasbeenredefined.
Ifacontrolsequenceformedwith\csname...\endcsnamehasnotbeendefinedbefore,
itsmeaningissetto\relax.Thusif\xxisanundefinedcontrolsequence,thecommand
\csname xx\endcsname
willnotgiveanerrormessage,asitisequivalentto\relax.Moreover,afterthisexecution
ofthe\csname...\endcsnamestatement,thecontrolsequence\xxisitselfequivalentto
\relax,soitwillnolongergivean‘undefinedcontrolsequence’error(seealsopage131).
11.7 Tokenassignmentsby\letand\futurelet
TherearetwoletassignmentsinT
E
X.Theirsyntaxis
\letcontrolsequenceequalsoneoptionalspacetoken
\futureletcontrolsequencetokentoken
Inthesyntaxofa\futureletassignmentnooptionalequalssignappears.
116
VictorEijkhout–T
E
XbyTopic
11.8. Assortedremarks
11.7.1 \let
Theprimitivecommand\letassignsthecurrentmeaningofatokentoacontrolsequence
oractivecharacter.
Forinstance,intheplainformat\endgrafisdefinedas
\let\endgraf=\par
Thisenablesmacrowriterstoredefine\par,whilestill having thefunctionality of the
primitive\parcommandavailable.Forexample,
\everypar={\bgroup\it\def\par{\endgraf\egroup}}
Thecasewherethetokentobeassignedisnotacontrolsequencebutacharactertoken
insteadhasbeentreatedinChapter3.
11.7.2 \futurelet
Aswasexplainedabove,thesequencewith\let
\letcontrolsequencetoken
1
token
2
token
3
token···
assigns(themeaningof)token
1
tothecontrolsequence,andtheremaininginputstream
lookslike
token
2
token
3
token···
Thatis,thetoken
1
hasdisappearedfromthestream.
Thecommand\futureletworksslightlydifferently:giventheinputstream
\futureletcontrolsequencetoken
1
token
2
token
3
token···
it assigns(themeaning of)token
2
tothecontrolsequence,andtheremaining stream
lookslike
token
1
token
2
token
3
token···
That is, neither token
1
 nor token
2
has been lifted from thestream. However, now
token
1
‘knows’whattoken
2
is,withouthavinghad to absorb it asamacro parame-
ter.Seeanexamplebelow.
Ifacharactertokenhasbeen\futurelettoacontrolsequence,itscategorycodeisfixed.
Thesubsequenttoken
1
cannotchangeitanymore.
11.8 Assortedremarks
11.8.1 Activecharacters
Charactertokensofcategory13,‘activecharacters’,canbedefinedjust likecontrol se-
quences.Ifthedefinitionofthecharacterappearsinsideamacro,thecharacterhastobe
activeatthetimeofthedefinitionofthatmacro.
Considerforexamplethefollowingdefinition(takenfromChapter2):
VictorEijkhout–T
E
XbyTopic
117
Chapter11. Macros
{\catcode‘\^^M=13 %
\gdef\obeylines{\catcode‘\^^M=13 \def^^M{\par}}%
}
Theunusualcategoryofthe^^Mcharacterhastobesetduringthedefinitionof\obeylines,
otherwiseT
E
Xwouldthinkthatthelineendedafter\def.
11.8.2 Macrosversusprimitives
Thedistinctionbetweenprimitivecommandsandusermacrosisnotnearlyasimportantin
T
E
Xasitisinotherprogramminglanguages.
Theusercanuseprimitivecommandsunderdifferentnames:
\let\StopThisParagraph=\par
Namesofprimitivecommandscanbeusedforusermacros:
\def\par{\hfill$\bullet$\endgraf}
BothusermacrosandanumberofT
E
Xprimitivesaresubjectto expansion,for
instanceallconditionals,andcommandssuchas\numberand\jobname.
11.8.3 Tailrecursion
MacrosinT
E
X,likeproceduresinmostmodernprogramminglanguages,areallowedto
berecursive:thatis,thedefinitionofamacrocancontainacalltothissamemacro,orto
anothermacrothatwillcallthismacro.RecursivemacrostendtoclutterupT
E
X’smemory
iftoomany‘incarnations’ofsuchamacroareactiveatthesametime.However,T
E
Xis
abletopreventthisinonefrequentlyoccurringcaseofrecursion:tailrecursion.
Inordertoappreciatewhatgoesonhere,somebackgroundknowledgeisneeded.When
T
E
Xstartsexecutingamacroit absorbstheparameters,andplaces anitem pointing to
thereplacementtext on theinput stack,sothatthescannerwillnext bedirectedtothis
replacement.Onceit hasbeenprocessed,theitem on the input stack can beremoved.
However, if thedefinition textofamacrocontains further macros,this processwill be
repeated forthem: newitemsmaybeplacedontheinputstackdirectingthescannerto
othermacrosevenbeforethefirstonehasbeencompleted.
In generalthis‘stack build-up’ isanecessaryevil,butitcanbepreventedifthenested
macro call isthelast tokeninthereplacement textoftheoriginalmacro.Afterthelast
tokennofurthertokensneedtobeconsidered,soonemightaswellclearthetopitemfrom
theinputstackbeforeanewoneisputthere.ThisiswhatT
E
Xdoes.
The\loopmacroofplainT
E
Xprovidesagoodillustrationofthisprinciple.Thedefinition
is
\def\loop#1\repeat{\def\body{#1}\iterate}
\def\iterate{\body \let\next=\iterate
\else \let\next=\relax\fi \next}
andthismacrocanbecalledforexampleasfollows:
\loop \message{\number\MyCount}
\advance\MyCount by 1
\ifnum\MyCount<100 \repeat
118
VictorEijkhout–T
E
XbyTopic
11.9. Macrotechniques
Themacro\iteratecancallitselfand,whenitdoesso,therecursivecallisperformed
bythelasttokeninthelist.Itwouldhavebeenpossibletodefine\iterateas
\def\iterate{\body \iterate\fi}
butthenT
E
Xwouldnothavebeenabletoresolvetherecursionasthecall\iterateisnot
thelasttokeninthereplacementtextof\iterate.Assigning\let\next=\iterateis
hereawaytolettherecursivecallbethelasttokeninthelist.
Anotherwayofresolvingtailrecursionistouse\expandafter(seepage147):in
\def\iterate{\body \expandafter\iterate\fi}
itremovesthe\fitoken.Tailrecursionwouldalsoberesolvedifthelasttokensinthelist
wereargumentsfortherecursivemacro.
Anaside:bydefining\iterateas
\def\iterate{\let\next\relax
\body \let\next\iterate \fi \next}
itbecomespossibletowrite
\loop ... \if... ... \else ... \repeat
11.9 Macrotechniques
11.9.1 Unknownnumberofarguments
Insomeapplications,amacroisneededthatcanhaveanumberofargumentsthatisnot
specifiedinadvance.
Considertheproblemoftranslatingapositiononachessboard(forfullmacrosandfonts,
see[37]and[47]),givenlike
\White(Ke1,Qd1,Na1,e2,f4)
toasequenceoftypesettinginstructions
\WhitePiece{K}{e1} \WhitePiece{Q}{d1} \WhitePiece{N}{a1}
\WhitePiece{P}{e2} \WhitePiece{P}{f4}
Notethatforpawnsthe‘P’isomittedinthelistofpositions.
Thefirstproblemisthatthelistofpiecesisofvariablelength,soweappendaterminator
piece:
\def\White(#1){\xWhite#1,xxx,}
\def\endpiece{xxx}
forwhichwecantest.Next,themacro\xWhitetakesoneposition from thelist,tests
whetheritistheterminator,andifnot,subjectsittoatesttoseewhetheritisapawn.
\def\xWhite#1,{\def\temp{#1}%
\ifx\temp\endpiece
\else \WhitePieceOrPawn#1XY%
\expandafter\xWhite
\fi}
VictorEijkhout–T
E
XbyTopic
119
Documents you may be interested
Documents you may be interested