Minimal TikZ standalone example
This example contains a simple TikZ graphic using the standalone
package, i.e. it will be exported to a PDF/DVI where the page just fits the content:
\documentclass[tikz, border=1mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw (0,0) node [draw=black] {My text};
\end{tikzpicture}
\end{document}
The result looks like this:
Assuming the file is named MyDiagram.tex
, you can compile it to PDF using
pdflatex MyDiagram.tex
Note that our example contains a 1mm
border by default since this seems to be more suitable for the average usecase than having no border at all. In order to change that, you just need to modify the first line, e.g.
\documentclass[tikz]{standalone} % No border
or
\documentclass[tikz]{standalone, border=5mm} % 5mm border