Das standalone Paket – Bilder und andere Dokumentteile separat TeXen

Über die CTAN News Liste bin ich auf das standalone Paket von Martin Scharrer gestoßen. Dieses Paket erlaubt es, Grafiken und andere Dokumentteile separat in externen, eigenständig kompilierbaren Dateien zu erstellen und trotzdem bei Bedarf in ein zentrales Dokument zu übernehmen. Dabei ist die jeweilige Seite, die generiert wird, nur so groß wie die Grafik selbst, manuelles Croppen kann man sich ersparen.

Hier eine kurze Anleitung:

Das Dokument, das einzubetten ist, wird in einer Instanz der standalone Klasse eingebettet. (Hinweis: Die Grafik stammt von http://www.texample.net/tikz/)

\documentclass[tikz]{standalone}
 
\begin{document}
\begin{tikzpicture}[scale=1.5]
    % Draw axes
    \draw [<->,thick] (0,2) node (yaxis) [above] {$y$}
        |- (3,0) node (xaxis) [right] {$x$};
    % Draw two intersecting lines
    \draw (0,0) coordinate (a_1) -- (2,1.8) coordinate (a_2);
    \draw (0,1.5) coordinate (b_1) -- (2.5,0) coordinate (b_2);
    % Calculate the intersection of the lines a_1 -- a_2 and b_1 -- b_2
    % and store the coordinate in c.
    \coordinate (c) at (intersection of a_1--a_2 and b_1--b_2);
    % Draw lines indicating intersection with y and x axis. Here we use
    % the perpendicular coordinate system
    \draw[dashed] (yaxis |- c) node[left] {$y'$}
        -| (xaxis -| c) node[below] {$x'$};
    % Draw a dot to indicate intersection point
    \fill[red] (c) circle (2pt);
\end{tikzpicture}
\end{document}

Das Hauptdokument lädt dann das standalone Paket und fügt die externe Datei mittels \input ein:

\documentclass{scrartcl}
\usepackage{standalone}
\usepackage{tikz}
\begin{document}
 
Hi, I'm the main document.
 
\input{subdoc1}
 
\end{document}

Mehr Informationen finden sich in der Anleitung auf CTAN: http://mirror.ctan.org/macros/latex/contrib/standalone.

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website