# Text without hyphenation with Tikz

How do I get the text does not break the line? I have

\begin{tikzpicture}
\node[align=left,text width=3cm] {Contemplando a contemporaneidade};
\end{tikzpicture}


but i need

• Is there a reason why you can't just increase the text width? (By the way, your example code does not break the line if I put it into a article or minimal document. Do you set anything that influences the font size?)
– Jake
Mar 25 '11 at 22:41

Or don't specify the text width at all, just add a line break at the appropriate position.

\node[align=left] {Contemplando a\\contemporaneidade};


Instead of using align=left, you can use align=flush left. This seems to do exactly the same as align=left, but without the hyphenation.

\node[align=flush left,text width=3cm] {Contemplando a contemporaneidade};


I found this trick here: Manual/automatic line breaks and text alignment in TikZ nodes

• Also works with align=flush center and align=flush right Mar 2 '21 at 21:48

Increase the value for text width conveniently.

We could use \hyphenchar\font as a global switcher; =1 turning on hyphenation, =-1 preventing hyphenation.

\documentclass[a4paper]{article}
\pagestyle{empty}
\usepackage{tikz}
\usepackage[english]{babel}
\begin{document}
\begin{tikzpicture}
\node[align=left,text width=2cm,draw] {Contemplando a contemporaneidade};
\end{tikzpicture}
\begin{tikzpicture}
\node[align=left,text width=2cm,draw] {%
\hyphenchar\font=-1 % 1 or -1

• Is the \hyphenchar\font=1 necessary to restore hyphenation, or is the \hyphenchar\font=1 actually localized? I ask because you called it a global switcher. At first glance, it seems to me that it would be a change valid only within the tikzpicture's scope. Jan 14 '16 at 14:36