Changes

Jump to navigation Jump to search
428 bytes added ,  13:33, 23 September 2021
m
links fixed
Boxes are the basis of all (low level) TeX typesetting. As the building blocks they store typeset parts of lines, paragraphs or pages. For storing material not being typeset yet, like input text for later use, use [[Buffers_in_LuaTeX|Buffers]].
The introduction to LuaTeX boxes can be found in [https://www.overleaf.com/learn/latex/Articles/Pandora%E2%80%99s_%5Chbox:_Using_LuaTeX_to_Lift_the_Lid_of_TeX_Boxes|Pandora’s \hbox: Using LuaTeX to Lift the Lid of TeX Boxes].
LuaMetaTeX boxes serve the same purpose, but their properties are changed and extended. For the details see [http://distribution.contextgarden.net/current/context/latest/doc/context/documents/general/manuals/lowlevel-boxes.pdf Low Level TeX: Boxes] manual.
List of the commands to work with cached boxes:
<texcode>\{{cmd|putboxincache }} <tt>{category} {name} number</tt>\{{cmd|getboxfromcache }} <tt>{category} {name} number</tt> \{{cmd|doifelseboxincache }} <tt>{category} {name}</tt>\{{cmd|copyboxfromcache }} <tt>{category} {name} number</tt> \{{cmd|directboxfromcache }} <tt>{category} {name}</tt>\{{cmd|directcopyboxfromcache }} <tt>{category} {name}</tt> \{{cmd|resetboxesincache }} <tt>{category}</tt> \{{cmd|putnextboxincache }} <tt>{category} {name} box</tt>\{{cmd|getboxwdfromcache }} <tt>{category} {name}</tt> \{{cmd|getboxhtfromcache }} <tt>{category} {name}</tt>\{{cmd|getboxdpfromcache }} <tt>{category} {name}</texcodett
All these commands can be used on Lua side with the usual syntax <tt>context.<command>(<params>)</tt>
Boxed are stored in user defined '''categories''' (namespaces) and every box has its unique '''name''' inside its the category.
If the boxes are not to be cached for the subsequent runs, one needs to clear the category cache at the beginning of the document.
<texcode>
\resetboxesincache{category}
To cache that box the user can use either
<texcode>
\putboxincache ... [to test]{category}{name} 0% space is optional
</texcode>
or
</texcode>
=Tracing= One can trace the creation of cached boxes in log or console with
<texcode>
\enabletrackers[nodes.boxes]
</texcode>
 
To visualize boxes (hbox, vbox) in PDF use
<texcode>
\showmakeup[boxes]
</texcode>
 
Tracing in general is explained in [[Debugging]].
 
[[Category:ConTeXt]] [[Category:Basics]] [[Category:Boxes]]
138

edits

Navigation menu