1

What is the reason that the following code is producing an error with text break (\\)

\node (text_1) [draw=none, below=1cm of func, align=left, xshift=1.5cm,yshift=-1cm] 
{
  \begingroup
  \fontsize{9pt}{7.2}\selectfont
  {Some \\ code}
  \endgroup
}
2
  • 2
    Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem.
    – Thruston
    Commented Apr 27, 2015 at 20:53
  • 1
    you need a text width key to specify a width before you can have multiple lines, but do you really want 9pt text on a 7.2pt baseline??? also you should not have the \begingroup \endgroup group or the {} group so that the implicit \par at the end of the node is in the scope of the size change. Commented Apr 27, 2015 at 21:13

1 Answer 1

1

enter image description here

You need a text width key to allow multiple line text, also specifying a baseline spacing smaller than the font size seems very odd. Size changes should always include a paragraph end so I removed the group, and finally there seemed to be a missing ; for the tikz syntax.

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\node (text_1) [draw=none,  align=left, 
xshift=1.5cm,yshift=-1cm,text width=3cm,font=\small] 
{
  Some \\ code
};
\end{tikzpicture}
\end{document}
0

You must log in to answer this question.

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