LaTeX texts and font texts

A formula is mathematics. A text is words: a title, a caption, a note, with some mathematics inside it if you want. The editor has two kinds of text, and one place to write both: the composition editor.

A title written in LaTeX, with its maths coloured glyph by glyph, writes in above a formula.

Two kinds of text

LaTeX textFont text
You writeLaTeX in text mode: $x^2$ for maths, \\ for a line break, a blank line for a paragraph.Plain text in any font. Enter adds a line.
Marked in the Creator byTP
Drawn byLaTeX, when the companion runs; MathJax otherwise.Pango, when the companion runs. Without it, as placeholder boxes.
Its form hasSize, colour, width, alignment, line spacing, name, tag and Appears with.Font family, size, bold, italic and colour.
Glyph colours in the editorIn the Glyphs view: each glyph coloured or hidden at the start.One colour for the whole text.

Use a LaTeX text when the words have mathematics in them, or when you want the look of LaTeX. Use a font text for a typeface that LaTeX does not have.

Making a text

The + New button of the Creator makes a formula. Its arrow lists every kind of object: Formula, Text (LaTeX) and Text (font). Choose one of the texts and the composition editor opens.

The Creator’s New menu, opened from the arrow of the + New button, with Formula, Text (LaTeX) and Text (font).
The arrow of + New lists the kinds of object; the ring (1) is on Text (LaTeX).

Nothing is added to the Creator until you press Apply. Cancel leaves nothing behind.

The composition editor

The editor is a dialog with a form on the left and a stage on the right: the video frame, in which the text is drawn and placed. It is the same for both kinds, with the fields of each kind in the form.

Maximise the dialog, or drag its corner, and it gives its room to the stage, which stays whole at the frame’s aspect ratio, and to the text field.

Writing a LaTeX text

Type in the Text field. The text is in LaTeX’s text mode: ordinary words, with $…$ around a piece of mathematics, \\ to break a line, and a blank line to start a paragraph. Ctrl+Enter applies from the keyboard.

The stage draws the text a moment after you stop typing. The line over the stage says how many glyphs it has and who drew them: 41 glyphs · MathJax in the browser alone, 41 glyphs · exact (LaTeX) when the companion typesets it.

A LaTeX text typed, with a piece of maths in it, and then dragged on the stage.

Size and colour

Size is one number written twice: the Scale and Manim’s Font size, with the scale times 48 equal to the font size, so 1.5 × 48 = 72. Type either, or a fraction such as 3/2 for the scale. Colour is a hexadecimal colour for the whole text.

Layout

The layout decides how the lines of the text sit in a block.

The same paragraph, 4 units wide, with its lines aligned left, centred and right.

The text as an object

The Object group holds what the text is in the Creator: its Name (a name already in use is refused when you leave the field), its Tag (a colour and a short icon) and Appears with, the intro its new clips start with. A clip that still has the previous intro follows when you change it.

The stage and the position

Drag the text on the stage to place it. Two boxes above the stage help: Grid draws a grid, whose spacing you choose from 2 down to 0.1 units, and Snap makes the text stick to the lines of the frame. The text snaps to the grid as well. Hold Ctrl while you drag to move without snapping. The arrow keys, with the stage focused, move the text by 0.1 units, and with Shift by 1.

Under the stage, X and Y give the position in scene units, and Center horizontally and Center vertically bring the text to the middle of the frame along one axis.

Fit frame, the zoom and the pan change what you see of the stage without changing where the text is placed. Zoom with − and + or with Ctrl and the wheel (or with a pinch on the trackpad), and pan with the middle button or with Alt held while you drag.

New clips start here

A text opened from the Creator is a library object: no clip is being edited, so the stage places nothing on the timeline. It shows where the new clips of the text will start. The box New clips start here is ticked whenever the editor opens. With it ticked, Apply keeps the position in the text: every clip of it that you drop on the timeline or add from a menu afterwards starts there instead of at the centre of the frame. Clips already on the timeline stay where they are.

Untick the box and the position is only somewhere to look at the text: it is not saved, and the text keeps the start position it already had. To start at the centre again, set X and Y to 0, or press both centre buttons, and apply.

The position of a clip itself belongs to that clip. Moving one clip does not move the others, and it does not change where the text’s next clip starts.

The status line, the dot and the strip

The dot beside the line over the stage tells what the render of your draft is doing:

While you type, the words beside the dot stay as they are and the stage does not move: only the dot changes. What the renderer says goes into a strip under the stage, of a fixed height, scrolled when it is long: the error LaTeX gave with its log, warnings such as approximate line breaks, or the fontenc line that accented letters need, and the reason Apply waits, if it does.

The stage side of the composition editor with a LaTeX text that does not compile: a red dot and Cannot render over the stage, which keeps the last text that did render, and the error under it.
A text that does not compile: a red dot, and the error under the stage. The stage keeps the last appearance that rendered, and the centre buttons wait for a text that renders.

Glyph colours

For a LaTeX text, the switch over the stage shows Glyphs in place of Placement: the glyphs of the draft, to colour or to hide at the start, as in the formula editor. Click a glyph, Shift+click for a range, Ctrl+click to add or remove one, or drag a box over several; then press a colour. Clear colours takes them away, and Hide, Show and Show all set which glyphs are hidden at the start.

