Figure Guide for PhysicsLibrary
1 Purpose
TikZ is the preferred source format for many PhysicsLibrary diagrams because it produces figures whose
geometry, labels, arrows, colors, and mathematical notation can be edited reproducibly. It is particularly well
suited to coordinate-frame diagrams, Free-body diagrams, vector geometry, rotation sequences, signal-flow
diagrams, block diagrams, and other technical illustrations in which the meaning of every line and label
matters.
The recommended primary editor for PhysicsLibrary TikZ work is the TikZ online editor.
combined with TeXstudio.
TeXstudio: LaTeX made comfortable.
TikZ editor application allows for drag and drop of items and adjustment that is easy to work
with while TeXstudio integrates well with Pgfplots when you want to create scientific/technical
graphics.
The editor is part of the online PGF/TikZ documentation site and provides a convenient place to write,
inspect, and refine TikZ source while working in a browser. The main PGF/TikZ documentation is available at
tikz.dev.
2 Important current renderer limitation
Raw TikZ source should not presently be placed in a PhysicsLibrary article with the expectation
that the HTML renderer will draw it.
PhysicsLibrary now uses make4ht for html rendering by default but the legacy l2h/LaTeX2HTML rendering
path is still allowed for part of the site. At present, raw tikzpicture environments are not a dependable inline
rendering method in that pipeline. Direct TikZ rendering may become a future PhysicsLibrary feature to work
with legacy, but articles should currently use a rendered PNG image for the visible figure. So for legacy
l2h/LaTeX2HTML you will see a tikz notice to point you to other renders if it detects TikZ in the entry.
Note, it is not very smart detector so will be overly permissive if you pretty much just mention
tikz.
The recommended policy is therefore:
- create the figure in TikZ;
- keep the TikZ source as the editable master;
- render or export the finished figure as a PNG;
- upload the PNG to the PhysicsLibrary article;
- upload the corresponding TikZ .tex source in the article’s file box as a companion source file; and
- include only the PNG in the article body.
This preserves immediate renderer compatibility while also preserving the exact source needed to revise the
figure later.
3 Recommended workflow
3.1 Step 1: define the physical content before drawing
A technical figure should first answer a physics question, not a graphics question. Before editing TikZ, write
down what the diagram must communicate. Examples include:
- which frame is the reference frame and which frame is moving;
- whether the transformation is active or passive;
- whether a rotation axis is fixed or belongs to an intermediate moving frame;
- the positive rotation sense;
- which vectors or axes are unchanged by the operation;
- whether the drawing is geometrically exact or intentionally schematic; and
- which labels must correspond directly to equations in the article.
This step is especially important for Euler-angle, quaternion, rigid-body, and coordinate-transformation
figures. A visually attractive diagram with the wrong rotation sense is worse than no diagram.
3.2 Step 2: create the TikZ source in the main editor
Open https://tikz.dev/editor/ or edit on the web https://tikz.dev/editor/web/
and create the figure as a small standalone TikZ document. A useful starting template is:
\documentclass[tikz,border=8pt]{standalone}
\usepackage{amsmath,amssymb}
\usetikzlibrary{arrows.meta,calc,positioning}
\begin{document}
\begin{tikzpicture}[
>=Latex,
line cap=round,
line join=round
]
\end{tikzpicture}
\end{document}
The standalone class is convenient because the compiled output is tightly cropped around the figure. The
arrows.meta, calc, and positioning libraries cover many common PhysicsLibrary diagrams without requiring
an unnecessarily complicated preamble.
3.3 Step 3: use LaTeX notation inside the figure
Labels should normally be written as LaTeX mathematics rather than baked into an external drawing program.
For example:
\node at (2,1) {$x_A$};
\node at (3,2) {$+\theta$ about $y_1$};
This keeps mathematical notation consistent with the surrounding article and makes later symbol changes
straightforward.
For a PhysicsLibrary article that uses frame notation such as
use the same superscripts, subscripts, axis names, angle symbols, and sign conventions in the figure.
3.4 Step 4: refine the geometry and labeling
A good technical diagram should remain readable at article width. In particular:
- use one clearly identifiable origin for coordinate axes that share an origin;
- keep arrowheads away from text labels;
- do not let flow arrows pass through boxes;
- leave visible whitespace between titles, panel headings, arrows, and annotations;
- keep axis labels near the corresponding arrowheads;
- use line weights heavy enough to survive PNG conversion;
- prefer a white background for normal PhysicsLibrary figures; and
- avoid decorative elements that do not communicate physics.
For multi-panel figures, keep panel geometry and typography consistent. If the same axis survives from one
intermediate frame to the next, draw it in the same direction and location whenever the viewpoint allows
it.
3.5 Step 5: check the physics
Before exporting the figure, perform a convention check. For rotation figures, useful checks include:
- verify the right-hand rule;
- verify the direction from the original axis to the rotated axis;
- verify which axis is fixed by the rotation;
- verify active versus passive interpretation;
- verify the map direction used in the article;
- verify intrinsic versus extrinsic axis selection;
- verify that intermediate-frame labels are carried consistently between panels; and
- compare the picture against a simple 90∘ diagnostic case whenever possible.
For example, under the common PhysicsLibrary passive rotation convention
a positive physical frame rotation still follows the positive right-hand rule. The opposite sign appears in the
numerical coordinate map, not in the physical frame-rotation arrow. This distinction should be checked
explicitly when constructing axis-rotation figures.
3.6 Step 6: export or render a PNG
The finished TikZ source is the master version, but the PhysicsLibrary article should currently display a
PNG.
If you are working in TiKZ editor app simply go to File-¿Export-¿PNG. If using TexStudio you need to first
go to Options-¿Configure TeXstudio. Then go to the Build settings. Under User Commands add a command
(note the two blank spots, put each line into them).
user0:Compile Transparent PNG
txs:///pdflatex | pdftocairo -png -singlefile -transp -r 300 \href{https://physicslibrary.org/encyclopedia/LebesgueMeasure.html}{%.pdf} %
Then after building and viewing simply go to Tools-¿User-¿Compile Transparent PNG
The file will show up in the same folder as the latex source.
Use the browser editor’s available export workflow when suitable, or compile the same TikZ source in
another LaTeX environment and convert the resulting PDF to PNG.
A useful command-line workflow is:
pdflatex figure.tex
pdftocairo -png -singlefile figure.pdf figure
Another common conversion tool is pdftoppm. The exact conversion program is not important; what matters
is that the PNG is large enough to remain crisp at the width used by the article.
Do not use a screenshot of the editor as the production figure when a direct render is available. A direct
render preserves line quality, mathematical text, and consistent margins.
3.7 Step 7: use matching filenames
Use descriptive filenames and keep the PNG and TikZ source basename closely related. For example:
EA07_intrinsic_321_frame_chain.png
EA07_intrinsic_321_frame_chain_tikz.tex
This makes it immediately clear which source belongs to which rendered figure.
Avoid spaces in production filenames. Use letters, numbers, and underscores where practical.
3.8 Step 8: upload both files to PhysicsLibrary
Upload the PNG as the figure that the article will display. Also upload the TikZ .tex source in the article’s file
box so another editor can reproduce or modify the figure later.
The PNG and TikZ source should be treated as a pair:
-
PNG: renderer-compatible publication image;
-
TikZ source: editable and reproducible master.
If the figure is revised, update both files so that the uploaded source continues to reproduce the published
image.
4 Including the PNG in a PhysicsLibrary article
PhysicsLibrary currently recommends an explicit width for PNG and JPG figures. A renderer-friendly pattern
is:
\begin{center}
\includegraphics[width=0.85\textwidth,keepaspectratio]{your-image.png}
\vspace{0.5em}
{\small Figure 1. Short plain-text caption.}
\end{center}
Use a bare filename in \includegraphics. Do not put a local directory path such as /mnt/data/ or a
workstation-specific directory in PhysicsLibrary production source.
For example, use
\includegraphics[width=0.82\textwidth]{EA07_intrinsic_321_frame_chain.png}
rather than
\includegraphics[width=0.82\textwidth]{/some/local/path/EA07_intrinsic_321_frame_chain.png}
PhysicsLibrary’s current renderer is generally more reliable with a centered image and plain-text caption
than with a complicated floating figure environment. Avoid unnecessary \caption, \label, and \ref
machinery when a simple centered figure is sufficient.
5 Suggested visual conventions for physics diagrams
These are recommendations rather than strict site requirements, but consistent conventions make a series of
related figures easier to read.
5.1 Frames and colors
For diagrams involving several frames, a useful scheme is:
- original/reference frame: black;
- first intermediate frame: blue;
- second intermediate frame: green;
- final frame: red.
Do not rely on color alone. Every axis should still carry an explicit label such as xA, y1, z2, or
xB.
5.2 Positive rotation arrows
A curved angle arrow should point from the original axis toward the rotated axis for the positive physical frame
rotation being illustrated. A separate small loop around the actual rotation axis can be helpful when a
three-dimensional viewpoint makes the rotation plane difficult to see.
The loop must be drawn around the actual fixed or moving rotation axis, not merely near whichever axis is
most convenient in the two-dimensional projection.
5.3 Three-dimensional coordinate figures
TikZ drawings are ultimately projected onto a two-dimensional page. For a three-dimensional frame diagram,
there are two acceptable approaches.
Exact projected geometry. Compute the three-dimensional vectors from the actual rotation matrices and
project those vectors into the TikZ plane. Use this approach when the exact relative geometry is part of the
mathematical argument.
Conceptual schematic. Choose projected axis directions manually to make the moving-axis concept clear.
Use this approach when the figure is explicitly explanatory rather than quantitative. Even in a
schematic, the rotation sense, fixed axis, moving axis, and frame labels must still be physically
correct.
If exactness matters, do not independently hand-place axes that are supposed to be related by one rotation
angle. Compute them from the same rotation matrix first.
6 A small reusable TikZ example
The following source creates a simple passive-frame rotation sketch. It is intended as a starting pattern, not as a
universal convention diagram.
\documentclass[tikz,border=8pt]{standalone}
\usepackage{amsmath}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}[>=Latex,line cap=round]
\coordinate (O) at (0,0);
\draw[->,thick] (O) -- (3,0)
node[right] {$x_A$};
\draw[->,thick] (O) -- (0,3)
node[above] {$z_A$};
\draw[->,very thick,blue] (O) -- (2.3,1.7)
node[above right] {$x_B$};
\draw[->,blue,thick]
(1.25,0) arc[start angle=0,end angle=36,radius=1.25];
\node[blue] at (1.5,0.45) {$\lambda$};
\end{tikzpicture}
\end{document}
Compile this source, inspect the result, and then adapt the coordinate geometry to the physical problem
being illustrated.
7 Tools
7.1 Primary PhysicsLibrary TikZ editor
TikZ Editor at tikz.dev should be the first choice for creating and iterating ordinary PhysicsLibrary TikZ
figures. The surrounding PGF/TikZ online manual is also the primary syntax reference.
7.2 Overleaf
Overleaf is useful when a full LaTeX project, file management, collaboration, or repeated compilation is
needed. Its TikZ package guide contains introductory examples for lines, nodes, shapes, curves, and
diagrams.
7.3 TikzMaker
TikzMaker is a browser-based graphical editor that can be useful for constructing diagrams visually and
obtaining TikZ code. It can be particularly convenient for quick circuit, geometry, and diagram
layouts.
7.4 Local LaTeX tools
A local TeX installation is useful for final validation and batch rendering. Common choices include TeX Live
and MiKTeX. A local editor such as TeXstudio or Visual Studio Code with a LaTeX extension can be
convenient for larger figure collections.
Local compilation is especially useful when a figure depends on extra TikZ libraries or when a precise
PDF-to-PNG conversion is required.
8 Common mistakes
8.1 Putting raw TikZ in the article body
Do not assume that a tikzpicture pasted directly into a PhysicsLibrary object will render through
l2h/LaTeX2HTML. For current production use, render a PNG and include the image instead. Upload the TikZ
source separately in the article’s file box.
8.2 Uploading only the PNG
A PNG is easy to display but difficult to revise exactly. Upload the TikZ source too. The goal is for future
editors to be able to change an arrow, angle, label, color, or viewpoint without redrawing the figure from
scratch.
8.3 Uploading only the TikZ source
The source is valuable, but current readers still need the renderer-compatible PNG. Upload both.
8.4 Using a local path in the article
Do not write:
\includegraphics{/home/user/project/myfigure.png}
or any similar machine-specific path. Use the uploaded file’s bare filename.
8.5 Using arrows that visually contradict the equations
For frame rotations, verify that arrow direction represents the physical rotation intended by the article. Do not
reverse a physical right-hand-rule arrow merely because the associated passive coordinate matrix has the
opposite numerical sign from an active vector rotation.
8.6 Crowding labels and arrows
If labels touch arrowheads, axes overlap unrelated text, or arrows run through boxes, adjust the TikZ
coordinates before export. Renderer compatibility does not compensate for poor visual spacing.
9 Publication checklist
Before considering a TikZ-derived PhysicsLibrary figure complete, verify the following:
- The physics and sign conventions agree with the article.
- The visible PNG was rendered from the uploaded TikZ source.
- The PNG has a white or otherwise intentional background.
- Axis arrows and angle arrows point in the intended directions.
- Labels do not overlap arrows, boxes, or other labels.
- Mathematical notation matches the article.
- The figure remains readable when scaled to approximately 80–90 percent of the article text width.
- The PNG filename contains no local directory prefix in the article source.
- The PNG is uploaded to the article.
- The TikZ .tex source is uploaded in the article’s file box.
- The caption is concise and preferably plain text.
- The figure has been checked in the PhysicsLibrary preview before publication.
10 Summary
For current PhysicsLibrary production, TikZ should be treated as the editable source language for technical
diagrams and PNG as the renderer-compatible publication format. Create and refine the source primarily
with tikz.dev/editor, retain the source, render a clean PNG, upload both files, and include the PNG with a
simple renderer-friendly \includegraphics block.
This workflow gives PhysicsLibrary the immediate compatibility of ordinary images without sacrificing the
reproducibility and precision of source-controlled technical graphics.