ebook img

TeX by topic, a texnician's reference PDF

289 Pages·1992·1.349 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview TeX by topic, a texnician's reference

T X BY TOPIC, A T XNICIAN’S REFERENCE E E VICTOREIJKHOUT∗ ELECTRONICVERSION1.1,AUGUST2004 ∗ This is – apart from minor changes – the full text of the book TEX by Topic, copyright 1991- 2004VictorEijkhout.Thisbookwasprintedin1991byAddison-WesleyUK,ISBN0-201-56882-9, reprinted in 1993, pdf version first made available 2001. This electronic book may be copied; the pdffileofthisbookmaybeprintedandgivenaway,anditmaybeincludedinarchivesandonweb sites; the book may be distributed in unaltered form both on paper and electronic media. You are notallowedtomakeanychangestothefileortoreverseengineeritssource;youarenotallowed tochargeforitsdistribution–whetherinphysicalorelectronicform–beyondreasonablematerial costs. Ifyouhavecommentsorwanttoexpressyourappreciationthatyouaregettingthisbookthatformerly soldfor≈$30forfree,pleasevisithttp://www.eijkhout.net/tbt/.Ifyoualreadymadeadonation,thank you.Youareacredittoyourspecies. Contents 1 TheStructureoftheTEXProcessor 14 1.1 FourTEXprocessors 14 1.2 Theinputprocessor 15 1.2.1 Characterinput 15 1.2.2 Two-levelinputprocessing 15 1.3 Theexpansionprocessor 16 1.3.1 Theprocessofexpansion 16 1.3.2 Specialcases:\expandafter,\noexpand,and\the 16 1.3.3 Bracesintheexpansionprocessor 17 1.4 Theexecutionprocessor 17 1.5 Thevisualprocessor 18 1.6 Examples 18 1.6.1 Skippedspaces 18 1.6.2 Internalquantitiesandtheirrepresentations 19 2 CategoryCodes andInternalStates 20 2.1 Introduction 20 2.2 Initialprocessing 20 2.3 Categorycodes 21 2.4 Fromcharacterstotokens 23 2.5 Theinputprocessorasafinitestateautomaton 23 2.5.1 StateN:newline 23 2.5.2 StateS:skippingspaces 23 2.5.3 StateM:middleofline 23 2.6 Accessingthefullcharacterset 24 2.7 Transitionsbetweeninternalstates 24 2.7.1 0:escapecharacter 24 2.7.2 1–4,7–8,11–13:non-blankcharacters 25 2.7.3 5:endofline 25 2.7.4 6:parameter 25 2.7.5 7:superscript 25 2.7.6 9:ignoredcharacter 25 2.7.7 10:space 25 2.7.8 14:comment 25 2.7.9 15:invalid 26 2.8 Lettersandothercharacters 26 2.9 The\partoken 27 2.10 Spaces 27 2.10.1 Skippedspaces 27 2.10.2 Optionalspaces 28 1 Contents 2.10.3 Ignoredandobeyedspaces 28 2.10.4 Moreignoredspaces 29 2.10.5 hspacetokeni 29 2.10.6 Controlspace 30 2.10.7 ‘ ’ 30 2.11 Moreaboutlineends 30 2.11.1 Obeylines 30 2.11.2 Changingthe\endlinechar 31 2.11.3 Moreremarksabouttheend-of-linecharacter 32 2.12 Moreabouttheinputprocessor 32 2.12.1 Theinputprocessorasaseparateprocess 32 2.12.2 Theinputprocessornotasaseparateprocess 33 2.12.3 Recursiveinvocationoftheinputprocessor 33 2.13 The@convention 33 3 Characters 34 3.1 Charactercodes 34 3.2 Controlsequencesforcharacters 35 3.3 Denotingcharacterstobetypeset:\char 35 3.3.1 Implicitcharactertokens:\let 36 3.4 Accents 37 3.5 Testingcharacters 38 3.6 Uppercaseandlowercase 38 3.6.1 Uppercaseandlowercasecodes 38 3.6.2 Uppercaseandlowercasecommands 39 3.6.3 Uppercaseandlowercaseformsofkeywords 39 3.6.4 Creativeuseof\uppercaseand\lowercase 39 3.7 Codesofacharacter 40 3.8 Convertingtokensintocharacterstrings 40 3.8.1 Outputofcontrolsequences 40 3.8.2 Categorycodesofa\string 41 4 Fonts 42 4.1 Fonts 42 4.2 Fontdeclaration 43 4.2.1 Fontsandtfmfiles 43 4.2.2 Queryingthecurrentfontandfontnames 43 4.2.3 \nullfont 44 4.3 Fontinformation 44 4.3.1 Fontdimensions 44 4.3.2 Kerning 45 4.3.3 Italiccorrection 45 4.3.4 Ligatures 45 4.3.5 Boundaryligatures 46 5 Boxes 47 5.1 Boxes 48 5.2 Boxregisters 48 5.2.1 Allocation:\newbox 48 5.2.2 Usage:\setbox,\box,\copy 49 5.2.3 Testing:\ifvoid,\ifhbox,\ifvbox 49 5.2.4 The\lastbox 49 5.3 Naturaldimensionsofboxes 50 2 VictorEijkhout–TEXbyTopic Contents 5.3.1 Dimensionsofcreatedhorizontalboxes 50 5.3.2 Dimensionsofcreatedverticalboxes 50 5.3.3 Examples 51 5.4 Moreaboutboxdimensions 52 5.4.1 Predetermineddimensions 52 5.4.2 Changestoboxdimensions 53 5.4.3 Movingboxesaround 53 5.4.4 Boxdimensionsandboxplacement 53 5.4.5 Boxesandnegativeglue 54 5.5 Overfullandunderfullboxes 55 5.6 Openingandclosingboxes 55 5.7 Unboxing 56 5.8 Textinboxes 57 5.9 Assortedremarks 57 5.9.1 Forgettingthe\box 57 5.9.2 Special-purposeboxes 58 5.9.3 Theheightofaverticalboxinhorizontalmode 58 5.9.4 Moresubtletieswithverticalboxes 58 5.9.5 Hangingthe\lastboxbackinthelist 59 5.9.6 Dissectingparagraphswith\lastbox 59 6 Horizontaland VerticalMode 61 6.1 Horizontalandverticalmode 61 6.1.1 Horizontalmode 61 6.1.2 Verticalmode 62 6.2 Horizontalandverticalcommands 62 6.3 Theinternalmodes 63 6.3.1 Restrictedhorizontalmode 63 6.3.2 Internalverticalmode 63 6.4 Boxesandmodes 64 6.4.1 Whatboxdoyouuseinwhatmode? 64 6.4.2 Whatmodeholdsinwhatbox? 64 6.4.3 Mode-dependentbehaviourofboxes 64 6.5 Modesandglue 64 6.6 Migratingmaterial 65 6.6.1 \vadjust 65 6.7 Testingmodes 65 7 Numbers 67 7.1 Numbersandhnumberis 67 7.2 Integers 67 7.2.1 Denotations:integers 68 7.2.2 Denotations:characters 68 7.2.3 Internalintegers 69 7.2.4 Internalintegers:othercodesofacharacter 70 7.2.5 hspecialintegeri 70 7.2.6 Otherinternalquantities:coersiontointeger 70 7.2.7 Trailingspaces 70 7.3 Numbers 70 7.4 Integerregisters 71 7.5 Arithmetic 71 VictorEijkhout–TEXbyTopic 3 Contents 7.5.1 Arithmeticstatements 72 7.5.2 Floating-pointarithmetic 72 7.5.3 Fixed-pointarithmetic 72 7.6 Numbertesting 72 7.7 Remarks 73 7.7.1 Characterconstants 73 7.7.2 Expandingtoofar/howfar 73 8 DimensionsandGlue 75 8.1 Definitionofhglueiandhdimeni 75 8.1.1 Definitionofdimensions 76 8.1.2 Definitionofglue 77 8.1.3 Conversionofhglueitohdimeni 77 8.1.4 Registersfor\dimenand\skip 78 8.1.5 Arithmetic:addition 78 8.1.6 Arithmetic:multiplicationanddivision 79 8.2 Moreaboutdimensions 79 8.2.1 Unitsofmeasurement 79 8.2.2 Dimensiontesting 80 8.2.3 Defineddimensions 80 8.3 Moreaboutglue 80 8.3.1 Stretchandshrink 80 8.3.2 Gluesetting 82 8.3.3 Badness 82 8.3.4 Glueandbreaking 82 8.3.5 \kern 83 8.3.6 Glueandmodes 83 8.3.7 Thelastglueiteminalist:backspacing 83 8.3.8 Examplesofbackspacing 84 8.3.9 Glueintraceoutput 84 9 RulesandLeaders 86 9.1 Rules 86 9.1.1 Ruledimensions 87 9.2 Leaders 87 9.2.1 Ruleleaders 88 9.2.2 Boxleaders 89 9.2.3 Evenlyspacedleaders 89 9.3 Assortedremarks 90 9.3.1 Rulesandmodes 90 9.3.2 Endingaparagraphwithleaders 90 9.3.3 Leadersandboxregisters 90 9.3.4 Outputinleaderboxes 91 9.3.5 Boxleadersintraceoutput 91 9.3.6 Leadersandshiftedmargins 91 10 Grouping 92 10.1 Thegroupingmechanism 92 10.2 Localandglobalassignments 93 10.3 Groupdelimiters 93 10.4 Moreaboutbraces 94 10.4.1 Bracecounters 94 10.4.2 Thebraceasatoken 94 4 VictorEijkhout–TEXbyTopic Contents 10.4.3 Openandclosingbracecontrolsymbols 95 11 Macros 96 11.1 Introduction 96 11.2 Layoutofamacrodefinition 97 11.3 Prefixes 97 11.4 Thedefinitiontype 98 11.5 Theparametertext 98 11.5.1 Undelimitedparameters 98 11.5.2 Delimitedparameters 99 11.5.3 Exampleswithdelimitedarguments 99 11.5.4 Emptyarguments 101 11.5.5 Themacroparametercharacter 101 11.5.6 Bracedelimiting 102 11.6 Constructionofcontrolsequences 102 11.7 Tokenassignmentsby\letand\futurelet 103 11.7.1 \let 103 11.7.2 \futurelet 103 11.8 Assortedremarks 104 11.8.1 Activecharacters 104 11.8.2 Macrosversusprimitives 104 11.8.3 Tailrecursion 104 11.9 Macrotechniques 105 11.9.1 Unknownnumberofarguments 105 11.9.2 Examiningtheargument 106 11.9.3 Optionalmacroparameterswith\futurelet 108 11.9.4 Two-stepmacros 108 11.9.5 Acommentenvironment 109 12 Expansion 111 12.1 Introduction 111 12.2 Ordinaryexpansion 111 12.3 Reversingexpansionorder 112 12.3.1 Onestepexpansion:\expandafter 112 12.3.2 Totalexpansion:\edef 113 12.3.3 \afterassignment 113 12.3.4 \aftergroup 114 12.4 Preventingexpansion 115 12.4.1 \noexpand 115 12.4.2 \noexpandandactivecharacters 115 12.5 \relax 116 12.5.1 \relaxand\csname 116 12.5.2 Preventingexpansionwith\relax 117 12.5.3 TEXinsertsa\relax 117 12.5.4 Thevalueofnon-macros;\the 118 12.6 Examples 118 12.6.1 Expandingafter 118 12.6.2 Defininginsidean\edef 119 12.6.3 Expansionand\write 120 12.6.4 Controlledexpansioninsidean\edef 121 12.6.5 Multiplepreventionofexpansion 121 12.6.6 Moreexampleswith\relax 121 VictorEijkhout–TEXbyTopic 5 Contents 12.6.7 Example:categorycodesavingandrestoring 122 12.6.8 Combining\aftergroupandboxes 123 12.6.9 Moreexpansion 123 13 Conditionals 124 13.1 Theshapeofconditionals 124 13.2 Characterandcontrolsequencetests 125 13.2.1 \if 125 13.2.2 \ifcat 125 13.2.3 \ifx 125 13.3 Modetests 126 13.4 Numericaltests 126 13.5 Othertests 127 13.5.1 Dimensiontesting 127 13.5.2 Boxtests 127 13.5.3 I/Otests 127 13.5.4 Casestatement 127 13.5.5 Specialtests 128 13.6 The\newifmacro 128 13.7 Evaluationofconditionals 129 13.8 Assortedremarks 130 13.8.1 Thetestgobblesuptokens 130 13.8.2 Thetestwantstogobbleupthe\elseor\fi 130 13.8.3 Macrosandconditionals;theuseof\expandafter 131 13.8.4 Incorrectmatching 132 13.8.5 Conditionalsandgrouping 132 13.8.6 Atrick 133 13.8.7 Moreexamplesofexpansioninconditionals 133 14 TokenLists 136 14.1 Tokenlists 136 14.2 Useoftokenlists 136 14.3 htokenparameteri 137 14.4 Tokenlistregisters 137 14.5 Examples 138 14.5.1 Operationsontokenlists:stackmacros 138 14.5.2 Executingtokenlists 139 15 BaselineDistances 141 15.1 Interlineglue 141 15.2 Theperceiveddepthofboxes 143 15.3 Terminology 143 15.4 Additionalremarks 144 16 ParagraphStart 145 16.1 Whendoesaparagraphstart 145 16.2 Whathappenswhenaparagraphstarts 146 16.3 Assortedremarks 146 16.3.1 Startingaparagraphwithabox 146 16.3.2 Startingaparagraphwithagroup 146 16.4 Examples 147 16.4.1 Stretchableindentation 147 16.4.2 Suppressingindentation 147 16.4.3 Anindentationscheme 147 6 VictorEijkhout–TEXbyTopic Contents 16.4.4 Aparagraphskipscheme 148 17 ParagraphEnd 150 17.1 Thewayparagraphsend 150 17.1.1 The\parcommandandthe\partoken 151 17.1.2 Paragraphfilling:\parfillskip 151 17.2 Assortedremarks 151 17.2.1 Endingaparagraphandagroupatthesametime 151 17.2.2 Endingaparagraphwith\hfill\break 152 17.2.3 Endingaparagraphwitharule 152 17.2.4 Nopagebreaksinbetweenparagraphs 152 17.2.5 Finite\parfillskip 152 17.2.6 Aprecautionforparagraphsthatdonotindent 153 18 ParagraphShape 154 18.1 Thewidthoftextlines 154 18.2 Shapeparameters 154 18.2.1 Hangingindentation 154 18.2.2 Generalparagraphshapes:\parshape 155 18.3 Assortedremarks 156 18.3.1 Centredlastlines 156 18.3.2 Indentingintothemargin 156 18.3.3 Hangaparagraphfromanobject 157 18.3.4 Anotherapproachtohangingindentation 157 18.3.5 Hangingindentationversus\leftskipshifting 158 18.3.6 Moreexamples 158 19 LineBreaking 159 19.1 Paragraphbreakcostcalculation 160 19.1.1 Badness 160 19.1.2 Penaltiesandotherbreaklocations 160 19.1.3 Demerits 161 19.1.4 Thenumberoflinesofaparagraph 162 19.1.5 Betweenthelines 162 19.2 Theprocessofbreaking 162 19.2.1 Threepasses 163 19.2.2 Tolerancevalues 163 19.3 Discretionaries 163 19.3.1 Hyphensanddiscretionaries 163 19.3.2 Examplesofdiscretionaries 164 19.4 Hyphenation 164 19.4.1 Startofaword 165 19.4.2 Endofaword 165 19.4.3 TEX2versusTEX3 166 19.4.4 Patternsandexceptions 166 19.5 Switchinghyphenationpatterns 166 20 Spacing 168 20.1 Introduction 168 20.2 Automaticinterwordspace 168 20.3 Userinterwordspace 169 20.4 Controlspaceandtie 170 20.5 Moreonthespacefactor 171 20.5.1 Spacefactorassignments 171 VictorEijkhout–TEXbyTopic 7 Contents 20.5.2 Punctuation 171 20.5.3 Othernon-letters 172 20.5.4 Otherinfluencesonthespacefactor 172 21 CharactersinMathMode 173 21.1 Mathematicalcharacters 173 21.2 Delimiters 174 21.2.1 Delimitercodes 175 21.2.2 Explicit\delimitercommands 175 21.2.3 Findingadelimiter;successors 175 21.2.4 \big,\Big,\bigg,and\Bigg 176 21.3 Radicals 176 21.4 Mathaccents 177 22 FontsinFormulas 178 22.1 Determiningthefontofacharacterinmathmode 178 22.2 Initialfamilysettings 178 22.3 Familydefinition 179 22.4 Somespecificfontchanges 179 22.4.1 ChangethefontofordinarycharactersanduppercaseGreek 179 22.4.2 ChangeuppercaseGreekindependentoftextfont 180 22.4.3 ChangethefontoflowercaseGreek 180 22.5 Assortedremarks 180 22.5.1 Newfontsinformulas 180 22.5.2 Evaluatingthefamilies 181 23 MathematicsTypesetting 182 23.1 Mathmodes 183 23.2 Stylesinmathmode 183 23.2.1 Superscriptsandsubscripts 184 23.2.2 Choiceofstyles 184 23.3 Classesofmathematicalobjects 185 23.4 Largeoperatorsandtheirlimits 185 23.5 Verticalcentring:\vcenter 186 23.6 Mathematicalspacing:muglue 186 23.6.1 Classificationofmuglue 187 23.6.2 Muskipregisters 187 23.6.3 Otherspacesinmathmode 188 23.7 Generalizedfractions 188 23.8 Underlining,overlining 189 23.9 Linebreakinginmathformulas 189 23.10 Fontdimensionsoffamilies2and3 189 23.10.1 Symbolfontattributes 189 23.10.2 Extensionfontattributes 190 23.10.3 Example:subscriptlowering 191 24 DisplayMath 192 24.1 Displays 192 24.2 Displaysinparagraphs 193 24.3 Verticalmaterialarounddisplays 193 24.4 Gluesettingofthedisplaymathlist 194 24.5 Centringthedisplayformula:displacement 194 24.6 Equationnumbers 194 24.6.1 Ordinaryequationnumbers 195 8 VictorEijkhout–TEXbyTopic Contents 24.6.2 Theequationnumberonaseparateline 195 24.7 Non-centreddisplays 195 25 Alignment 197 25.1 Introduction 197 25.2 Horizontalandverticalalignment 197 25.2.1 Horizontalalignments:\halign 198 25.2.2 Verticalalignments:\valign 198 25.2.3 Materialbetweenthelines:\noalign 198 25.2.4 Sizeofthealignment 199 25.3 Thepreamble 199 25.3.1 Infinitepreambles 199 25.3.2 Bracecountinginpreambles 200 25.3.3 Expansioninthepreamble 200 25.3.4 \tabskip 200 25.4 Thealignment 201 25.4.1 Readinganentry 201 25.4.2 Alternatespecifications:\omit 201 25.4.3 Spanningacrossmultiplecolumns:\span 202 25.4.4 Rulesinalignments 202 25.4.5 Endofaline:\crand\crcr 203 25.5 Example:mathalignments 203 26 PageShape 205 26.1 Thereferencepointforglobalpositioning 205 26.2 \topskip 205 26.3 Pageheightanddepth 206 27 PageBreaking 207 27.1 Thecurrentpageandtherecentcontributions 207 27.2 Activatingthepagebuilder 208 27.3 Pagelengthbookkeeping 208 27.4 Breakpoints 209 27.4.1 Possiblebreakpoints 209 27.4.2 Breakpointpenalties 209 27.4.3 Breakpointcomputation 210 27.5 \vsplit 211 27.6 Examplesofpagebreaking 212 27.6.1 Fillingupapage 212 27.6.2 Determiningthebreakpoint 212 27.6.3 Thepagebuilderafteraparagraph 213 28 OutputRoutines 214 28.1 The\outputtokenlist 214 28.2 Outputand\box255 215 28.3 Marks 215 28.4 Assortedremarks 217 28.4.1 Hazardsinnon-trivialoutputroutines 217 28.4.2 Pagenumbering 217 28.4.3 HeadlinesandfootlinesinplainTEX 217 28.4.4 Example:nowidowlines 217 28.4.5 Example:noindentationtopofpage 218 28.4.6 Moreexamplesofoutputroutines 219 29 Insertions 220 VictorEijkhout–TEXbyTopic 9

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.