TeXBody
ReferencesImplementation of the TeX style glue-box-penalty model for a body of text, as outlined by Donald Knuth and Michael Plass in their seminal 1981 paper 'Breaking Paragraphs into Lines'. Append elements to this stream using the Add() methods and eventually break it into lines with the BestBreak() method.
Constructors
Properties
WillBeginNewClause
#Gets whether the next element to be appended will be the start of a new clause. This means the most recent element of type Box contains text ending in a clause terminator such as full stop, comma, or colon. Note that the first clause of a paragraph does not qualify as a new clause.
Indexers
Methods
AddPlainContent
#Parse and append text to this body. The text isn't interpreted in any way, only whitespace is replaced with the appropriate glue and penalties.
Parameters:
| text (string) | |
| font (Font) | |
| colour (Color) | |
| spacing (TeXSpacing = null) |
AddRange
#Append a collection of TeX elements to this text.
Parameters:
| elements (IEnumerable<ITeXElement>) |
AddTeXContent
#Parse and append TeX formatted content to this body. The text is interpreted using a subset of TeX macros: \emph{}, \code{}, \math{}, \sub{}, \super{}, \colour[name]{}, ...
Macro names are all lower case and are matched case-sensitively. An unrecognised macro renders as its own name, backslash included, in TeXStateMachine.InvalidColour, so that mistakes are visible rather than silently changing the formatting.
Parameters:
| text (string) | |
| fonts (TeXFonts) | |
| spacing (TeXSpacing = null) |
AllBreaks
#Get all valid ways of breaking this body into lines.
Parameters:
| settings (TeXLayout) | |
| demerits (TeXDemerits) | |
| token (CancellationToken) |
BestBreak
#Gets the best way to break this body into lines.
Parameters:
| settings (TeXLayout) | |
| demerits (TeXDemerits) | |
| token (CancellationToken) |
CreateFromElements
#Create a text directly from TeX elements.
Parameters:
| elements (IEnumerable<ITeXElement>) |
EnsureParagraphEnding
#public void EnsureParagraphEnding()
Ensure that the current text validly terminates in a paragraph ending so it can be properly broken into lines.