我目前正在使用以下 LaTeX 结构设计图表:
\begin{center}
\begin{tikzpicture}
\draw (0,0) grid[xstep=20,ystep=1] (10.8,6);
\draw [line width=6mm, color=blue!50] plot [ycomb] coordinates {(1,5.7) (2,5.4) (3,2.1) (4,1.9) (5,1.2) (6,1.2) (7,1) (8,0.9) (9,0.8) (10,0.8) };
% SCALE
\draw (-0.75,0) node{0};
\draw (-0.75,1) node{5};
\draw (-0.75,2) node{10};
\draw (-0.75,3) node{15};
\draw (-0.75,4) node{20};
\draw (-0.75,5) node{25};
\draw (-0.75,6) node{30};
\draw(1,-1) node[rotate=45]{Text };
\draw (2,-1) node[rotate=45]{Text \& Text};
\draw (3,-1) node[rotate=45]{Text};
\draw (4,-1) node[rotate=45]{Text};
\draw (5,-1) node[rotate=45]{Text \\ Text};
\draw (6,-1) node[rotate=45]{Text \\ Text};
\draw (7,-1) node[rotate=45]{Text};
\draw (8,-1) node[rotate=45]{Text \& \\ Text};
\draw (9,-1) node[rotate=45]{Text Text};
\draw (10,-1) node[rotate=45]{text};
\draw[white] (1,5.2) node{0.9};
\draw[white] (2,4.9) node{6.4};
\draw[white] (3,1.6) node{4};
\draw[white] (4,1.5) node{2.8};
\draw[white] (5,0.9) node{4.7};
\draw[white] (6,0.9) node{0.9};
\draw[white] (7,0.7) node{6.4};
\draw[white] (8,0.6) node{4};
\draw[white] (9,0.55) node{2.8};
\draw[white] (10,0.55) node{4.7};
\end{tikzpicture}
\end{center}
\maketitle
\section{Introduction}
\end{document}
我尝试在某些文本部分使用经典的换行符指令,如\\
和 ,\
但没有成功。我找到了很多解决方案,但它们需要使用\node
。在我的文本部分,所有指令都已以 开头\draw
,我想保留 。我如何才能在我的例子中使用 来换行\node{}
?
答案1
Ignasi 在评论中解决了这个问题:“添加text width
内部节点选项并将\\
在节点内容内起作用。”