2

This is my exact tikz code

\draw [thick,decoration={brace, mirror,raise=0.55cm},decorate] (BG1-Block2.west) -- (BG1-Block2.east)
       node [pos=0.5,anchor=north,yshift=-0.65cm] {Hello\\World};

Error:

LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                                                                                
l.56 ...0.5,anchor=north,yshift=-0.65cm] {Outer\\Ch};

If I remove \\ I dont get any error. But I need to have a multi line label. Can someone please let me know what is wrong here.

1

1 Answer 1

3

The error can be reproduced by the following MWE:

\documentclass{article}
\usepackage{tikz}

\begin{document}
  \begin{center}
    \begin{tikzpicture}
      \node {Hello\\World};
    \end{tikzpicture}
  \end{center}
\end{document}

The version of \\, redefined by the center environment, causes the trouble. But anyway, the node text is still a one-liner. Multi-line node text can be achieved by using option align:

\documentclass{article}
\usepackage{tikz}

\begin{document}
  \begin{center}
    \begin{tikzpicture}
      \node[align=center] {Hello\\World};
    \end{tikzpicture}
  \end{center}
\end{document}

Result

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .