I would like to add a TikZ design element to a collection of documents. Presently, I accomplish this using a .sty file. More specifically, I build a style file, in this case called homework.sty, wherein I issue the package call \usepackage{tikz} and define the TikZ picture together with a call-command, \logo, that accepts a document title as its argument:
\usepackage{tikz}
\newcommand{\logo}[1]{%
\begin{tikzpicture}[scale=.5]
\draw [fill=gray!30] (0,0) rectangle (1,1);
\draw (.5,-.5) rectangle (1.5,.5);
\draw [fill=gray] (.5,0) rectangle (1,.5);
\node [right] at (2,.3) {\LARGE #1};
\end{tikzpicture}
}
When writing a homework sheet, I then invoke the homework package and apply the logo thusly:
\documentclass{article}
\usepackage{homework}
\begin{document}
\logo{Sine \& Cosine} % the title is different for each homework sheet
\end{document}
Of course, this protocol loads TikZ (and all of its bulk) for every homework sheet. My question is thus: can the same result be accomplished in a way less cumbersome to compilation? I've contemplated exporting the TikZ graphic to postscript and using includegraphics, but that appears to be a finicky routine (see Export eps figures from TikZ). Moreover, inclusion of postscript (in my experience) itself belabors compilation, and requires the image to be stored in every homework sheet folder...


standaloneto draw it, for example) and then save it and thestyfile containing the definition of\logocommand into a local tex folder so every user could load the package.standalonedocumentation, your recommendation seems promising. Would you mind explicitly demonstrating how to proceed with my MWE? – steven_nevets Feb 07 '15 at 20:39\logo{}doesn't vary at all? If not, why define the command to require one? – cfr Feb 07 '15 at 21:48\logo{}is the title of the document and is different for every homework sheet. Only the picture remains the same. – steven_nevets Feb 07 '15 at 22:15standalonemethod to produce the image, but then you would have to position the text over the image in your document. Obviously, if you include an argument when generating the PDF, that argument will be fixed. – cfr Feb 07 '15 at 22:19standalone, I would define a\logocommand (as in my MWE) to lay the title next to the image. However, I'm having trouble understanding how to usestandalonein conjunction with my existing style file. – steven_nevets Feb 07 '15 at 23:34\includegraphics{}. – cfr Feb 08 '15 at 00:11\logocommand to incorporate the\includegraphicsand title option, where would the pdf be kept? – steven_nevets Feb 08 '15 at 00:24$(kpsewhich -var TEXMFHOME)/tex/latex/images/logo.pdf(if you are using TeX Live on a Unix-like system). – cfr Feb 08 '15 at 00:46standalone, and incorporated it into a homework sheet using\usegraphicxand\includegraphics. It compiles using LaTeX->pdf but not LaTeX->DVI. Any suggestions? – steven_nevets Feb 09 '15 at 23:29