# TeXBody class

Namespace: [Grasshopper2.UI.Typography](https://developer.rhino3d.com/api/gh2/namespace/grasshopper2.ui.typography.md) · Assembly: [Grasshopper2](https://developer.rhino3d.com/api/gh2/assembly/grasshopper2.md)

```cs
public sealed class TeXBody
```

Implementation 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

- [TeXBody](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.typography.texbody/ctor.md): Create a new, empty text.

## Properties

- [Count](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.typography.texbody/count.md): Gets the number of elements in this text.
- [Elements](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.typography.texbody/elements.md): Enumerate over all elements.
- [WillBeginNewClause](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.typography.texbody/willbeginnewclause.md): 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.
- [WillBeginNewParagraph](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.typography.texbody/willbeginnewparagraph.md): Gets whether the next element to be appended will be the start of a new paragraph.

## Indexers

- [this[]](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.typography.texbody/item.md): Gets the specified TeX element. When indexed outside of the valid range, this method always returns a Box with zero width.

## Methods

- [Add](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.typography.texbody/add.md): Append a TeX element to this text.
- [AddPlainContent](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.typography.texbody/addplaincontent.md): 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.
- [AddRange](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.typography.texbody/addrange.md): Append a collection of TeX elements to this text.
- [AddTeXContent](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.typography.texbody/addtexcontent.md): 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.
- [AllBreaks](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.typography.texbody/allbreaks.md): Get all valid ways of breaking this body into lines.
- [BestBreak](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.typography.texbody/bestbreak.md): Gets the best way to break this body into lines.
- [CreateFromElements](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.typography.texbody/createfromelements.md): (static) Create a text directly from TeX elements.
- [EnsureParagraphEnding](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.typography.texbody/ensureparagraphending.md): Ensure that the current text validly terminates in a paragraph ending so it can be properly broken into lines.
