答案1
由于没有其他人提供帮助,因此我尝试元帖子,您可能想了解一下。请点击链接查看手册和教程。这包含在 中,luamplib
因此您需要使用 进行编译lualatex
。
\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
path xx, yy, ff;
xx = origin -- 377 right;
yy = origin -- 233 up;
ff = origin .. (72, 144){1,2} .. (84, 144) .. (96, 144){1,1} .. (200, 220){right} .. (340, 160){2,-1.3};
for t=2, 4, 4.9:
draw point t of ff -- (xpart point t of ff, ypart point 1 of yy + 20) dashed evenly scaled 1/2;
endfor
label.top("Strain hardening", (1/2 (xpart point 2 of ff + xpart point 4 of ff), ypart point 1 of yy));
label.top("Necking", (1/2 (xpart point 4 of ff + xpart point 4.9 of ff), ypart point 1 of yy));
path rr;
rr = point 0.4 of ff -- (xpart point 0.8 of ff, ypart point 0.4 of ff) -- point 0.8 of ff;
draw rr; label.bot("Run", point 1/2 of rr); label.rt("Rise", point 3/2 of rr);
vardef pin_label@#(expr p, a, b)=
draw a -- b cutbefore fullcircle scaled 8 shifted a withpen pencircle scaled 1/4 withcolor 1/2 white;
label@#(p, b);
enddef;
pin_label.lrt("Yield strength", point 1.2 of ff, point 2 of ff + (8, -18));
pin_label.bot("Ultimate strength", point 4 of ff, point 4 of ff - (4, 24));
pin_label.lrt("Fracture", point 5 of ff, point 5 of ff + (12, -18));
color french_blue; french_blue = 1/256(50, 122, 177);
draw ff withpen pencircle scaled 1 withcolor french_blue;
drawarrow xx; label.rt("Strain, $\epsilon$", point 1 of xx);
drawarrow yy; label.top("Stress, $\sigma$", point 1 of yy);
label("$\displaystyle\hbox{Young's modulus} = \hbox{Slope} = {\hbox{Rise}\over\hbox{Run}}$", point 1/2 of xx shifted 36 up);
endfig;
\end{mplibcode}
\end{document}
我在这里大量使用了point t of P
语法,它返回位于路径上的一(x,y)
对点。t
P