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 am new to TikZ and I have a trivial question. How to draw a borderless diagram? In other words, I need something that does not displace the text. Similar to the effect achieved with a regular LaTeX picture with {0,0} for width and height. Here is a minimal example of what I need the diagram to look like:

\documentclass[a4paper]{report}
\usepackage{tikz}
\begin{document}
\begin{picture}(0,0)(0,0)
  \put(0,3){\vector(1,0){60}}
\end{picture}
Picture
\tikz{\draw [->] (0,0) -- (0:80pt);}
TikZ
\end{document}

This results in the following:

example

I would like the vector (and the environment in general) of TikZ to be over the word and not displace it. Similar to the one with Picture. I feel there's a straightforward solution for this, but I can't seem to find it.

Thank you

share|improve this question
4  
Use the option overlay. BTW: welcome to TeX.SX! –  Claudio Fiandrino Mar 25 at 10:38
    
@ClaudioFiandrino overlay is exactly what I needed. Thank you! –  Timmy Mar 25 at 10:45

2 Answers 2

up vote 2 down vote accepted
\documentclass[a4paper]{report}
\usepackage{tikz}
\begin{document}
\begin{picture}(0,0)(0,0)
  \put(0,3){\vector(1,0){60}}
\end{picture}
Picture

\makebox(0,0){\put(0,3){\vector(1,0){60}}}
Picture

\makebox[0pt][l]{\tikz\draw [->] (0,0) -- (0:80pt);}
TikZ

\tikz\draw [overlay,->] (0,0) -- (0:80pt);
TikZ
\end{document}
share|improve this answer

You can use the overlay option:

\tikz[overlay]{\draw [->] (0,0) -- (0:80pt);}

If you want to raise the error the baseline option might help:

\tikz[overlay,baseline=-0.8ex]{\draw [->] (0,0) -- (0:80pt);}

Together with overlay the remember picture option offers some nice features, like drawing at an absolute position of the current page

\tikz[remember picture, overlay]{\draw (current page.center) circle [radius=10mm];}

(where current page has the anchors of a rectangular node) or connecting two pictures

\tikz[remember picture,baseline=(first.base)]{\node [blue] (first) {First Node};}
Some regular Text her in this line.

A new paragraph and more text, ending with a
\tikz[remember picture,baseline=(second.base)]{\node [blue] (second) {second Node};}.

\tikz[remember picture, overlay]{\draw [blue,<->] (first) to[bend left] (second);}

connecting pictures

share|improve this answer
1  
Beware of node spacing: often is not fine within text. –  Claudio Fiandrino Mar 25 at 11:07

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.