# How to align TikZ picture and text side by side

I want to add a TikZ picture beside a text block

\documentclass{article}
\usepackage{lipsum}
\usepackage{tikz}
\begin{document}
\lipsum[1]
\begin{tikzpicture}[color=white]
\node[fill=blue!70,rotate=90] at (0,0) {Vertical Text on Left};
\end{tikzpicture}
\lipsum[2]
\lipsum[3]
\end{document}


but with this structure, the TikZ picture is inserted at the first line of text, instead of placing side by side.

One solution can be using packages like wrapfig to wrap the text around picture. Isn't there any easier solution to place TikZ figure beside text?

-
Short answer: no. – Paul Gaborit Jul 19 '12 at 19:27
Y U NO love wrapfig? – N3buchadnezzar Jul 19 '12 at 22:35
@N3buchadnezzar actually, I'm a big fan of wrapfig; just was curious if there is a simpler solution. – All Jul 19 '12 at 22:55

Use \parbox, I just set the widths as a fraction of \linewidth.

\documentclass{article}
\usepackage{lipsum}
\usepackage{tikz}
\begin{document}
\lipsum[1]
\noindent\parbox[][][t]{.05\linewidth}{\begin{tikzpicture}[color=white]
\node[fill=blue!70,rotate=90] at (0,0) {Vertical Text on Left};
\end{tikzpicture}}%
\parbox[][][t]{.95\linewidth}{
\lipsum[2]
\lipsum[3]
}
\end{document}


-
See How to keep a constant \baselineskip when using minipages (or \parboxes)? in terms of your vertical alignment. Perhaps all you need is a \strut in the last line of the paragraph preceding the \parbox (since it doesn't have any descenders). – Werner Jul 19 '12 at 21:00
Can the blue rectangle span multiple pages? – kiss my armpit Jul 19 '12 at 22:47

Just for reference, here's a solution with wrapfig:

\documentclass{article}
\usepackage{tikz}
\usepackage{wrapfig}
\usepackage{lipsum}

\begin{document}
\lipsum[1]
\begin{wrapfigure}[10]{L}{.5cm}
\vspace{-\baselineskip}
\begin{tikzpicture}[color=white]
\node[fill=blue!70,rotate=90,minimum width=9\baselineskip,align=center]
at (0,0) {Vertical Text on Left};
\end{tikzpicture}
\end{wrapfigure}
\lipsum[2]
\lipsum[3]
\end{document}


(Author: Gonzalo Medina)

-

Here is an answer using the minipage environment. For contrast, \strut is used in one place and \bigkip in another to improve spacing.

\documentclass{article}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage{wrapfig}

\begin{document}
\lipsum[1] \strut
\noindent
\begin{minipage}{0.05\textwidth}
\begin{tikzpicture}[color=white]
\node[fill=blue!70,rotate=90] at (0,0) {Vertical Text on Left};
\end{tikzpicture}
`