What you colour stays with its glyphs while you go on typing or change the layout. Apply writes the colours with the text, and carries along the pairs, blocks and attachments that name glyphs of the text. Colours need a text that renders: while it does not, Apply waits, and a line says why. Where a change cannot be followed glyph by glyph, the view says so, and the text keeps the colours it had. See Colouring glyphs and objects for the other ways to colour.

Apply, Cancel and Add to the timeline

Apply makes the text an object of the Creator, or updates the one you opened, as a single undo step: its text, its layout, its colours and its position go back with one Ctrl+Z. Cancel throws the draft away. A click outside the dialog does neither: it stays open.

Everything you type or place stays in a draft until Apply. While the editor is open, playback pauses and does not start again by itself, and Save, Open and Export wait: apply or cancel first, then run the command again. If the tab closes with a draft unapplied, the editor offers Recover unapplied draft the next time you open that text.

Apply puts nothing on the timeline: the text is in the Creator, ready to use. The line at the left of the footer says so for a new text: New library object · no clip will be added. Putting a clip on the timeline is a separate step, with the text selected in the Creator.

The Creator listing a LaTeX text marked T, a formula, and a font text marked P with the badge needs the companion.
The Creator after Apply: the LaTeX text (T), a formula, and a font text (P), drawn as placeholder boxes, with the badge that says it needs the companion.
The Creator with the menu of a text’s card open: Edit, Add to the timeline, Apply match colors, Duplicate and Delete.
The menu of a card in the Creator.
The Animations panel with a text selected that no clip uses: a note that says it is not on the timeline yet, and the button Add to the timeline.
The Animations panel, with a text that no clip uses selected. It calls every object of the Creator a “formula”.

Editing a text again

Open a text that exists in any of four ways: double-click its card in the Creator, double-click its clip on the timeline, double-click the text itself in the Preview, or select two or more clips of it, right-click and choose Edit….

What the stage places depends on where you came from. From the Creator, or from several selected clips, the text is a library object, with New clips start here. From one clip or from the Preview, the stage places that clip, and the box is not there. The line under the stage says Placement: clip initial state. Changes apply only to this occurrence.

The foot of the composition editor opened from a clip: X and Y, the two centre buttons, the line Placement: clip initial state, and Apply.
Opened from its clip, the editor places that clip: there is no New clips start here box.

The text itself, with its layout and its colours, is shared by every clip that uses it. Change it and every clip changes, the position of each clip aside. When a text has more than one use and you opened it from a clip, Make independent on Apply gives that clip a copy of the text of its own, and Apply changes only the copy.

Font text

A Text (font) is plain text in a typeface you name. Its form has the Font family, the Size (the font size, from 4 to 512), Bold, Italic and the Colour of the whole text. The stage and its controls are the same as for a LaTeX text.

A font text needs the companion to be drawn with its real glyphs. The companion shapes the text with Pango, in the fonts of your machine, and proposes the families it has as you type the name. In version 1.0 it does this on Linux only: on macOS and Windows a font text stays as boxes. Without it, a font text is drawn as placeholder boxes: one box for each character, laid out with the font the browser has under that name. The badge needs the companion says so, in the editor and in the Creator.

The composition editor with a font text drawn as placeholder boxes, with the badge needs the companion, and a note under the stage that says what to start.
A font text without the companion: a placeholder box for each character, the badge, and the note under the stage.
The same kind of text in a scene, as the editor draws it without the companion: a placeholder box for each character.

A font text drawn as boxes still works like any other object. You can compose it, place it, colour it, give it an intro and animate it. The project saves, opens and exports. Export ▸ Python — ManimCE… (or Python — ManimGL…) writes the text and counts its glyphs one for each character, and says so. A video exported in the browser shows the boxes, as the Preview does.

When the companion shapes the text, its real glyphs take the place of the boxes and keep what you did to them. The shape it found is saved in the project, so a project with font text opens with its real appearance even on a machine without the fonts or the companion. Refresh appearance accepts a new shape on purpose, after you change fonts or versions: reconnecting the companion never replaces a saved shape by itself.

What the export writes

A LaTeX text is exported as a Tex object. Its width becomes a \parbox, and its alignment \centering, \raggedright or \raggedleft:

title = Tex(r"\parbox{120.45pt}{\centering Completing the square starts from $x^2 + bx + c$\par}", font_size=72)

The glyphs are matched to the editor’s by position, as for every formula. The generated Python explains how.

A font text is exported as a Manim Text, with the family, the size, the weight and the slant you chose. Right after it the file checks the text: if Manim draws it with a different number of glyphs than the editor counted, because fonts or versions differ, it prints a warning on stderr and renders the scene all the same.

caption = Text(r"Any font on your machine", font=r"DejaVu Sans", font_size=96, weight=r"BOLD", slant=r"NORMAL", disable_ligatures=False)
_mfe_verify_text(caption, r"caption", "ce", 20)

A font text is shaped for the Manim library the project targets. An export for the other library writes the same text at a converted size, and says what may differ: the size by a few percent, the spacing of lines and tabs.

The export never waits for the companion over a text. It lists the texts the editor cannot vouch for, because there is no companion to compare the fonts of this machine with, and goes on.

Where to go next