我想让节点的第一行垂直居中,对象(此处为一条线)位于其左侧。我该怎么做?
当然我可以把元素分成几个部分,然后对每个部分进行微调,但我确实想使用不包括手动换档的解决方案。
图片
平均能量损失
\documentclass{standalone}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{
tikz,
}
\usetikzlibrary{
intersections,
calc
}
\begin{document}
\begin{tikzpicture}[font=\small]
\draw
(0,0) coordinate (A)
(1,0) coordinate (B)
;
\draw[thick] (A) -- (B) node[right, text width=5cm] {Words Words Words Words Words Words };
\end{tikzpicture}
\end{document}
答案1
非常相似,使用定位包...
\documentclass[12pt,tikz,border=3mm]{standalone}
\usetikzlibrary{positioning}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\begin{document}
\begin{tikzpicture}[font=\small]
\draw
(0,0) coordinate (A)
(1,0) coordinate (B);
\draw[thick] (A) -- (B) node[below right=-0.5\baselineskip and 0ex, text width=4cm]
{Words abc. Words abc. Words abc. Words abc. Words abc. Words abc.};
\end{tikzpicture}
\end{document}
答案2
\documentclass{standalone}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{
tikz,
}
\usetikzlibrary{
intersections,
calc
}
\begin{document}
\begin{tikzpicture}[font=\small]
\draw
(0,0) coordinate (A)
(1,0) coordinate (B)
;
\draw[thick] (A) -- (B) node[anchor=mid west, text width=4cm] {Words abc. Words abc. Words abc. Words abc. Words abc. Words abc. };
\end{tikzpicture}
\end{document}
很乐意阅读其他方法!