我是 tikz 新手,我想在 latex 上用这个循环绘制一个表面,但我不知道如何插入标签,甚至不知道如何正确绘制曲线。您对从哪里开始或我可以基于的类似图表有什么建议吗?谢谢
答案1
这是一个用来tkz-euclide
绘制一些真实弧的解决方案。
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}[>=latex]
\def\larg{3} \def\long{5} \def\xshft{1} \def\yshft{1}
\coordinate (A) at (0,0);
\coordinate (B) at (\long,\yshft);
\coordinate (C) at (\long+\xshft,\larg+\yshft);
\coordinate (D) at (\xshft,\larg);
% Radii of the arcs (for lines and arrows)
\def\rada{12} \def\radb{18}
\def\radaa{12.3} \def\radab{11.7}
\def\radba{18.3} \def\radbb{17.7}
% Arc between A and D
\tkzInterCC[R](A,\rada cm)(D,\rada cm) \tkzGetSecondPoint{H1}
\tkzDrawArc[angles,line width=.75pt](H1,D)(150,174)
% Arrow from D to A
\tkzDrawArc[R,very thick,color=orange,->](H1,\radaa cm)(158,168)
% Arc between B and C
\tkzInterCC[R](B,\rada cm)(C,\rada cm) \tkzGetSecondPoint{H2}
\tkzDrawArc[angles,line width=.75pt](H2,C)(150,174)
% Arrow from B to C
\tkzDrawArc[R,very thick,color=orange,<-](H2,\radab cm)(156,166)
% Arc between A and B
\tkzInterCC[R](A,\radb cm)(B,\radb cm) \tkzGetSecondPoint{H3}
\tkzDrawArc[angles,line width=.75pt](H3,A)(90,112)
% Arrow from A to B
\tkzDrawArc[R,very thick,color=orange,<-](H3,\radbb cm)(95,108)
% Arc between D and C
\tkzInterCC[R](D,\radb cm)(C,\radb cm) \tkzGetSecondPoint{H4}
\tkzDrawArc[angles,line width=.75pt](H4,D)(90,113)
% Arrow from D to C
\tkzDrawArc[R,very thick,color=orange,->](H4,\radba cm)(94,107)
% Points and figures
\foreach \p in {A,B,C,D} \filldraw (\p) circle (1pt) node[below right] {\p};
\node[left] at (-0.7,-0.3) {$x^2=0$};
\node[left] at (0,2.7) {$x^2=\delta b$};
\node[below] at (-0.2,-.9) {$x^1=0$};
\node[below] at (4.8,0.1) {$x^1=\delta a$};
\end{tikzpicture}
\end{document}
答案2
我尝试了一下。结果如下:
\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc, intersections}
\begin{document}
\begin{tikzpicture}
% define nodes
\coordinate (A1) at (0,0);
\coordinate (B1) at ($ (A1) + (5,1) $);
\coordinate (C1) at ($ (B1) + (1,5) $);
\coordinate (D1) at ($ (A1) + (1,5) $);
\draw (A1) node {$ \bullet $} node[below=5pt] {A1};
\draw (B1) node {$ \bullet $} node[below=5pt] {B1};
\draw (C1) node {$ \bullet $} node[above=5pt] {C1};
\draw (D1) node {$ \bullet $} node[above=5pt] {D1};
\coordinate (A2) at ($ (A1) + (-1,1) $);
\coordinate (B2) at ($ (B1) + (1,1) $);
\coordinate (C2) at ($ (C1) + (1,-1) $);
\coordinate (D2) at ($ (D1) + (-1,-1) $);
\draw (A2) node {$ \bullet $} node[below=5pt] {A2};
\draw (B2) node {$ \bullet $} node[below=5pt] {B2};
\draw (C2) node {$ \bullet $} node[above=5pt] {C2};
\draw (D2) node {$ \bullet $} node[above=5pt] {D2};
% draw lines
\draw[name path=AB] (A2) to[bend left=10] (B2);
\draw[name path=AD] (A1) to[bend left=10] (D1);
\draw[name path=DC] (D2) to[bend left=10] (C2);
\draw[name path=BC] (B1) to[bend left=10] (C1);
% calculate intersections
\path[name intersections={of=AB and AD},];
\draw (intersection-1) node(A) {$ \bullet $} node[below right] {A};
\path[name intersections={of=AB and BC},];
\draw (intersection-1) node(B) {$ \bullet $} node[below right] {B};
\path[name intersections={of=BC and DC},];
\draw (intersection-1) node(C) {$ \bullet $} node[below right] {C};
\path[name intersections={of=AD and DC},];
\draw (intersection-1) node(D) {$ \bullet $} node[below right] {D};
% draw arrows
\draw[-stealth,bend left=10,shorten >=0.5cm,shorten <=0.5cm,lightgray,thick] ($ (A) + (0,-0.5) $) to ($ (B) + (0,-0.5) $);
\draw[-stealth,bend left=10,shorten >=0.5cm,shorten <=0.5cm,lightgray,thick] ($ (B) + (0.5,0) $) to ($ (C) + (0.5,0) $);
\draw[-stealth,bend right=10,shorten >=0.5cm,shorten <=0.5cm, lightgray,thick] ($ (C) + (0,0.5) $) to ($ (D) + (0,0.5) $);
\draw[-stealth,bend right=10,shorten >=0.5cm,shorten <=0.5cm,lightgray,thick] ($ (D) + (-0.5,0) $) to ($ (A) + (-0.5,0) $);
\end{tikzpicture}
\end{document}
首先,定义直线的起点和终点的坐标 (A1/2-D1/2)。因此,我使用了库calc
,您可以在其中设置点之间的距离($(startpoint) + (xshift,ysift)$)
。然后,在点之间绘制线条。在这里,我使用添加了线条的弯曲(point1) to[bend left=...] (point2)
并连接了所有点。该语法name path
用于使用intersections
库计算线条的交点,其中标记了第一个交点(intersection-1)
。最后一步是使用在这些点之间绘制箭头(具有相应的偏移量)\draw[-stealth,bend left=...] (point1) to (point2)
。
希望您了解它是如何工作的。
现在,您的任务是更改图形节点的标签(更改 中的输入node[...] {change name here}
),因为我保留它们是为了更好地理解工作流程,并且可能根据您的需要调整箭头的偏移量。因此,您可以尝试使用环境中的shorten >=...
和参数以及节点移位的坐标。shorten <=...
\draw