When I'm using tikz to draw graph with text annotation, I've met a problem that simply adding "[]" around text in annoation would make the compilation using XeLaTeX fail.
For example, this code works as expect:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=2]
\node[draw,align=center] (n) at (0,0) {line1 \ line2};
\end{tikzpicture}
\end{document}
It generates a box within which shows two lines of text.
But when it becomes as follow, simply add "[ ]", it failed:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=2]
\node[draw,align=center] (n) at (0,0) {line1 \ [line2]};
\end{tikzpicture}
\end{document}
This confused me a lot and I wonder why this would happen.
\\, add something between both, e.g.\\\relax[line2]. – Ulrike Fischer May 27 '23 at 11:00