4

I was trying to put a text box in a tikzpicture, and used the line

\node[text width=15.5cm] at (0,-2) {One fān is awarded for every kè zi or gàng zi of a fān pái present in the hand.  If the mén fēng and quān fēng coincide, then a kè zi or gàng zi of this is awarded two fān instead.} ;

to do so, but found that the text is not justified in the "textbox". Is there a way that I can justify the text?

2 Answers 2

6

Adding align=justify to the node options will do that. But the text only covers two lines of text, so the second line won't fill the whole line. (Which it shouldn't, it would look terrible.) I don't think that particular behaviour has anything to do with TikZ though, it's just how TeX works.

An example with two narrower nodes. I added draw so you see the node boundaries.

enter image description here

\documentclass{article}
\usepackage{tikz}
\begin{document}
Without \texttt{align=justify}:

\tikz \node[draw, text width=5cm] at (0,-2) {One fān is awarded for every kè zi or gàng zi of a fān pái present in the hand.  If the mén fēng and quān fēng coincide, then a kè zi or gàng zi of this is awarded two fān instead.} ;

With \texttt{align=justify}:

\tikz \node[draw, text width=5cm, align=justify] at (0,-2) {One fān is awarded for every kè zi or gàng zi of a fān pái present in the hand.  If the mén fēng and quān fēng coincide, then a kè zi or gàng zi of this is awarded two fān instead.} ;


With a wide node:

\tikz \node[draw, text width=15.5cm, align=justify] at (0,-2) {One fān is awarded for every kè zi or gàng zi of a fān pái present in the hand.  If the mén fēng and quān fēng coincide, then a kè zi or gàng zi of this is awarded two fān instead.} ;

\end{document}
2

There is no problem in the justification/alignment of the text.

\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node[text width=15.5cm] at (0,-2) {One fān is awarded for every kè zi or gàng 
zi of a fān pái present in the hand.  If the mén fēng and quān fēng coincide, 
then a kè zi or gàng zi of this is awarded two fān instead.};
\end{tikzpicture}
\end{document}[![enter image description here][1]][1]

enter image description here

You must log in to answer this question.

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