答案1
我知道你已经标记了这个tikz-pgf
,但因为有大量 TikZ 教程,这里有一个注释版本元帖子这是一个您可能想学习的替代绘图工具。
用以下方法编译它lualatex
(或者弄清楚如何将其适配到普通的 Metapost,或者良好生产规范)。
这里展示的一个普遍有用的功能是如何通过在半途scope
移动变量来执行与 Metapost 中的TikZ 移位等效的操作。currentpicture
\RequirePackage{luatex85}
\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
% first make useful star shaped path
path pentagram; pentagram = for t=0 upto 4: up rotated 144 t -- endfor cycle;
% now make a drawing with the common parts
picture base;
base = image(
% define the four lines...
path a, b, c, d;
a = (left -- right) scaled 80;
b = a shifted 48 up;
c = (down -- 3 up) scaled 16 shifted 60 left;
d = (down -- 3 up) scaled 16 shifted 60 right;
% draw the lines...
draw a withcolor 1/2 white;
draw b withcolor 1/2 white;
drawoptions(withcolor 1/2 [blue, white]);
draw c dashed evenly scaled 1/2;
draw d dashed evenly scaled 1/2;
% add some decorations
drawoptions(withcolor 1/4 [blue, white]);
drawarrow point 0 of c -- point 0 of d;
fill pentagram scaled 4 shifted (a intersectionpoint c);
fill pentagram scaled 4 shifted point 1 of d;
drawoptions();
% add some labels to the lines
label.rt("$l_1$", point 1 of a);
label.rt("$l_2$", point 1 of b);
label.bot("$u$", point 0 of c);
label.bot("$v$", point 0 of d);
);
% now draw the base image, and add the track
% slightly shortened so it looks better with the markers
draw base;
drawarrow ((-60,0) -- (-30, 48) -- (60, 48))
cutbefore fullcircle scaled 10 shifted (-60,0)
cutafter fullcircle scaled 10 shifted (60,48)
dashed evenly
withpen pencircle scaled 1
withcolor red;
% shift the whole picture 200 to the left
currentpicture := currentpicture shifted 200 left;
% and draw the base again, but with a different track and a label
draw base;
drawarrow ((-60,0) -- (-30, 0) -- (0, 48) -- (60, 48))
cutbefore fullcircle scaled 10 shifted (-60,0)
cutafter fullcircle scaled 10 shifted (60,48)
dashed evenly
withpen pencircle scaled 1
withcolor red;
dotlabel.bot("$A$", (-30,0));
endfig;
\end{mplibcode}
\end{document}