Ron Bakker/LabTeXHelp
← Back to LabTeX

Reference

Command reference

Every command and environment LabTeX understands — 88 entries in 12 topics. Each shows how to write it in the source, how to do the same in the Write view, and the typeset result.

Document and title block

The preamble: everything before \begin{document}. In the Write view you edit these in the title block and the Document panel.

\documentclass

\documentclass[layout]{labtex}

First line of every LabTeX file. The option picks the layout: article, ieee, journal, arxiv or report (see Layouts below). Exported .tex files use a standard LaTeX class instead.

In the editor: Layout menu in the top bar, or Document → Layout.

\documentclass[ieee]{labtex}

\title

\title{text}

The paper title. Formulas and formatting are allowed.

In the editor: Click the title on the sheet and type.

\title{Resonance in the Driven Oscillator}
Typesetting…

\author

\author[affiliations]{Name}

One author. The optional argument lists affiliation numbers, separated by commas; they appear as superscripts when there is more than one affiliation. Repeat for each author, in order.

In the editor: Click the author line, or Document → Authors.

\title{A Short Note}
\author[1,2]{Ada Lindqvist}
\author[2]{Mei Chen}
\affiliation[1]{Example University}
\affiliation[2]{Example Institute}
Typesetting…

\email

\author{Name}\email{address}

E-mail address of the author just before it. Shown under the affiliations; a footnote (\thanks) in the .tex export.

In the editor: Document → Authors → email.

\title{A Short Note}
\author{Ada Lindqvist}\email{ada@example.org}
Typesetting…

\affiliation

\affiliation[number]{text}

An institution, numbered so that authors can refer to it.

In the editor: Document → Affiliations.

\title{A Short Note}
\author[1]{Ada Lindqvist}
\affiliation[1]{Department of Physics, Example University}
Typesetting…

\date

\date{text}

Date line under the authors. Leave it out (or empty) for no date.

In the editor: Document → Date.

\title{A Short Note}
\date{October 2026}
Typesetting…

\keywords

\keywords{a, b, c}

Keywords after the abstract. The IEEE-like layout calls them Index Terms.

In the editor: Type in the Keywords line under the abstract.

\title{A Short Note}
\keywords{resonance, damping, oscillators}
Typesetting…

abstract

\begin{abstract} … \end{abstract}

The abstract. Each layout styles it differently: indented (article), bold run-in (IEEE), bold lead paragraph (journal), shaded summary (report).

In the editor: Click the abstract on the sheet and type.

\title{A Short Note}
\begin{abstract}
We show that two numbers describe every response of a damped oscillator.
\end{abstract}
Typesetting…

document

\begin{document} \maketitle … \end{document}

Wraps the body. \maketitle marks where the title block goes; LabTeX always puts it at the top.

\begin{document}
\maketitle
…
\end{document}

\newcommand

\newcommand{\name}[args]{definition}

Your own macro, usable in every formula and kept in the .tex export. #1, #2 … stand for arguments. \DeclareMathOperator{\op}{name} also works.

In the editor: Document → Macros.

