# What's “logarifm” in Metapost and why I get the error “Undefined control sequence”?

I'm trying the following Metapost sample:

http://www.ursoswald.ch/metapost/tutorial/TeXLabels.html

With the following code:

\documentclass{article}
\usepackage{luamplib}
\everymplib{input mpcolornames; beginfig(1);}
\everyendmplib{endfig;}

\begin{document}

\begin{mplibcode}
input TeXLabels.mp
\end{mplibcode}

\end{document}


But I get the following error:

./main.tex:10: Undefined control sequence.
l.9 \setbox264\hbox{\cyr
l.10 \end{mplibcode}


I've made some test and already know that the problem is in this line of TeXLabel.mp:

label.lft(btex
etex scaled 1.1, (3.7, 2.4) transformed t);


I've already tried to replace "logarifm" with "logarithm" but it didn't work either.

Can you help me?

• The error is in \cyr not being defined. The Russian word for “logarithm” is indeed “логарифм”. Just remove \cyr (and change the caption, I guess you don't use Russian). – egreg Dec 10 '15 at 12:47
• OK. Cyrillic. Now it makes sense... Thank you! – Leonardo Castro Dec 10 '15 at 12:50
• By the way, the picture was being printed twice. I think it was because there was the command "endfig;" in my code > \everyendmplib{endfig;} and also at the end of TeXLabels.mp. I just erased the last line of TeXLabels.mp and it worked perfectly. – Leonardo Castro Dec 10 '15 at 12:55

The error you mention is in \cyr not being defined.

You should edit TeXLabels.mp to remove the initial part

verbatimtex
\font\cyr=wncyr10
etex


and add a definition for \cyr in your TeX document. You also have a wrong declaration in \everymplib, that shouldn't include beginfig(1);, since the beginfig command is supplied in TeXLabels.mp. Similarly, you don't need endfig; in \everyendmplib.

\documentclass{article}
\usepackage[OT2,T1]{fontenc}
\usepackage{substitutefont}

\substitutefont{OT2}{\rmdefault}{wncyr}

\usepackage{luamplib}

\everymplib{input mpcolornames;}

\providecommand{\cyr}{\fontencoding{OT2}\selectfont}

\begin{document}

\begin{mplibcode}
input TeXLabels.mp;
\end{mplibcode}

\end{document}