答案1
答案2
@AdamLiter 已经以出色的方式解决了这个问题——https://tex.stackexchange.com/a/124114/197451-- 链接处的讨论显示varwidth
这是最佳选择
当然,你可以看看其他可用的选项,例如
文本宽度或者\或者大批或者 表格
\documentclass{article}
\usepackage{tikz}
\usepackage{varwidth}
\usepackage{ragged2e}
\begin{document}
\begin{tikzpicture}
\node (example-varwidth-left) [draw, align=left]{\begin{varwidth}{3cm}This is a
demonstration text for showing how line breaking works.\end{varwidth}};
\end{tikzpicture}
\begin{tikzpicture}
\node (example-varwidth-right) [draw, align=right]{\begin{varwidth}{3cm}This is a
demonstration text for showing how line breaking works.\end{varwidth}};
\end{tikzpicture}
\begin{tikzpicture}
\node (example-varwidth-ragged) [draw, align=flush right] {\begin{varwidth}
{3cm}\RaggedLeft This is a demonstration text for showing how line breaking
works.\end{varwidth}};
\end{tikzpicture}
\end{document}
答案3
在 TikZ 中,包含文本的框称为node
。要获得包含多条线的节点,只需使用参数 选择这些线的对齐方式(左、右、居中)align=center
。在这里,我已对齐并居中了最右边的节点(descrittivo ...)。我开始制作此图表是为了给您一个起点。如果您有任何疑问,我愿意倾听。
\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,calc}
\begin{document}
\begin{tikzpicture}
\node[draw] (logico-formale) at (0,0) {logico-formale};
\node[draw](Costtrutivo-formale)[right=of logico-formale] {Costtrutivo-formale};
\node[draw](Costtrutivo-materiale)[right=of Costtrutivo-formale] {Costtrutivo-materiale};
\node[draw](descrittivo)[right=of Costtrutivo-materiale.south east,anchor=south west,align=center] {Descrittivo-\\materiale\\ (empirica)};
% auxiliary node 1
\node (aux1) at ($(logico-formale.east)!.5!(Costtrutivo-formale.west)$){};
\node[draw,above= 1.5cm of aux1] (formale){formale};
\draw (formale.south west)--(logico-formale);
\draw (formale.south east)--(Costtrutivo-formale);
% auxiliary node 2
\node (aux2) at ($(Costtrutivo-formale.east)!.5!(Costtrutivo-materiale.west)$){};
\node[draw,above= 10mm of aux2] (Costtrutivo){Costtrutivo};
\draw (Costtrutivo.south west)--(Costtrutivo-formale);
\draw (Costtrutivo.south east)--(Costtrutivo-materiale);
% auxiliary node 3
\node (aux3) at ($(Costtrutivo-materiale.east)!.5!(descrittivo.west)$){};
\node[draw,above= 1.5cm of aux3] (materiale){materiale};
\draw (materiale.south west)--(Costtrutivo-materiale);
\draw (materiale.south east)--(descrittivo);
\end{tikzpicture}
\end{document}