Skip to content

Instantly share code, notes, and snippets.

@qtnez
Last active November 2, 2022 07:03
Show Gist options
  • Save qtnez/2f0998b03782a84f11863fe083e5d83a to your computer and use it in GitHub Desktop.
Save qtnez/2f0998b03782a84f11863fe083e5d83a to your computer and use it in GitHub Desktop.
\documentclass{article}
\usepackage{luamplib}
\usepackage{lipsum}
% 讓圖檔置中以便配合 LaTeX figure 環境的 caption 位置
\everymplib{%
verbatimtex
\center\leavevmode
etex;
beginfig(1);}
\everyendmplib{%
verbatimtex
\endcenter
etex;
endfig;}
\begin{document}
\lipsum[1]
\begin{figure}
\begin{mplibcode}
draw unitsquare scaled 70;
draw (10,20);
draw (10,15) scaled 2;
draw (30,40) withpen pencircle scaled 4;
pickup pencircle scaled 8;
draw (40,50);
pickup pencircle scaled 10;
draw (50,60);
\end{mplibcode}
\caption{Luamplib test.}
\end{figure}
\lipsum[2-3]
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment