TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Simple question: I'm making a picture with PGF (basic layer, not TikZ) and I would like to add some text using \pgftext. The problem is that any \\ or \newline line breaks within the text are apparently ignored. Is there some way I can force a line break to appear?


  \pgftext{can haz line \\ break plz?}
  \pgftext[y = -20pt]{i made u a line \newline break but tex eated it}

This is not mentioned in the manual at all, and the only other discussion I can find is this post from comp.tex.pgf.user which doesn't actually include a solution, only the workaround of using a TikZ node with [align=...]. But, mostly for curiosity's sake, suppose using TikZ is off the table. Is it still possible to do line breaks? (I would think so, since TikZ itself must do it somehow)

share|improve this question
could you put it in a tabular environment? something like \begin{tabular}{c}i made u a line \\ break but tex eated it\end{tabular}... – cmhughes Apr 29 '12 at 9:03
Or you could just wrap it in \shortstack{...} if it's not too complex. TikZ itself used a minipage, I think. – Jake Apr 29 '12 at 9:05
up vote 4 down vote accepted

egreg's solution or perhaps a minipage

\pgftext[y=-20pt]{\begin{minipage}{5cm}can haz line \\ break plz?\end{minipage}} 
share|improve this answer

Just a guess: \pgftext works with \hbox. So the answer might be

\pgftext{\vbox{\hbox{can haz line}\hbox{break plz?}}}

but probably

\pgftext{\begin{tabular}{@{}l@{}}can haz line\\break plz?\end{tabular}}

is handier (and can be wrapped up in a macro).

share|improve this answer

Your Answer


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.