[Tex/LaTex] what is the origin point in a TikZ picture

tikz-pgf

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

Best Answer

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