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 want to draw a few pictures in line using tikz. I added a few pictures for your understanding. The first pictures is fine, but in the second is some kind of line break which I don't want.

1

2

The code I'm using is:

\documentclass{article}
\usepackage{tikz}
\usepackage[active,tightpage]{preview}
\setlength\PreviewBorder{5pt}

\begin{document}
  \begin{preview}

    \begin{tikzpicture}[font=\sffamily]
      % draw 1
    \end{tikzpicture}
    \hspace*{10pt}
    \begin{tikzpicture}[font=\sffamily]
      % draw 2
    \end{tikzpicture}
    \hspace*{10pt}
    \begin{tikzpicture}[font=\sffamily]
      % draw 3
    \end{tikzpicture}
  \end{preview}

\end{document}

Do you have any ideas how to draw these pictures in line?

share|improve this question
    
Hi, welcome to TeX.SX. I included the images for you. Once you got 10rep points you can do this by yourself. –  Martin Scharrer Mar 18 '11 at 21:54
    
Note that you can write such files even shorter using the standalone class: \documentclass[border=5pt]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} ... \end{tikzpicture} \end{document} You can then include them directly into a main file with the standalone package. –  Martin Scharrer Mar 18 '11 at 21:56
    
Didn't know that, thank you. –  Maaalte Mar 18 '11 at 22:01
add comment

1 Answer

up vote 6 down vote accepted

TeX will treat "end-of-line" as additional white space—and these white spaces allow line breaks.

Does it help to add % after \end{tikzpicture} and after \hspace*{10pt}? This should disable the white space caused by end-of-line tokens.

share|improve this answer
    
I added a few '%' and it is working now. Thank you! –  Maaalte Mar 18 '11 at 21:41
    
You can use backticks (`) to mark your inline code. –  Caramdir Mar 18 '11 at 22:57
    
use \begin{scope}[xshift=2cm] \end{scope} –  Regis da Silva Mar 19 '11 at 16:25
add comment

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.