I seem to be having trouble getting my code to carry out any amsmath command with the btex--etex environment in a metapost file. The appropriate packages are defined withint my tex file, so I really have no idea what the problem is!

I will appreciate any help!

This is my mp code:

defaultscale := 10pt/fontsize(defaultfont);
path p; p:=(0.1cm,u)--(0.1cm,u+0.5cm);
pair A;
drawarrow p;
draw unitsquare scaled 1cm withpen pencircle scaled 0.5;
draw (-0.01cm,0)..(-0.01cm,2cm) dashed evenly scaled 0.8 withpen pencircle scaled 0.8 withcolor red;
draw (0,-0.01cm)..(2cm,-0.01cm) dashed evenly scaled 0.8 withpen pencircle scaled 0.8 withcolor red;
%drawarrow p;
for i=0 upto 2:
drawarrow p shifted (i*A/2);
label.ulft(btex \begin{align}\sqrt{3} \\ u_{r}=0\end{align} etex, origin );


Thank you!


Metapost use TeX by default to compile the labels, even if you ask it to use LaTeX instead it does not now about align, it is missing the amsmath package. Try adding this


at the start of your Metapost file.

BTW: you may want to use align* instead, or even just the matrix env inside a $...$, using an environment is overkill in this case.

  • 2
    I'd use $\begin{aligned}...\end{aligned}$, because a display environment doesn't really make sense. – egreg Apr 24 '14 at 12:08
  • Thank you. It works. It would have helped if I had a proper look at the manual beforehand too! – user2822693 Apr 24 '14 at 13:04
  • It's often easier to put two separate labels instead of a stack. – Thruston Apr 24 '14 at 17:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.