![使用 Tikz 绘制水平线](https://linux22.com/image/363151/%E4%BD%BF%E7%94%A8%20Tikz%20%E7%BB%98%E5%88%B6%E6%B0%B4%E5%B9%B3%E7%BA%BF.png)
答案1
您可以使用以下-|
语法:
\documentclass[11pt,a4paper]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node[draw] (A)at (0,0) {\rule{0pt}{3cm}A} ;
\node[draw] (B) at (3,0) {\rule{0pt}{5cm}B} ;
\coordinate (C) at ([shift={(-1,3)}]A.north west);
\coordinate (Dx) at([xshift={1cm}]B.north east);
\draw (C)node[left]{C} -- (C -| Dx)node[right]{D};
\end{tikzpicture}
\end{document}