Summary. Quick demo of how to make figures with TikZ in DocOnce.
is a useful tool for making figures in LaTeX, and DocOnce supports
these figures. If a figure file myfig
exists in a version
myfig.tikz
, DocOnce will, for latex
or pdflatex
output,
use the myfig.tikz
figure directly. The problem is what do to
with other output formats? In html
format one can use a
corresponding SVG version of the figure; for other formats, one
needs a plain PNG file. DocOnce will automatically create these figure
versions and store them with the myfig.tikz
figure, as is
done when other figure formats are automatically generated.
Figure 1: This shape is commonly referred to as a straight line.
The most fundamental shape is the line in Figure 1. See the
source code
for how this TikZ figure is defined in LaTeX as a file line.tikz
(and included in DocOnce through FIGURE: [line, width=500] caption
). Such
lines can be combined to form other shapes, e.g. a square. However, Figure 2
was created using the rectangle
TikZ command.
Figure 2: This square is formed by four straight lines.
A grid can also be easily made.
Figure 3: This is a grid with 5 x 5 cells
A circle, however, cannot be formed by a finite number of straight lines. It requires special code.
Figure 4: This circle is drawn in blue with a dashed line.
Figure 5: A maze can be drawn by combining rectangle elements.
Figure 6: TikZ is well suited to draw graphs.
TikZ can be used to plot functions. The next figure will be inlined.
See the source code for how you make this figure.
Figure 7: The functions can even be labeled!
All details are in the source code.