Guide
Figures and tables
A LabTeX figure is usually code: a few lines of MathLab that draw a plot. It is drawn live while you write, typeset in the journal’s figure style, and exported as image files plus the code that made them.
MathLab figures
Press Figure in the toolbar. A figure appears with example code and its editor open; change the code and the plot is redrawn. Any MathLab function works — plot, surf, contourf, histogram, ode45 and the rest.
The caption is the text under the figure. Click the dashed “Click to write the figure caption…” line (or anywhere on the caption line) and type; when you press Done in the code editor of a figure without a caption, the cursor goes there for you. The number in front — “Figure 1:” or “Fig. 1.” — is added automatically.
\begin{figure}
\begin{mathlab}[aspect=0.55]
t = linspace(0, 20, 600);
for z = [0.05 0.2 0.5]
plot(t, exp(-z*t) .* cos(sqrt(1 - z^2)*t), 'LineWidth', 1.4, 'DisplayName', sprintf('ζ = %.2f', z))
hold on
end
hold off, legend show, grid on
xlabel('time t'), ylabel('x(t)')
\end{mathlab}
\caption{Free response for three damping ratios.}\label{fig:free}
\end{figure}- ‹/› Code (top right of the figure) opens and closes the code editor.
Ctrl/⌘ + Enterredraws at once. - Edit in MathLab ↗ opens the code in MathLab, with its console, workspace, debugger and help.
- Use a MathLab link… takes a MathLab share link (
/mathlab/#c=…) and puts its code in the figure — make a figure in MathLab, share it, paste it here. - Errors in the code are shown on the figure, with the line number.
Shape, width and time
- Shape sets the height as a fraction of the width (
aspect=0.62in the source). - Full width makes the figure span both columns in two-column layouts (
figure*). - t is the moment to show for animated scripts that use
animate(…)and the time variablet. - Ref. name is a short name for referring to the figure with Ref (
\ref); it is not printed. New figures getfig:1,fig:2, … which you can rename. It shows as a small ref: tag beside the figure while you point at it.
Figure styles
Figures follow the layout: the IEEE-like layout draws them with MathLab’s style('ieee') (Times, small type, colour-blind-safe lines), the journal layout with style('nature'), the others with style('paper'). Put a style(…) call in the code to choose another. See MathLab’s figure guide for the styles.
Images
Insert → Image figure takes the address of a PNG, JPG or SVG on the web. In the LaTeX export it becomes \includegraphics with the file name; put the file next to main.tex and it is included.
Placement
On the compiled pages figures and tables float like in LaTeX: when one does not fit in the rest of the column, the text carries on and the figure goes to the top of the next column or page. Full-width figures go to the top of the next page. In the LaTeX export figures get [tb] placement.
Tables
Press Table. Click a cell to type; Tab moves to the next cell and adds a row at the end. While the cursor is in the table, a toolbar under it adds and removes rows and columns, sets the header row, the column alignment (one letter per column: l, c, r), full width and the label. Cells can hold formulas, citations and references. Captions go above tables, as journals expect.
\begin{table}
\caption{Resonance properties of the driven oscillator}\label{tab:res}
\begin{tabular}{cccc}
\toprule
$\zeta$ & $r_\mathrm{peak}$ & peak $Xk/F_0$ & $Q$ \\
\midrule
0.1 & 0.990 & 5.03 & 5.0 \\
0.2 & 0.959 & 2.55 & 2.5 \\
0.4 & 0.825 & 1.36 & 1.25 \\
\bottomrule
\end{tabular}
\end{table}