latex定义了结点noderectangle draw=black line width=1pt A at -10 A;noderectangle draw=black line width=1pt B at 10 B;现在要连接两个结点draw A--B;draw B--A;但我希望两条能作区分A到B的连线先往上再往右再往下B到A的连线先往下再往右再往上
你可以使用 |- 和 -| 符号来绘制你所描述的路径。下面是修改后的代码:
\documentclass{article} \usepackage{tikz}
\begin{document}
\begin{tikzpicture} \node[rectangle, draw=black, line width=1pt] (A) at (-1,0) {A}; \node[rectangle, draw=black, line width=1pt] (B) at (1,0) {B};
\draw (A)--++(0,1)--(B)--++(0,-1); % A到B的路径 \draw (B)--++(0,-1)--(A)--++(0,1); % B到A的路径
\end{tikzpicture}
\end{document}
原文地址: https://www.cveoy.top/t/topic/iux0 著作权归作者所有。请勿转载和采集!