[luatex] Using conditionals with luamplib

Jason Stein jason.t.stein at gmail.com
Sat Jan 1 03:11:37 CET 2011


I am trying my hand at Metapost using luamplib. Any time that I try to
include a metapost conditional I get the error ! Undefined control
sequence. I have no idea what I am doing incorrectly. Below is a
minimal example. It compiles fine without the if .. fi statement.

\documentclass[letterpaper]{article}
\usepackage{luatextra}
\usepackage{luamplib}
\begin{document}
This is a test.
\begin{mplibcode}
beginfig(1);
numeric ux, uy, r;
ux = 1in; uy = s*1in;
s = uniformdeviate(2);
r = uniformdeviate(360);
if (r<90):
  label("Acute",(0,0));
else:
  label("Obtuse",(0,0));
fi;
pair A, B, C;
A = (0,0) rotated r; B = (1ux, 0) rotated r; C = (0, 1uy) rotated r;
path triangle;
triangle = A--B--C--cycle;
draw triangle;
label("A",A);
label("B",B);
label("C",C);
boolean q;
q:= true;
endfig;
\end{mplibcode}
\end{document}

Being new to Metapost, I may be doing the conditionals incorrectly,
but it is hard to find examples on the Internet. The log file is
attached.

Jason T. Stein, B. Sc. (1998), B. Ed. (2002)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: metapost_test.log
Type: application/octet-stream
Size: 30246 bytes
Desc: not available
URL: <http://tug.org/pipermail/luatex/attachments/20101231/838a37af/attachment-0001.obj>


More information about the luatex mailing list