Chapter5. Boxes
istrueiftheboxregistercontainsahorizontalbox;
\ifvboxnumber
istrueiftheboxregistercontainsaverticalbox.Bothtestsarefalseforvoidregisters.
5.2.4
The\lastbox
WhenT
E
Xhasbuiltapartiallist,thelastboxinthislistisaccessibleasthe\lastbox.
Thisbehaveslikeaboxregister,soyoucanremovethelastboxfromthelistbyassigning
the\lastboxto someboxregister.Ifthelast itemonthecurrentlistisnot abox,the
\lastboxactslikeavoidboxregister.Itisnotpossibletogetholdofthelastboxinthe
caseofthemainverticallist.The\lastboxisthenalwaysvoid.
Asanexample,thestatement
{\setbox0=\lastbox}
removesthelastboxfromthecurrentlist,assigningittoboxregister0.Sincethisassi-
gnmentoccursinsideagroup,theregisterisclearedattheendofthegroup.Atthestart
ofaparagraphthiscanbeusedtoremovetheindentationbox(seeChapter16).Another
exampleof\lastboxcanbefoundonpage71.
Becausethe\lastboxisalwaysemptyinexternalverticalmode,itisnotpossibletoget
holdofboxesthathavebeenaddedtothepage.However,itispossibletodissectthepage
onceitisin\box255,forinstancedoing
\vbox{\unvbox255{\setbox0=\lastbox}}
insidetheoutputroutine.
Ifboxesinverticalmodehavebeenshiftedby\moverightor\moveleft,orifboxesin
horizontalmodehavebeenraisedby\raiseorloweredby\lower,anyinformationabout
thisdisplacementduetosuchacommandislostwhenthe\lastboxistakenfromthelist.
5.3
Naturaldimensionsofboxes
5.3.1
Dimensionsofcreatedhorizontalboxes
Insidean\hboxallconstituentsarelinedupnexttoeachother,withtheirreferencepoints
onthebaselineofthebox,unlesstheyaremovedexplicitly in theverticaldirectionby
\loweror\raise.
Theresultingwidthoftheboxisthesumofthewidthsofthecomponents.Thusthewidth
of
\hbox{\hskip1cm}
ispositive,andthewidthof
\hbox{\hskip-1cm}
isnegative.Bywayofexample,
a\hbox{\kern-1em b}--
60
VictorEijkhout–T
E
XbyTopic
Cut pages from pdf reader - 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 of pdf; copy pages from pdf into new pdf
Cut pages from pdf reader - 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 page pdf acrobat reader; delete page in pdf document
5.3. Naturaldimensionsofboxes
givesasoutput
ba–
whichshowsthatahorizontalboxcanhavenegativewidth.
Theheightanddepthofan\hboxarethemaximumamountthatconstituentboxesproject
aboveandbelowthebaselineofthebox.Theyarenon-negativewhentheboxiscreated.
Thecommands\lowerand\raisearetheonlypossibilitiesforverticalmovementinside
an\hbox(otherthanincludinga\vboxinsidethe\hbox,ofcourse);averticalcommand
–suchas\vskip–isnotallowedinahorizontalbox,and\par,althoughallowed,does
notdoanythinginsideahorizontalbox.
5.3.2
Dimensionsofcreatedverticalboxes
Insidea\vboxverticalmaterialislinedupwiththereferencepointsontheverticalline
through the referencepoint ofthebox,unless componentsaremoved explicitly in the
horizontaldirectionby\moveleftor\moveright.
Thereferencepointofaverticalboxisalwayslocatedattheleftboundaryofthebox.The
widthofaverticalboxisthenthemaximalamountthatanymaterialintheboxsticksto
therightofthereferencepoint.Materialtotheleftofthereferencepointisnottakeninto
accountinthewidth.Thustheresultof
a\vbox{\hbox{\kern-1em b}}--
is
ba –
Thisshouldbecontrastedwiththeaboveexample.
Thecalculationofheightanddepthisdifferentforverticalboxesconstructedby\vboxand
\vtop.Thegroundruleisthata\vboxhasareferencepointthatliesonthebaselineofits
lastcomponent,anda\vtophasitsreferencepointonthebaselineofthefirstcomponent.
Ingeneral,thedepth(height)ofa\vbox(\vtop)canbenon-zeroifthelast(first)itemis
aboxorrule.
Theheightofa\vboxisthenthesumoftheheightsanddepthsofallcomponentsexcept
thelast,plustheheightofthatlastcomponent;thedepthofthe\vboxisthedepthofitslast
component.Thedepthofa\vtopisthesumofthedepthofthefirstcomponentandthe
heightsanddepthsofallsubsequentmaterial;itsheightistheheightofthefirstcomponent.
However,theactualrulesareabitmorecomplicatedwhenthefirstcomponentofa\vtop
orthelastcomponentofa\vboxisnotaboxorrule.Ifthelastcomponentofa\vbox
isakernoraglue,thedepthofthatboxiszero;a\vtop’sheightiszerounlessitsfirst
componentisaboxorrule.(Notetheasymmetryinthesedefinitions; seebelowfor an
exampleillustrating this.) Thedepthofa\vtop,then, is equalto thetotal height plus
depthofallenclosedmaterialminustheheightofthe\vtop.
Thereisalimitonthedepthofverticalboxes:ifthedepthofa\vboxor\vtopcalculated
bytheaboveruleswouldexceed,thereferencepointoftheboxismoveddownbythe
excessamount.Moreprecisely,theexcessdepthisaddedtothenaturalheightofthebox.
VictorEijkhout–T
E
XbyTopic
61
C# PDF Page Extract Library: copy, paste, cut PDF pages in C#.net
C#.NET PDF Library - Copy and Paste PDF Pages in C#.NET. Easy to C#.NET Sample Code: Copy and Paste PDF Pages Using C#.NET. C# programming
delete pages pdf file; delete pages from pdf online
VB.NET PDF Page Extract Library: copy, paste, cut PDF pages in vb.
C:\test1.pdf") Dim pdf2 As PDFDocument = New PDFDocument("C:\test2.pdf") Dim pageindexes = New Integer() {1, 2, 4} Dim pages = pdf.DuplicatePage(pageindexes
delete page from pdf reader; delete pages pdf
Chapter5. Boxes
Iftheboxhadatoorspreadspecification,anyglueissetanewtotakethenewheight
intoaccount.
Ordinarily,\boxmaxdepthissettothemaximumdimensionpossibleinT
E
X.Itisforin-
stancereducedduringsomeofthecalculationsintheplainT
E
Xoutputroutine;seeChap-
ter28.
5.3.3
Examples
Horizontal boxesarerelatively straightforward. Theirwidthisthedistancebetweenthe
‘beginning’andthe‘end’ofthebox,andconsequentlythewidthisnotnecessarilypositive.
With
\setbox0=\hbox{aa} \setbox1=\hbox{\copy0 \hskip-\wd0}
the\box1haswidthzero;
/\box1/ gives ‘/a a’
Theheightanddepthofahorizontalboxcannotbenegative:in
\setbox0=\hbox{\vrule height 5pt depth 5pt}
\setbox1=\hbox{\raise 10pt \box0}
the\box1hasdepth0ptandheight15pt
Verticalboxesaremoretroublesomethanhorizontalboxes.Letusfirsttreattheirwidth.
After
\setbox0=\hbox{\hskip 10pt}
theboxinthe\box0registerhasawidthof10pt.Defining
\setbox1=\vbox{\moveleft 5pt \copy0}
the\box1willhavewidth5pt;materialtotheleftofthereferencepointisnotaccounted
forinthewidthofaverticalbox.With
\setbox2=\vbox{\moveright 5pt \copy0}
the\box2willhavewidth15pt.
Thedepthofa\vboxisthedepthofthelastitemifthatisabox,so
\vbox{\vskip 5pt \hbox{\vrule height 5pt depth 5pt}}
hasheight10ptanddepth5pt,and
\vbox{\vskip -5pt \hbox{\vrule height 5pt depth 5pt}}
hasheight0ptanddepth5pt.Withaglueorkernasthelastiteminthebox,theresulting
depthiszero,so
\vbox{\hbox{\vrule height 5pt depth 5pt}\vskip 5pt}
hasheight15ptanddepth0pt;
\vbox{\hbox{\vrule height 5pt depth 5pt}\vskip -5pt}
hasheight5ptanddepth0pt.
Theheightofa\vtopbehaves(almost)thesamewithrespecttothefirstitemofthebox,
asthedepthofa\vboxdoeswithrespecttothelastitem.Repeatingtheaboveexamples
witha\vtopgivesthefollowing:
62
VictorEijkhout–T
E
XbyTopic
VB.NET PDF copy, paste image library: copy, paste, cut PDF images
Copy, paste and cut PDF image while preview without adobe reader component installed. Image resize function allows VB.NET users to zoom and crop image.
delete pages from a pdf file; delete pdf pages online
C# PDF copy, paste image Library: copy, paste, cut PDF images in
C#.NET PDF SDK - Copy, Paste, Cut PDF Image in C#.NET. C#.NET Demo Code: Cut Image in PDF Page in C#.NET. PDF image cutting is similar to image deleting.
delete pages on pdf file; delete pdf page acrobat
5.4. Moreaboutboxdimensions
\vtop{\vskip 5pt \hbox{\vrule height 5pt depth 5pt}}
hasheight0ptanddepth15pt,and
\vtop{\vskip -5pt \hbox{\vrule height 5pt depth 5pt}}
hasheight0ptanddepth5pt;
\vtop{\hbox{\vrule height 5pt depth 5pt} \vskip 5pt}
hasheight5ptanddepth10pt,and
\vtop{\hbox{\vrule height 5pt depth 5pt} \vskip -5pt}
hasheight5ptanddepth0pt.
5.4
Moreaboutboxdimensions
5.4.1
Predetermineddimensions
Thesizeofaboxcanbespecifiedinadvancewithaboxspecification;seeaboveforthe
syntax.Anyglueintheboxisthensetinordertoreachtherequiredsize.Prescribingthe
sizeoftheboxisdoneby
\hboxtodimen{...},\vboxtodimen{...}
Ifstretchableorshrinkableglueispresentinthebox,itisstretchedorshrunkinorderto
givethebox thespecifiedsize.Associatedwiththisgluesettingisabadnessvalue(see
Chapter8).Ifnostretchorshrink–whicheverisnecessary–ispresent,theresultingbox
willbeunderfulloroverfullrespectively.Errorreportingforover/underfullboxesistreated
below.
Anothercommandtoletaboxhaveasizeotherthanthenaturalsizeis
\hboxspreaddimen{...},\vboxspreaddimen{...}
whichtellsT
E
Xtosettheglueinsuchawaythatthesizeoftheboxisaspecifiedamount
morethanthenaturalsize.
Boxspecificationsfor\vtopverticalboxesaresomewhatdifficulttointerpret.T
E
Xcon-
structsa\vtopbyfirstmakinga\vbox,includinggluesettingsinducedbyaboxspecification;
thenitcomputestheheightanddepthbytheaboverules.GluesettingisdescribedinChap-
ter8.
5.4.2
Changestoboxdimensions
Thedimensionsofaboxregisterareaccessiblebythecommands\ht,\dp,and\wd;for
instance\dp13givesthedepthofbox13.However,notonlycanboxesbemeasuredthis
way;byassigningvaluestothesedimensionsT
E
Xcanevenbefooledintothinkingthata
boxhasasizedifferentfromitsactual.However,changingthedimensionsofaboxdoes
notchangeanythingaboutthecontents;inparticularitdoesnotchangethewaytheglueis
set.
Variousformatsusethisin‘smash’macros:themacrodefinedby
\def\smash#1{{\setbox0=\hbox{#1}\dp0=0pt \ht0=0pt \box0\relax}}
VictorEijkhout–T
E
XbyTopic
63
VB.NET PDF Page Insert Library: insert pages into PDF file in vb.
Page: Insert PDF Pages. |. Home ›› XDoc.PDF ›› VB.NET PDF: Insert PDF Page. Add and Insert Multiple PDF Pages to PDF Document Using VB.
delete pages from pdf in preview; delete a page from a pdf
C# PDF Page Insert Library: insert pages into PDF file in C#.net
doc2.Save(outPutFilePath); Add and Insert Multiple PDF Pages to PDF Document Using C#. Add and Insert Blank Pages to PDF File in C#.NET.
delete pdf pages reader; delete blank page in pdf online
Chapter5. Boxes
placesitsargumentbutannihilatesitsheightanddepth;thatis,theoutputdoesshowthe
wholebox,butfurthercalculationsbyT
E
Xactasiftheheightanddepthwerezero.
Boxdimensionscanbechangedonlybysettingthem.Theyareboxdimens,whichcan
onlybesetinaboxsizeassignment,andnot,forinstancechangedwith\advance.
Notethataboxsizeassignmentisaglobalassignment:itseffecttranscendsanygroups
inwhichitoccurs(seeChapter10).Thustheoutputof
\setbox0=\hbox{---} {\wd0=0pt} a\box0b
is‘a—b ’.
Thelimitsthatholdonthedimensionswithwhichaboxcanbecreated(seeabove)donot
holdforexplicitchangestothesizeofabox:theassignment\dp0=-2ptforahorizontal
boxisperfectlyadmissible.
5.4.3
Movingboxesaround
Inahorizontalboxallconstituentelementsarelinedupwiththeirreferencepointsatthe
sameheightasthereferencepointofthebox.Anyboxinsideahorizontalboxcanbelifted
ordroppedusingthemacros\raiseand\lower.
Similarly,inaverticalboxallconstituentelementsarelinedupwiththeirreferencepoints
underneath oneanother, in linewith thereferencepointof thebox.Boxescannow be
movedsidewaysbythemacros\moveleftand\moveright.
Onlyboxescanbeshiftedthus;theseoperationscannotbeappliedto,forinstance,charac-
tersorrules.
5.4.4
Boxdimensionsandboxplacement
T
E
Xplacesthecomponentsofhorizontalandverticallistsbymaintainingareferenceline
andacurrentpositiononthatline.Forhorizontalliststhereferencelineisthebaselineof
thesurrounding\hbox;forverticallistsitistheverticallinethroughthereferencepointof
thesurrounding\vbox.
Inhorizontalmodeacomponentisplacedasfollows.Thecurrentpositioncoincidesiniti-
allywiththereferencepointofthesurroundingbox.Afterthat,thefollowingactionsare
carriedout.
1.
Ifthecomponenthasbeenshiftedby\raiseor\lower,shiftthecurrentposition
correspondingly.
2.
Ifthecomponentisahorizontalbox,usethisalgorithmrecursivelyforitscontents;
ifitisaverticalbox,goupbytheheightofthisbox,puttinganewcurrentposition
fortheenclosedverticallistthere,andplaceitscomponentsusingthealgorithm
forverticallistsbelow.
3.
Movethecurrentposition(onthereferenceline)totherightbythewidthofthe
component.
ForthelistinaverticalboxT
E
X’scurrentpositionisinitiallyattheupperleftcornerof
thatbox,asexplainedabove,andthereferencelineistheverticallinethroughthatpoint;it
64
VictorEijkhout–T
E
XbyTopic
C# PDF remove image library: remove, delete images from PDF in C#.
NET comment annotate PDF, VB.NET delete PDF pages, VB.NET Able to cut and paste image into another PDF PDF image in preview without adobe PDF reader component.
add and remove pages from pdf file online; delete page on pdf
How to C#: Basic SDK Concept of XDoc.PDF for .NET
example, you may easily create, load, combine, and split PDF file(s), and add, create, insert, delete, re-order, copy, paste, cut, rotate, and save PDF page(s
cut pages from pdf online; delete page in pdf preview
5.5. Overfullandunderfullboxes
alsorunsthroughthereferencepointofthebox.Enclosedcomponentsarethenplacedas
follows.
1.
Ifacomponenthasbeenshiftedusing\moveleftor\moveright,shiftthecur-
rentpositionaccordingly.
2.
Putthecomponentwithitsupperleftcorneratthecurrentposition.
3.
Ifthecomponentisaverticalbox,usethisalgorithmrecursivelyforitscontents;
ifitisahorizontalbox,itsreferencepointcanbefoundbelowthecurrentposition
bytheheightofthebox.Putthecurrentpositionforthatboxthere,andusethe
abovealgorithmforhorizontallists.
4.
Godownbytheheight plusdepthofthebox(that is,startingattheupperleft
cornerofthebox)onthereferenceline,andcontinueprocessingvertically.
Notethattheaboveprocessesdonotdescribetheconstructionofboxes.Thatwould(for
instance)involveforverticalboxestheinsertionofbaselineskipglue.Rather,itdescribes
thewaythecomponentsofafinishedboxarearrangedintheoutput.
5.4.5
Boxesandnegativeglue
Sometimesitisusefultohaveboxesoverlappinginsteadoflineup.Aneasywaytodothis
istousenegativeglue.Inhorizontalmode
{\dimen0=\wd8 \box8 \kern-\dimen0}
placesbox8withoutmovingthecurrentlocation.
Moreversatilearethemacros\llapand\rlap,definedas
\def\llap#1{\hbox to 0pt{\hss #1}}
and
\def\rlap#1{\hbox to 0pt{#1\hss}}
thatallowmaterialtoprotrudeleftorrightfromthecurrentlocation.The\hssglueisequi-
valentto\hskip 0pt plus 1fil minus 1fil,whichabsorbsanypositiveornegative
widthoftheargumentof\llapor\rlap.
Thesequence
\llap{\hbox to 10pt{a\hfil}}
iseffectivelythesameas
\hbox{\hskip-10pt \hbox to 10pt{a\hfil}}
whichhasatotalwidthof0pt.
5.5
Overfullandunderfullboxes
IfaboxhasasizespecificationT
E
Xwillstretchorshrinkglueinthebox.Forgluewithonly
finitestretchorshrinkcomponentsthebadness(seeChapter19)ofstretchingorshrinking
iscomputed.InT
E
Xversion3thebadnessoftheboxmostrecentlyconstructedisavailable
forinspectionbytheuserthroughthe\badnessparameter.Valuesforbadnessrange0–
10000,butiftheboxisoverfullitis1000000.
VictorEijkhout–T
E
XbyTopic
65
Chapter5. Boxes
WhenT
E
Xconsidersthebadnesstoolarge,itgivesadiagnosticmessage.Letusfirstcon-
sidererrorreportingforhorizontalboxes.
Horizontal boxesofwhich theglue hasto stretch areneverreported if\hbadness ≥
10000;otherwiseT
E
Xreportsthemas‘underfull’iftheirbadnessismorethan\hbadness.
Glueshrinkingcanleadto‘overfull’boxes:aboxiscalledoverfulliftheavailableshrink
isless thantheshrink necessarytomeettheboxspecification. An overfullboxisonly
reportedifthedifferenceinshrinkismorethan\hfuzz,orif\hbadness<100(andit
turnsoutthatusingallavailableshrinkabilityhasbadness100).
Setting\hfuzz=1ptwillletT
E
Xignoreboxesthatcannotshrinkenough
iftheylacklessthan1pt.In
\hbox to 1pt{\hskip3pt minus .5pt}
\hbox to 1pt{\hskip3pt minus 1.5pt}
onlythefirstboxwillgiveanerrormessage:itis1.5pttoobig,whereas
thesecondlacks.5ptwhichislessthan\hfuzz.
Also,boxesthatshrinkbutthatarenotoverfullcanbereported:ifaboxis‘tight’,thatis,
ifitusesatleasthalfitsshrinkability,T
E
Xreportsthisfactifthecomputedbadness(which
isbetween13and100)ismorethan\hbadness.
Forhorizontalandverticalboxesthiserrorreportingisalmostthesame,withparameters
\vbadnessand\vfuzz.ThedifferenceisthatforhorizontaloverfullboxesT
E
Xwilldraw
aruletotherightoftheboxthathasthesameheightasthebox,andwidth\overfullrule.
Nooverfullruleensuesifthe\tabskipglueinan\haligncannotbeshrunkenough.
5.6
Openingandclosingboxes
Theopeningandclosingbracesofaboxcanbeeitherexplicit,thatis,charactertokensof
category1and2,orimplicit,acontrolsequence\lettosuchacharacter.Aftertheope-
ningbracethe\everyhboxor\everyvboxtokensareinserted.Ifthisboxappearedina
\setboxassignmentany\afterassignmenttokenisinsertedevenbeforethe‘everybox’
tokens.
\everyhbox{b}
\afterassignment a
\setbox0=\hbox{c}
\showbox0
gives
> \box0=
\hbox(6.94444+0.0)x15.27782
.\tenrm a
.\tenrm b
.\kern0.27779
.\tenrm c
Implicitbracescanbeusedtoletaboxbeopenedorclosedbyamacro,forexample:
66
VictorEijkhout–T
E
XbyTopic
5.7. Unboxing
\def\openbox#1{\setbox#1=\hbox\bgroup}
\def\closebox#1{\egroup\DoSomethingWithBox#1}
\openbox0 ... \closebox0
Thismechanismcanbeusedtoscoopupparagraphs:
\everypar{\setbox\parbox=
\vbox\bgroup
\everypar{}
\def\par{\egroup\UseBox\parbox}}
Herethe\everyparopenstheboxandletsthetextbesetinthebox:startingforinstance
Begin a text ...
givestheequivalentof
\setbox\parbox=\vbox{Begin a text ...
Insidethebox\parhasbeenredefined,so
... a text ends.\par
isequivalentto
... a text ends.}\Usebox\parbox
Inthisexample,the\UseBoxcommandcanonlytreattheboxasawhole;iftheelements
oftheboxshouldsomehowbetreatedseparatelyanotherapproachisnecessary.In
\everypar{\setbox\parbox=
\vbox\bgroup\everypar{}%
\def\par{\endgraf\HandleLines
\egroup\box\parbox}}
\def\HandleLines{ ... \lastbox ... }
themacro\HandleLinescanhaveaccesstosuccessiveelementsfromtheverticallistof
theparagraph.Seealsotheexampleonpage71.
5.7
Unboxing
Boxescan beunwrapped by thecommands\unhboxand \unvbox,and by theircopy-
ingversions\unhcopyand\unvcopy.Thesearehorizontalandverticalcommands(see
Chapter6),consideringthatineffecttheycontributeapartialhorizontalorverticallist.Itis
notpossibleto\unhboxaregistercontaininga\vboxorviceversa,butavoidboxregister
canbothbe\unhboxedand\unvboxed.
Unboxingtakesthecontentsofaboxinaboxregisterandappendsthemtothesurrounding
list;anygluecanthenbesetanew.Thus
\setbox0=\hbox to 1cm{\hfil} \hbox to 2cm{\unhbox0}
iscompletelyequivalentto
\hbox to 2cm{\hfil}
andnotto
\hbox to 2cm{\kern1cm}
VictorEijkhout–T
E
XbyTopic
67
Chapter5. Boxes
Theintrinsicallyhorizontalnatureof\unhboxisusedtodefine
\def\leavevmode{\unhbox\voidb@x}
Thiscommandswitchesfromverticalmodetohorizontalwithoutaddinganythingtothe
horizontallist.However,thesubsequent\indentcausedbythistransitionaddsaninden-
tationbox.Inhorizontalmodethe\leavevmodecommandhasnoeffect.Notethathereit
isnotnecessarytouse\unhcopy,becausetheregisterisemptyanyhow.
Bewareofthefollowingsubtlety: unboxinginverticalmodedoesnotaddinterlineglue
betweentheboxcontentsandanyprecedingitem.Also,thevalueof\prevdepthisnot
changed,sogluebetweentheboxcontentsandanyfollowingitemwilloccuronlyifthere
wassomethingprecedingthebox;interlinegluewillbebasedonthedepthofthatpreceding
item.Similarly,unboxinginhorizontalmodedoesnotinfluencethe\spacefactor.
5.8
Textinboxes
Bothhorizontalandverticalboxescancontaintext.However,thewaytextistreateddiffers.
In horizontal boxes thetext isplaced in onestraight line, andthewidth of thebox is
inprinciplethenaturalwidthofthetext(and otheritems)contained in it. No vertical
commandsareallowedinsideahorizontalbox,and\pardoesnothinginthiscase.
Forverticalboxesthesituationisradicallydifferent.Assoonasacharacter,oranyother
horizontalcommand(seepage74),isencounteredinaverticalbox,T
E
Xstartsbuilding
aparagraphinunrestrictedhorizontalmode,thatis,justasiftheparagraphweredirectly
partofthepage.Attheoccurrenceofaverticalcommand(seepage74),orattheend
ofthebox,theparagraphisbrokenintolinesusingthecurrentvaluesofparameterssuch
as\hsize.
Thus
\hbox to 3cm{\vbox{some reasonably long text}}
will not giveaparagraph ofwidth3 centimetres(it givesan overfull horizontalboxif
\hsize>3cm).However,
\vbox{\hsize=3cm some reasonably long text}
willbe3centimetreswide.
Aparagraphoftextinsideaverticalboxisbrokenintolines,whicharepackedinhorizontal
boxes.Theseboxesarethenstackedininternalverticalmode,possiblywith\baselineskip
and\lineskipseparatingthem(thisistreatedinChapter15).Thisprocessisalsoused
fortextonthepage;theboxesarethenstackedinouterverticalmode.
Iftheinternalverticallistisempty,no\parskipglueisaddedatthestartofaparagraph.
Becausetextinahorizontalboxisnotbrokenintolines,thereisafurtherdifferencebet-
weentextinrestrictedandunrestrictedhorizontalmode.Inrestrictedhorizontalmodeno
discretionarynodesandwhatsititemschangingthevalueofthecurrentlanguageareinser-
ted.Thismaygiveproblemsifthetextissubsequentlyunboxedtoformpartofaparagraph.
SeeChapter19foranexplanationoftheseitems,and[7]forawayaroundthisproblem.
68
VictorEijkhout–T
E
XbyTopic
5.9. Assortedremarks
5.9
Assortedremarks
5.9.1
Forgettingthe\box
After\newcount\foo,onecanuse\fooonitsowntogetthe\foocounter.Forboxes,
however,onehastouse\box\footogetthe\foobox.Thereasonforthisisthatthere
existsnoseparate\boxdefcommand,so\chardefisused(seeChapter31).
Suppose\newbox\fooallocatesbox register 25; then typing \foo is
equivalenttotyping\char25.
5.9.2
Special-purposeboxes
Someboxregistershaveaspecialpurpose:
\box255isbyusedT
E
Xinternallytogivethepagetotheoutputroutine.
\voidb@xisthenumberofaboxregisterallocatedinplain.tex;itissupposed
tobeemptyalways.Itisusedinthemacro\leavevmodeandothers.
whenanew\insertiscreatedwiththeplainT
E
X\newinsertmacro,a\count,
\dimen,\skip,and\boxallwiththesamenumberarereservedforthatinsert.
Thenumbersfortheseregisterscountdownfrom254.
5.9.3
Theheightofaverticalboxinhorizontalmode
Inhorizontalmodeaverticalboxisplacedwithitsreferencepointalignedverticallywith
thereferencepointofthesurroundingbox.T
E
Xthentraversesitscontentsstartingatthe
leftuppercorner;thatis,thepointthatliesabovethereferencepointbyadistanceofthe
heightofthebox.Changingtheheightoftheboximpliesthenthatthecontentsofthebox
areplacedatadifferentheight.
Considerasanexample
\hbox{a\setbox0=\vbox{\hbox{b}}\box0 c}
whichgives
abc
and
\hbox{a\setbox0=\vbox{\hbox{b}}\ht0=0cm \box0 c}
whichgives
a
b
c
Bycontrast,changingthewidthofaboxplacedinverticalmodehasnoeffectonitsplace-
ment.
5.9.4
Moresubtletieswithverticalboxes
Sincetherearetwokindsofverticalboxes,the\vboxandthe\vtop,usingthesetwokinds
nestedmayleadtoconfusingresults.Forinstance,
\vtop{\vbox{...}}
VictorEijkhout–T
E
XbyTopic
69
Documents you may be interested
Documents you may be interested