2

It seems like the location of the origin depends on the dimensions of the pictures I am drawing. Is it possible to fix the location of the origin yourself, or otherwise to manipulate the location of the whole tikz box in some way?

Minimal Example

For example:

\documentclass{book}
\usepackage{tikz}
\usepackage{amsmath}

\begin{document}
\begin{tikzpicture}
\draw (0, 0) -- (-2, 0);
\end{tikzpicture}

\end{document}

The origin in this picture seems not too far from the left of the page. However, changing the line above to

\draw (0, 0) -- (-10, 0);

shifts the origin to the right.

Ovi
  • 527
  • 1
    It is possible to define a bounding box which, depending on how it is defined, will place the origin at a specific point in that bounding box. – AndréC Jul 12 '19 at 19:10
  • 2
    I am not sure what you are getting at. A MWE that illustrates the problem would really help. – Peter Grill Jul 12 '19 at 19:31
  • @PeterGrill I have added a MWE. – Ovi Jul 12 '19 at 20:43
  • TikZ always establishes its bounding box on the basis of the content of the picture. That's what you are seeing here. See e.g. here for one of the many related questions. –  Jul 12 '19 at 20:46
  • I think what you are looking for is a \noindent before \begin{tikzpicture}. If you include \usepackage{show frame} you see that with the \noindent the picture is all the way to the left. – Peter Grill Jul 12 '19 at 20:46
  • @Ovi You seem to think that (0,0) should be a point defined by a fixed offset from the paper edges or page margins, but this is not how it works. For this kind of positioning, read Referencing the Current Page Node – Absolute Positioning in the TikZ & PGF Manual. For normal positioning, the bounding box is essential; read section Creating a Picture Using an Environment or the link marmot gave, or that one for instance. – frougon Jul 12 '19 at 22:11
  • Thank you all for the information, I will get reading. – Ovi Jul 12 '19 at 23:14
  • @frougon Would you like to add an answer? – CarLaTeX Aug 22 '19 at 19:33
  • @CarLaTeX Thanks, but not really. My opinion is that at this point, either the OP has read the information (the links I gave explain it in detail) or he or she is not motivated to get it. Feel free to write an answer if you are motivated enough, though... – frougon Aug 22 '19 at 21:11
  • @frougon I'm asking only to remove the question from the unanswered list – CarLaTeX Aug 22 '19 at 21:13
  • @CarLaTeX Right, but I wrote a lengthy explanation in the other link which only Sebastiano read, apparently, and I really don't feel like rewriting it just for the sake of removing a question from the unanswered list. My time is very limited and the OP didn't show any sign of life here for a long time, so... – frougon Aug 22 '19 at 21:15
  • @CarLaTeX Sorry if I sound bitter. There are days like that... I'll write an answer if the OP is still interested. – frougon Aug 22 '19 at 21:36
  • @frougon Thanks a lot for the offer. However, I wrote this question before I really learned TikZ from the manual. I was just trying to put together bits and pieces, and I had some really "stupid" questions, like this one (by "stupid" i mean that once your learn TikZ properly, or learn how to use other commands in LateX to mess with the picutre, such questions become not very useful). I finished the big documnent that I was working on long ago anyway. – Ovi Aug 22 '19 at 22:15
  • @frougon We can close the question as duplicate, then :) – CarLaTeX Aug 23 '19 at 02:22
  • @Ovio Usually we reply also to old questions, because they could be useful to future users, if not to the original OP. I'm very happy you learned TikZ! – CarLaTeX Aug 23 '19 at 02:28

0 Answers0