Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm interested in drawing a logo with Tikz to embed either as a PDF or as a code snippet in other Tex documents. In order to do this, I'd like to draw the logo in a small PDF file, size 1 inch by 1 inch. I try the following code and curiously, it seems that geometry has additional parameters influencing the shape of the PDF. What must I "set to zero" so that drawing a 1inch diameter circle intersects all edges of the PDF as viewed?

\documentclass{slides}
\usepackage[paperwidth=1in, paperheight=1in, margin=0in]{geometry}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
    \draw (0.5, 0.5) circle (1);
\end{tikzpicture}
\end{document}
share|improve this question

2 Answers 2

up vote 8 down vote accepted

Rather use

\documentclass{standalone}

Then you don't even need the geometry package. It automatically sets the size of the 'canvas' to the size of the bounding box.


Edit by percusse: Still, for the fun of it, you can get rid of the \hoffset and also you should make sure that the line width is also taken into account. Lastly, you need to use in instead of the default cm for the units.

\documentclass{article}
\usepackage[paperwidth=1in, paperheight=1in, margin=0in]{geometry}
\usepackage{tikz}
\setlength\hoffset{0in}
\begin{document}
\noindent\tikz\draw (0.5in+0.5pt,0.5in) circle (0.5in-0.25pt);
\end{document}
share|improve this answer
1  
I've added a simple example. I hope you don't mind. –  percusse Jun 29 '12 at 22:54
    
@percusse: Sure, thanks! :) –  Count Zero Jun 29 '12 at 22:56
    
Thank you. Wasn't aware of the "standalone" doc class which was clearly what I should've been using. Interesting example with the use of hoffset and noindent additionally. –  ashkan Jun 30 '12 at 19:16

You can also get a tight vector image by using preview package as follow.

enter image description here

\documentclass{article}
\usepackage{pstricks}

\usepackage[active,tightpage]{preview}
\PreviewBorder=12pt% you can set it to 0pt if you don't need a border.
\PreviewEnvironment{pspicture}


\begin{document}
\psset{unit=1in}% one unit equals to 1 inch.
\begin{pspicture}[showgrid](1,1)
    \pscircle[fillstyle=solid,fillcolor=yellow,opacity=0.5](0.5,0.5){0.5}
\end{pspicture}
\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.