3

What determines the origin point when I draw a rectangle with TikZ? In the example below the x coordinate of the origin seems arbitrary...

\documentclass{article}
\usepackage[showframe, paperwidth=3.25in,paperheight=2in,margin=.5pt ]{geometry}
\usepackage{tikz}

\begin{document}

  \begin{tikzpicture}
    \draw (0,0) rectangle (1in, 1in);
  \end{tikzpicture}

\end{document}

enter image description here

4

There is not really any difference between your example and

\documentclass{article}
\usepackage[showframe, paperwidth=3.25in,paperheight=2in,margin=.5pt ]{geometry}
\usepackage{tikz}
\begin{document}
X
\end{document}

The tikzpicture is just seen as a big box, and is placed on the first line, indented with the standard paragraph indent, which \noindent removes. Add a letter right before or after the tikzpicture, and you'll see that the bottom of the tikzpicture is placed at the baseline, e.g.

\documentclass{article}
\usepackage[showframe, paperwidth=3.25in,paperheight=2.5in,margin=.5pt ]{geometry}
\usepackage{tikz}
\begin{document}
  \begin{tikzpicture}
    \draw (0,0) rectangle (1in, 1in);
  \end{tikzpicture}
Z

 \noindent\begin{tikzpicture}
    \draw (0,0) rectangle (1in, 1in);
  \end{tikzpicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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