In my understanding, any LaTeX box displays such fundamental properties:
.. and anything is wrapped into a LaTeX box.
So, when I produce a tikz picture, it must be somehow wrapped into a box. Indeed, it seems to display such a height and a baseline when I use it. For instance, this code:
\documentclass{report}
\usepackage[english]{babel}
\usepackage{tikz}
\tikzset{x=1pt, y=1pt, z=1pt}
\begin{document}
\newcommand{\mypicture}{\begin{tikzpicture}
\node (a) at (0, 0) {\strut$a$};
\node (b) at (30, 0) {\strut$b$};
\draw[->] (a) .. controls (15, -20) and (30, -30) .. (b);
\end{tikzpicture}}
In my rather long, multilined text, I wish I could insert \mypicture{} just
as if it were something natural..
\end{document}
produces:
.. now I think my point is getting clear. The above insertion does not seem natural at all since \mypicture box baseline does not match node (a) baseline. And if it would, vertical space between the two lines would probably be affected.
How to correct this without a dirty hand-tweak with \raisebox, \vspace etc.?
How to express all tikz pictures box properties in tikz coordinates?




[baseline, every node/.style={anchor=base}]as options of yourtikzpicture– moospit Feb 24 '16 at 10:59overlayscope if the arrow may overlay other lines – moospit Feb 24 '16 at 11:19tikzpictureenvironment likeheight,width,baselineanddepthand to express them intikzcoordinates. For instance, what if I needed to recreate this p withtikz(adding, say, one horn) and make it behave correctly within natural text? – iago-lito Feb 24 '16 at 11:26xscaleandyscaleas options for yourtikzpicture. As you setx, y, zto be 1pt this would be your base scaling. Doing it this way you could affect the scaling of alltikz-elements but not text. I don't believe thattikzis the best way to go when you want to create new characters (as your p) – moospit Feb 24 '16 at 11:40tikz. But how do I set\mypicture'sheightto theheightof$b$? How do I set itsdepthto thedepthof$a$? How do I choose itswidthto be exactly, say, 40pt? I am aware that the drawing will then extend out of the box, but this is my intent. – iago-lito Feb 24 '16 at 11:45raiseboxandresizeboxare the best options, but if I understand welll, you don't want to use them, and want to fix these values inside TikZ figure instead? – Damien Dtx Feb 24 '16 at 11:47raiseboxwould involve manual tweaking of the graph, which is painful an not a robust solution anyway (what if I fancy adding a snowball on the top of b? It would break the tweak). In this sense, thebaselineargument oftikzpictureis perfect. Concerningresizebox, I don't mind using it provided there is a way to tell it "let yourheightbe theheightof node(b)" or "let yourwidthbe thewidthof the arrow, so adapt thiswidthwhenever I fancy changing the control points" ;) – iago-lito Feb 24 '16 at 11:52