\newcommand{\R}{\mathbb{R}}
\newcommand{\norm}[1]{\lVert #1 \rVert}

For $x \in \R^n$ the length is $\norm{x}$.
Typesetting…

Sections and paragraphs

Headings are numbered automatically in the style of the layout (1, 1.1 … or I, A … for IEEE).

\section

\section{Title}

A numbered section.

In the editor: Type “# ” at the start of an empty paragraph, or pick Section in the style menu.

\section{Introduction}
Oscillators are everywhere.
Typesetting…

\subsection

\subsection{Title}

A numbered subsection.

In the editor: Type “## ”, or pick Subsection.

\section{Theory}
\subsection{Free response}
Without forcing, the motion decays.
Typesetting…

\subsubsection

\subsubsection{Title}

Third heading level.

In the editor: Type “### ”, or pick Subsubsection.

\subsubsection{Light damping}
The envelope decays slowly.
Typesetting…

\section*

\section*{Title}

Unnumbered heading (same for subsection* and subsubsection*), e.g. for Acknowledgements.

In the editor: Block menu ⋮⋮ → Unnumbered.

\section*{Acknowledgements}
We thank the reviewers.
Typesetting…

paragraph

blank line

A blank line starts a new paragraph. Lines without a blank line between them join into one paragraph.

In the editor: Press Enter.

First paragraph, which goes on
over two source lines.

Second paragraph.
Typesetting…

\\

text \\ more text

Line break inside a paragraph (rarely needed).

In the editor: Shift + Enter.

First line\\ second line.
Typesetting…

\newpage

\newpage or \clearpage

Start a new page in the compiled pages and in LaTeX.

In the editor: Insert → Page break.

\newpage

%

% comment

Everything after % on a line is ignored. Write \% for a percent sign.

% TODO: add the measurements
Accuracy improved by 12\%.

Text formatting

Inline commands can be typed in the Write view too: finish \emph{…} or \textbf{…} with its closing brace and it turns into formatted text.

\emph

\emph{text}

Emphasis (italic). \textit{…} is the same.

In the editor: Ctrl/⌘ + I, or the I button.

This is \emph{important}.
Typesetting…

\textbf

\textbf{text}

Bold.

In the editor: Ctrl/⌘ + B.

This is \textbf{bold}.
Typesetting…

\texttt

\texttt{text}

Typewriter (monospaced) text, for code and file names.

In the editor: Ctrl/⌘ + E, or the tt button.

Run \texttt{latexmk -pdf main.tex}.
Typesetting…

\underline

\underline{text}

Underlined text.

An \underline{underlined} word.
Typesetting…

\textsc

\textsc{text}

Small capitals.

The \textsc{Hubble} telescope.
Typesetting…

\textsuperscript

\textsuperscript{text} \textsubscript{text}

Raised or lowered text outside math.

The 1\textsuperscript{st} and H\textsubscript{2}O.
Typesetting…

\href

\href{url}{text}

A link with its own text. Opens in a new tab in exported HTML; clickable in the PDF.

In the editor: Ctrl/⌘ + K, or the link button.

See the \href{https://ronbakker.com/mathlab/}{MathLab page}.
Typesetting…

\url

\url{address}

A link that shows the address itself.

Data: \url{https://example.org/data.csv}
Typesetting…

\footnote

text\footnote{note}

A numbered footnote. On the compiled pages it goes to the bottom of the page where it is cited.

In the editor: Note button (x¹), then type the note.

Two numbers suffice.\footnote{We use $\zeta$; some texts use $Q = 1/(2\zeta)$.}
Typesetting…

quotes, dashes

``quoted'' 1--2 word---word

TeX quotes and dashes: `` and '' give curly quotes, -- an en dash (ranges), --- an em dash. Typing the characters “ ” – — directly works too.

``Resonance'' appears in pages 12--14---and elsewhere.
Typesetting…

~

Fig.~\ref{fig:x}

A tie: a space where the line may not break. Use it before references and citations.

As shown in Figure~\ref{fig:a}.
Typesetting…

special characters

\% \& \# \_ \$ \{ \}

Characters that mean something in LaTeX need a backslash. In the Write view just type them; LabTeX escapes them for you.

Costs fell 40\% at R\&D \#3 (file \texttt{run\_2}).
Typesetting…

accents

\"o \'e \`a \^o \~n \c{c} \v{s}

Accented letters the TeX way, as found in BibTeX files. Typing é, ö, ñ directly works too.

G\"odel, Poincar\'e and Gau\ss.
Typesetting…

\LaTeX

\LaTeX \TeX \LabTeX

The logos.

Written in \LabTeX, exported to \LaTeX.
Typesetting…

\ldots

\ldots

Ellipsis (…).

One, two, \ldots
Typesetting…

Lists

itemize

\begin{itemize} \item … \end{itemize}

A bulleted list. Each \item is one point.

In the editor: Type “- ” at the start of a paragraph. Enter on an empty item ends the list.

\begin{itemize}
  \item closed-form solutions;
  \item two live figures;
  \item a table of results.
\end{itemize}
Typesetting…

enumerate

\begin{enumerate} \item … \end{enumerate}

A numbered list.

In the editor: Type “1. ” at the start of a paragraph.

\begin{enumerate}
  \item Measure the period.
  \item Fit the decay.
\end{enumerate}
Typesetting…

description

\begin{description} \item[term] … \end{description}

Read as a bulleted list with the term in bold.

\begin{description}
  \item[Damping] loss of energy per cycle.
\end{description}
Typesetting…

Formulas

Formulas are rendered by KaTeX, which follows TeX’s own layout rules and fonts, so they look as they will in the PDF. KaTeX supports nearly all of amsmath; see katex.org/docs/supported for the full list of symbols.

$ … $

$formula$ or \( formula \)

A formula inside the text.

In the editor: Type $x^2$ — it turns into a formula when you type the closing $. Or Ctrl/⌘ + M for the formula editor: build it visually (/ fraction, ^ power, _ index, Tab next box) or pick from the palette. Click a formula to edit it.

The energy $E = \tfrac12 kx^2$ is stored in the spring.
Typesetting…

equation

\begin{equation}\label{eq:name} … \end{equation}

A numbered display equation. Numbers follow the order in the paper; \label gives it a name for \eqref.

In the editor: Equation button (∑), Ctrl/⌘ + Shift + M, or type $$ and Enter on an empty line. Click it to edit it visually, with the palette, or as LaTeX.

\begin{equation}\label{eq:motion}
  m\ddot{x} + c\dot{x} + kx = F_0 \cos(\omega t)
\end{equation}
Typesetting…

equation*

\begin{equation*} … \end{equation*} or \[ … \]

A display equation without a number.

In the editor: Untick Numbered in the equation editor.

\[
  Q \approx \frac{1}{2\zeta}
\]
Typesetting…

multi-line

a &= b \\ c &= d

Inside an equation, \\ breaks the line and & marks where the lines align. LabTeX wraps the lines in an aligned block with one number, as amsmath does.

In the editor: + Line in the formula editor, or Shift + Enter.

\begin{equation}
  \frac{Xk}{F_0} &= \frac{1}{\sqrt{(1-r^2)^2 + (2\zeta r)^2}} \\
  \tan\varphi &= \frac{2\zeta r}{1-r^2}
\end{equation}
Typesetting…

align

\begin{align} … \end{align}

amsmath’s align, gather and multline (and their * forms) are understood too and exported unchanged.

\begin{align*}
  (a+b)^2 &= a^2 + 2ab + b^2
\end{align*}
Typesetting…

matrices, cases

\begin{pmatrix} … \end{pmatrix} \begin{cases} … \end{cases}

Matrices (pmatrix, bmatrix, vmatrix) and piecewise definitions work inside any formula.

\[
  A = \begin{pmatrix} 0 & 1 \\ -\omega_0^2 & -2\zeta\omega_0 \end{pmatrix}, \quad
  u(x) = \begin{cases} 1 & x > 0 \\ 0 & \text{otherwise} \end{cases}
\]
Typesetting…

common symbols

\frac \sqrt \sum \int \partial \nabla \infty \mathbb \mathrm \vec \hat

Fractions, roots, sums, integrals, derivatives, blackboard bold (\mathbb{R}), upright text (\mathrm{d}x), vectors and hats — everything standard LaTeX math has.

$\int_0^\infty e^{-x^2}\,\mathrm{d}x = \tfrac{\sqrt{\pi}}{2}$ and $\nabla\cdot\vec{E} = \rho/\varepsilon_0$.
Typesetting…

Labels and cross-references

Labels give sections, equations, figures and tables a name; references print their number, which updates when things move. Use prefixes such as sec:, eq:, fig: and tab: to keep labels readable.

\label

\label{name}

Name the section, equation, figure or table it is in (or just after). Equations, figures and tables get a label automatically when you insert them.

In the editor: Ref. name field in the equation, figure or table editor; for sections, the block menu ⋮⋮ → Add a label. Shown as a small “ref:” tag beside the block while you point at it; never printed.

\section{Method}\label{sec:method}
See Section~\ref{sec:method}.
Typesetting…

\ref

\ref{name}

The number of what the label names: 2, 3.1, II-A, IV …

In the editor: Ref button (§), then pick from the list of labels.

\begin{table}
\caption{Results}\label{tab:res}
\begin{tabular}{cc}
a & b \\
\end{tabular}
\end{table}
Table~\ref{tab:res} lists the results.
Typesetting…

\eqref

\eqref{eq:name}

An equation number in parentheses: (2).

\begin{equation}\label{eq:e}
E = mc^2
\end{equation}
From \eqref{eq:e} the energy follows.
Typesetting…

\autoref

\autoref{name} \cref{name}

The number with its name in front: Figure 2, Section 3, Eq. (4).

\section{Results}\label{sec:res}
As \autoref{sec:res} shows …
Typesetting…

Citations and bibliography

References live in a BibTeX library inside the document. Only cited entries appear in the reference list, numbered or sorted by the layout’s citation style. Unknown keys are shown in red as [?].

\cite

\cite{key} \cite{key1,key2}

Cite one or more references: [1], [2–4] in numbered layouts, a superscript in the journal layout, (Author, 2020) in the arXiv layout.

In the editor: Cite button ([1]) or Ctrl/⌘ + Shift + C, then tick entries; or type \cite{key}. Click a citation to change it.

Oscillators are everywhere \cite{goldstein2002}.

\begin{filecontents*}{refs.bib}
@book{goldstein2002,
  author = {Herbert Goldstein and Charles Poole and John Safko},
  title = {Classical Mechanics}, publisher = {Addison-Wesley}, year = {2002}, edition = {3}
}
\end{filecontents*}
Typesetting…

\citep

\citep{key}

Parenthetical citation: (Strogatz, 2015) in author–year layouts; same as \cite in numbered ones.

Phase portraits help \citep{strogatz2015}.

\begin{filecontents*}{refs.bib}
@book{strogatz2015, author = {Steven H. Strogatz}, title = {Nonlinear Dynamics and Chaos}, publisher = {Westview Press}, year = {2015}}
\end{filecontents*}
Typesetting…

\citet

\citet{key}

Textual citation, the author as part of the sentence: Strogatz (2015), or Strogatz [1] in numbered layouts.

\citet{strogatz2015} gives a geometric view.

\begin{filecontents*}{refs.bib}
@book{strogatz2015, author = {Steven H. Strogatz}, title = {Nonlinear Dynamics and Chaos}, publisher = {Westview Press}, year = {2015}}
\end{filecontents*}
Typesetting…

\cite[note]

\cite[p.~42]{key}

Adds a page, chapter or other note to the citation: [1, p. 42].

In the editor: The note field in the cite picker.

See \cite[ch.~3]{strogatz2015}.

\begin{filecontents*}{refs.bib}
@book{strogatz2015, author = {Steven H. Strogatz}, title = {Nonlinear Dynamics and Chaos}, publisher = {Westview Press}, year = {2015}}
\end{filecontents*}
Typesetting…

\nocite

\nocite{key} \nocite{*}

List a reference without citing it in the text; \nocite{*} lists the whole library.

\nocite{*}

filecontents*

\begin{filecontents*}[overwrite]{refs.bib} … \end{filecontents*}

The BibTeX library, kept inside the document. LaTeX writes it out as refs.bib when it compiles, so the .tex file is self-contained.

In the editor: References panel: paste BibTeX, look up a DOI, or import a .bib file.

\begin{filecontents*}[overwrite]{refs.bib}
@article{harris2020,
  author  = {Charles R. Harris and K. Jarrod Millman and others},
  title   = {Array programming with {NumPy}},
  journal = {Nature}, volume = {585}, pages = {357--362}, year = {2020},
  doi     = {10.1038/s41586-020-2649-2}
}
\end{filecontents*}

BibTeX entries

@article @book @inproceedings @misc @phdthesis @techreport

Entry types LabTeX formats. Fields used: author (names joined with “and”; “and others” gives et al.), title, journal or booktitle, publisher, school, institution, year, volume, number, pages, edition, doi, eprint (arXiv id), url, note. Protect capitals in titles with braces: {NumPy}.

@inproceedings{key,
  author    = {Last, First and Other, Second},
  title     = {Title with {DNA} in capitals},
  booktitle = {Proceedings of the Conference},
  pages     = {1--10},
  year      = {2024}
}

\bibliography

\bibliography{refs}

Where the reference list goes: always at the end. The style comes from the layout: IEEE-like, Nature-like or author–year.

\bibliography{refs}

thebibliography

\begin{thebibliography}{9} \bibitem{key} text … \end{thebibliography}

Hand-written reference lists from older papers are imported as library entries whose text is used as is.

\begin{thebibliography}{9}
\bibitem{knuth} D. E. Knuth, \emph{The \TeX book}, 1984.
\end{thebibliography}

Figures

A MathLab figure is code that draws a plot, run live in the browser. It is redrawn whenever the code changes, uses the layout’s figure style (fonts and sizes for IEEE, Nature …), and is exported as PNG, SVG and code.

figure

\begin{figure} … \caption{…}\label{fig:name} \end{figure}

A numbered figure with a caption. On the compiled pages it floats like in LaTeX: if it does not fit where it is, the text continues and the figure goes to the next column or page.

In the editor: Figure button, or Insert → MathLab figure.

\begin{figure}
  \begin{mathlab}[aspect=0.5]
    x = linspace(0, 4*pi, 300);
    plot(x, sin(x) .* exp(-x/6), 'LineWidth', 1.5)
    xlabel('t'), grid on
  \end{mathlab}
  \caption{A damped oscillation.}\label{fig:damped}
\end{figure}
Typesetting…

mathlab

\begin{mathlab}[aspect=0.62, t=0] code \end{mathlab}

MathLab code inside a figure. aspect is height ÷ width (0.3–1.2); t is the time for animated scripts (animate(…)). Any MathLab function works — plot, surf, contourf, histogram, ode45 … — see the MathLab function reference.

In the editor: Click ‹/› Code on the figure. “Edit in MathLab ↗” opens the code in MathLab; “Use a MathLab link…” pastes in a share link.

\begin{figure}
  \begin{mathlab}[aspect=0.6]
    [X, Y] = meshgrid(linspace(-2, 2, 40));
    surf(X, Y, exp(-X.^2 - Y.^2))
    colormap viridis
  \end{mathlab}
  \caption{A Gaussian bump.}
\end{figure}
Typesetting…

figure*

\begin{figure*} … \end{figure*}

In two-column layouts: a figure across both columns, placed at the top of the next page (as in LaTeX).

In the editor: Tick Full width in the figure editor.

\begin{figure*}
  \begin{mathlab}[aspect=0.3] … \end{mathlab}
  \caption{Wide figure.}
\end{figure*}

\includegraphics

\includegraphics[width=\linewidth]{url}

An image figure from a web address (PNG, JPG or SVG). In the .tex export it is included if a file with the same name sits next to main.tex.

In the editor: Insert → Image figure, then paste the address.

\begin{figure}
  \includegraphics[width=\linewidth]{https://example.org/photo.jpg}
  \caption{A photograph.}
\end{figure}

\caption

\caption{text}

The caption. Numbered “Figure 1:” or “Fig. 1.” depending on the layout. Formulas, citations and references are allowed.

In the editor: Click under the figure and type.

\caption{Response for $\zeta = 0.1$, as in \eqref{eq:amp}.}

style()

style('ieee') in the MathLab code

Figures follow the layout automatically (ieee, nature or paper style). Put your own style(…) call in the code to override it.

style('paper')
plot(1:10, (1:10).^2)

Tables

table

\begin{table} \caption{…}\label{tab:name} \begin{tabular}{lcr} … \end{tabular} \end{table}

A numbered table with its caption above it (TABLE I in the IEEE layout). Rules are drawn in the booktabs style.

In the editor: Table button. Tab moves to the next cell (and adds a row at the end); the table toolbar adds and removes rows and columns.

\begin{table}
  \caption{Resonance properties}\label{tab:res}
  \begin{tabular}{ccc}
    \toprule
    $\zeta$ & $r_\mathrm{peak}$ & $Q$ \\
    \midrule
    0.1 & 0.990 & 5.0 \\
    0.2 & 0.959 & 2.5 \\
    \bottomrule
  \end{tabular}
\end{table}
Typesetting…

tabular

\begin{tabular}{columns} a & b \\ … \end{tabular}

The grid: one letter per column — l (left), c (centre), r (right). & separates cells, \\ ends a row.

In the editor: Align field in the table toolbar.

\begin{tabular}{lr}
  Name & Value \\
  Mass & 2.0 \\
\end{tabular}

rules

\toprule \midrule \bottomrule (or \hline)

A rule after the first row makes it the header row. Top and bottom rules are always drawn.

In the editor: Header row checkbox.

\toprule
A & B \\
\midrule

table*

\begin{table*} … \end{table*}

A table across both columns in two-column layouts.

In the editor: Full width checkbox.

\begin{table*} … \end{table*}

Code and raw LaTeX

verbatim

\begin{verbatim} … \end{verbatim}

Code or text shown exactly as typed, in a monospaced font. lstlisting and minted blocks are read the same way.

In the editor: Insert → Code listing, or type ``` and Enter.

\begin{verbatim}
for k = 1:10
  disp(k)
end
\end{verbatim}
Typesetting…

raw LaTeX

any other environment

Environments LabTeX does not know (tikzpicture, algorithm, theorem …) are kept as raw LaTeX blocks: shown as source in the editor, left out of the compiled pages, and exported to .tex unchanged.

In the editor: Insert → Raw LaTeX.

\begin{theorem}
Every bounded monotone sequence converges.
\end{theorem}

unknown commands

\anycommand{…}

Inline commands LabTeX does not know are kept as small purple LaTeX chips and exported unchanged.

Units: \SI{9.81}{m/s^2}.
Typesetting…

Layouts

The option of \documentclass. Changing the layout re-typesets the whole paper; nothing in your text changes.

article

\documentclass[article]{labtex}

Single column on A4, 11 pt, like LaTeX’s article class. Numbered citations [1], sections 1, 1.1.

\documentclass[article]{labtex}

ieee

\documentclass[ieee]{labtex}

Two columns on US Letter, 10 pt, IEEE-like: roman section numbers (I. INTRODUCTION), “Abstract—” and “Index Terms—”, Fig. 1., TABLE I, IEEE reference style.

\documentclass[ieee]{labtex}

journal

\documentclass[journal]{labtex}

Nature-like journal article on A4: two columns, sans-serif headings without numbers, a bold lead abstract, superscript citations and Nature reference style.

\documentclass[journal]{labtex}

arxiv

\documentclass[arxiv]{labtex}

Preprint on US Letter: single 5.5-inch column, title between rules, author–year citations (natbib style) and an alphabetical reference list.

\documentclass[arxiv]{labtex}

report

\documentclass[report]{labtex}

Letter or report on A4: wide margins, sans-serif headings, left-aligned title block and a shaded summary.

\documentclass[report]{labtex}

Keyboard and typing shortcuts

Ctrl on Windows and Linux, ⌘ on a Mac.

/

/ on an empty line

Opens the block menu: section, list, equation, figure, table, code, raw LaTeX, page break.

# ## ###

# + space

At the start of a paragraph: turn it into a section, subsection or subsubsection.

- 1.

- + space 1. + space

Start a bulleted or numbered list.

$$ ↵

$$ then Enter

Turn an empty line into a display equation. ``` then Enter makes a code block.

Ctrl/⌘ + M

Ctrl/⌘ + M (+ Shift)

Inline formula; with Shift, a display equation.

Ctrl/⌘ + B, I, E, K

B I E K

Bold, emphasis, typewriter, link.

Ctrl/⌘ + Shift + C

Ctrl/⌘ + Shift + C

Cite.

Ctrl/⌘ + Z

Ctrl/⌘ + Z Ctrl/⌘ + Shift + Z

Undo and redo, across blocks.

Ctrl/⌘ + 1, 2, 3

1 2 3

Switch to Write, Pages or Source.

Ctrl/⌘ + S

Ctrl/⌘ + S (+ Shift: Save as)

Save as a .labtex file on your computer; in Chrome and Edge later changes then save to that file automatically. Drafts are also kept in the browser.

Ctrl/⌘ + O

Ctrl/⌘ + O

Open a .labtex, .tex or .bib file (or drop one onto the window).

Ctrl/⌘ + P

Ctrl/⌘ + P

Compile and open the print dialog: choose “Save as PDF”.

Ctrl/⌘ + Enter

in an equation or figure editor

Close the equation editor; re-run the figure code.

Backspace

at the start of a block

Joins a paragraph with the one above; turns a heading or list item back into a paragraph.