Skip to main content
replaced http://tex.stackexchange.com/ with https://tex.stackexchange.com/
Source Link

Aside from ConTeXt, it is also possible to include OpenType fonts in MetaPost labels if you use MetaPost through Lua(La)TeX.

As it was noted in the comments, thanks to Dohyun Kim the btex … etex flags are now recognized by luamplib, but in the recents versions it goes much further than that: luamplib now also includes a textext function that is pretty much the same as its namesake in MetaFun/ConTeXt.

Like the btex … etex flags, textext() (which takes a string of characters as argument) uses by default the fonts of the current Lua(La)TeX document, OpenType or not, to typeset the labels. But it has two big advantages on the btex … etex flags:

  • it allows the treatment of variables in labels; see Metapost label based on variable valueMetapost label based on variable value
  • if you issue the \mplibtextextlabel{enable} instruction in the preamble, it is enough to give the string itself as argument to the label commands; textext is called to typeset it, but in the background. Very handy if you have a great bunch of labels to typeset!

So the following program:

\documentclass[12pt]{scrartcl}
\usepackage{unicode-math}
    \setmainfont{XITS}
    \setmathfont{XITS Math}
\usepackage{luamplib}
\begin{document}
\begin{mplibcode}
beginfig(1);
    label(textext("Pythagorean addition: $a^2+b^2 = c^2$."), origin);
endfig;
\end{mplibcode}
\end{document}

gives exactly the same result as this:

\documentclass[12pt]{scrartcl}
\usepackage{unicode-math}
    \setmainfont{XITS}
    \setmathfont{XITS Math}
\usepackage{luamplib}
    \mplibtextextlabel{enable}
\begin{document}
\begin{mplibcode}
beginfig(1);
    label("Pythagorean addition: $a^2+b^2 = c^2$.", origin);
endfig;
\end{mplibcode}
\end{document}

Either way you get 12pt-sized OpenType text and math fonts from XITS (which are themselves adaptation of the STIX fonts) in the label:

enter image description here

Aside from ConTeXt, it is also possible to include OpenType fonts in MetaPost labels if you use MetaPost through Lua(La)TeX.

As it was noted in the comments, thanks to Dohyun Kim the btex … etex flags are now recognized by luamplib, but in the recents versions it goes much further than that: luamplib now also includes a textext function that is pretty much the same as its namesake in MetaFun/ConTeXt.

Like the btex … etex flags, textext() (which takes a string of characters as argument) uses by default the fonts of the current Lua(La)TeX document, OpenType or not, to typeset the labels. But it has two big advantages on the btex … etex flags:

  • it allows the treatment of variables in labels; see Metapost label based on variable value
  • if you issue the \mplibtextextlabel{enable} instruction in the preamble, it is enough to give the string itself as argument to the label commands; textext is called to typeset it, but in the background. Very handy if you have a great bunch of labels to typeset!

So the following program:

\documentclass[12pt]{scrartcl}
\usepackage{unicode-math}
    \setmainfont{XITS}
    \setmathfont{XITS Math}
\usepackage{luamplib}
\begin{document}
\begin{mplibcode}
beginfig(1);
    label(textext("Pythagorean addition: $a^2+b^2 = c^2$."), origin);
endfig;
\end{mplibcode}
\end{document}

gives exactly the same result as this:

\documentclass[12pt]{scrartcl}
\usepackage{unicode-math}
    \setmainfont{XITS}
    \setmathfont{XITS Math}
\usepackage{luamplib}
    \mplibtextextlabel{enable}
\begin{document}
\begin{mplibcode}
beginfig(1);
    label("Pythagorean addition: $a^2+b^2 = c^2$.", origin);
endfig;
\end{mplibcode}
\end{document}

Either way you get 12pt-sized OpenType text and math fonts from XITS (which are themselves adaptation of the STIX fonts) in the label:

enter image description here

Aside from ConTeXt, it is also possible to include OpenType fonts in MetaPost labels if you use MetaPost through Lua(La)TeX.

As it was noted in the comments, thanks to Dohyun Kim the btex … etex flags are now recognized by luamplib, but in the recents versions it goes much further than that: luamplib now also includes a textext function that is pretty much the same as its namesake in MetaFun/ConTeXt.

Like the btex … etex flags, textext() (which takes a string of characters as argument) uses by default the fonts of the current Lua(La)TeX document, OpenType or not, to typeset the labels. But it has two big advantages on the btex … etex flags:

  • it allows the treatment of variables in labels; see Metapost label based on variable value
  • if you issue the \mplibtextextlabel{enable} instruction in the preamble, it is enough to give the string itself as argument to the label commands; textext is called to typeset it, but in the background. Very handy if you have a great bunch of labels to typeset!

So the following program:

\documentclass[12pt]{scrartcl}
\usepackage{unicode-math}
    \setmainfont{XITS}
    \setmathfont{XITS Math}
\usepackage{luamplib}
\begin{document}
\begin{mplibcode}
beginfig(1);
    label(textext("Pythagorean addition: $a^2+b^2 = c^2$."), origin);
endfig;
\end{mplibcode}
\end{document}

gives exactly the same result as this:

\documentclass[12pt]{scrartcl}
\usepackage{unicode-math}
    \setmainfont{XITS}
    \setmathfont{XITS Math}
\usepackage{luamplib}
    \mplibtextextlabel{enable}
\begin{document}
\begin{mplibcode}
beginfig(1);
    label("Pythagorean addition: $a^2+b^2 = c^2$.", origin);
endfig;
\end{mplibcode}
\end{document}

Either way you get 12pt-sized OpenType text and math fonts from XITS (which are themselves adaptation of the STIX fonts) in the label:

enter image description here

added 9 characters in body
Source Link
Franck Pastor
  • 18.8k
  • 1
  • 48
  • 74

Aside from ConTeXt, it is also possible to include OpenType fonts in MetaPost labels if you use MetaPost through Lua(La)TeX.

As it was noted in the comments, thanks to Dohyun Kim the btex … etex flags are now recognized by luamplib, but in the recents versions it goes much further than that: luamplib now also includes a textext function that is pretty much the same as its namesake in MetaFun/ConTeXt.

Like the btex … etex flags, textext() (which takes a string of characters as argument) uses by default the fonts of the current Lua(La)TeX document, OpenType or not, to typeset the labels. But it has two big advantages on the btex … etex flags:

  • it allows the treatment of variables in labels; see Metapost label based on variable value
  • if you issue the \mplibtextextlabel{enable} instruction in the preamble, it is enough to give the string itself as argument to the label commands; textext is called to typeset it, but in the background. Very handy if you have a great bunch of labels to handletypeset!

So the following program:

\documentclass[12pt]{scrartcl}
\usepackage{unicode-math}
    \setmainfont{XITS}
    \setmathfont{XITS Math}
\usepackage{luamplib}
\begin{document}
\begin{mplibcode}
beginfig(1);
    label(textext("Pythagorean addition: $a^2+b^2 = c^2$."), origin);
endfig;
\end{mplibcode}
\end{document}

gives exactly the same result as this one:

\documentclass[12pt]{scrartcl}
\usepackage{unicode-math}
    \setmainfont{XITS}
    \setmathfont{XITS Math}
\usepackage{luamplib}
    \mplibtextextlabel{enable}
\begin{document}
\begin{mplibcode}
beginfig(1);
    label("Pythagorean addition: $a^2+b^2 = c^2$.", origin);
endfig;
\end{mplibcode}
\end{document}

That is, with this exampleEither way you get 12pt-sized OpenType text and math fonts from XITS (which are themselves adaptation of the STIX fonts) in the label:

enter image description here

Aside from ConTeXt, it is also possible to include OpenType fonts in MetaPost labels if you use MetaPost through Lua(La)TeX.

As it was noted in the comments, thanks to Dohyun Kim the btex … etex flags are now recognized by luamplib, but in the recents versions it goes much further than that: luamplib now also includes a textext function that is pretty much the same as its namesake in MetaFun/ConTeXt.

Like the btex … etex flags, textext() (which takes a string of characters as argument) uses by default the fonts of the current Lua(La)TeX document, OpenType or not, to typeset the labels. But it has two big advantages on the btex … etex flags:

  • it allows the treatment of variables in labels; see Metapost label based on variable value
  • if you issue the \mplibtextextlabel{enable}, it is enough to give the string itself as argument to the label commands; textext is called to typeset it, but in the background. Very handy if you have a great bunch of labels to handle!

So the following program:

\documentclass[12pt]{scrartcl}
\usepackage{unicode-math}
    \setmainfont{XITS}
    \setmathfont{XITS Math}
\usepackage{luamplib}
\begin{document}
\begin{mplibcode}
beginfig(1);
    label(textext("Pythagorean addition: $a^2+b^2 = c^2$."), origin);
endfig;
\end{mplibcode}
\end{document}

gives exactly the same result as this one:

\documentclass[12pt]{scrartcl}
\usepackage{unicode-math}
    \setmainfont{XITS}
    \setmathfont{XITS Math}
\usepackage{luamplib}
    \mplibtextextlabel{enable}
\begin{document}
\begin{mplibcode}
beginfig(1);
    label("Pythagorean addition: $a^2+b^2 = c^2$.", origin);
endfig;
\end{mplibcode}
\end{document}

That is, with this example you get 12pt-sized OpenType text and math fonts from XITS (which are themselves adaptation of the STIX fonts) in the label:

enter image description here

Aside from ConTeXt, it is also possible to include OpenType fonts in MetaPost labels if you use MetaPost through Lua(La)TeX.

As it was noted in the comments, thanks to Dohyun Kim the btex … etex flags are now recognized by luamplib, but in the recents versions it goes much further than that: luamplib now also includes a textext function that is pretty much the same as its namesake in MetaFun/ConTeXt.

Like the btex … etex flags, textext() (which takes a string of characters as argument) uses by default the fonts of the current Lua(La)TeX document, OpenType or not, to typeset the labels. But it has two big advantages on the btex … etex flags:

  • it allows the treatment of variables in labels; see Metapost label based on variable value
  • if you issue the \mplibtextextlabel{enable} instruction in the preamble, it is enough to give the string itself as argument to the label commands; textext is called to typeset it, but in the background. Very handy if you have a great bunch of labels to typeset!

So the following program:

\documentclass[12pt]{scrartcl}
\usepackage{unicode-math}
    \setmainfont{XITS}
    \setmathfont{XITS Math}
\usepackage{luamplib}
\begin{document}
\begin{mplibcode}
beginfig(1);
    label(textext("Pythagorean addition: $a^2+b^2 = c^2$."), origin);
endfig;
\end{mplibcode}
\end{document}

gives exactly the same result as this:

\documentclass[12pt]{scrartcl}
\usepackage{unicode-math}
    \setmainfont{XITS}
    \setmathfont{XITS Math}
\usepackage{luamplib}
    \mplibtextextlabel{enable}
\begin{document}
\begin{mplibcode}
beginfig(1);
    label("Pythagorean addition: $a^2+b^2 = c^2$.", origin);
endfig;
\end{mplibcode}
\end{document}

Either way you get 12pt-sized OpenType text and math fonts from XITS (which are themselves adaptation of the STIX fonts) in the label:

enter image description here

Fixed typo!
Source Link
Franck Pastor
  • 18.8k
  • 1
  • 48
  • 74

Aside from ConTeXt, it is also possible to include OpenType fonts in MetaPost labels if you use MetaPost through Lua(La)TeX.

As it was noted in the comments, thanks to Dohyun Kim the btex … etex flags are notnow recognized by luamplib, but in the recents versions it goes much further than that: luamplib now also includes a textext function that is pretty much the same as its namesake in MetaFun/ConTeXt.

Like the btex … etex flags, textext() (which takes a string of characters as argument) uses by default the fonts of the current Lua(La)TeX document, OpenType or not, to typeset the labels. But it has two big advantages on the btex … etex flags:

  • it allows the treatment of variables in labels; see Metapost label based on variable value
  • if you issue the \mplibtextextlabel{enable}, it is enough to give the string itself as argument to the label commands; textext is called to typeset it, but in the background. Very handy if you have a great bunch of labels to handle!

So the following program:

\documentclass[12pt]{scrartcl}
\usepackage{unicode-math}
    \setmainfont{XITS}
    \setmathfont{XITS Math}
\usepackage{luamplib}
\begin{document}
\begin{mplibcode}
beginfig(1);
    label(textext("Pythagorean addition: $a^2+b^2 = c^2$."), origin);
endfig;
\end{mplibcode}
\end{document}

gives exactly the same result as this one:

\documentclass[12pt]{scrartcl}
\usepackage{unicode-math}
    \setmainfont{XITS}
    \setmathfont{XITS Math}
\usepackage{luamplib}
    \mplibtextextlabel{enable}
\begin{document}
\begin{mplibcode}
beginfig(1);
    label("Pythagorean addition: $a^2+b^2 = c^2$.", origin);
endfig;
\end{mplibcode}
\end{document}

That is, with this example you get 12pt-sized OpenType text and math fonts from XITS (which are themselves adaptation of the STIX fonts) in the label:

enter image description here

Aside from ConTeXt, it is also possible to include OpenType fonts in MetaPost labels if you use MetaPost through Lua(La)TeX.

As it was noted in the comments, thanks to Dohyun Kim the btex … etex flags are not recognized by luamplib, but in the recents versions it goes much further than that: luamplib now includes a textext function that is pretty much the same as its namesake in MetaFun/ConTeXt.

Like the btex … etex flags, textext() (which takes a string of characters as argument) uses by default the fonts of the current Lua(La)TeX document, OpenType or not, to typeset the labels. But it has two big advantages on the btex … etex flags:

  • it allows the treatment of variables in labels; see Metapost label based on variable value
  • if you issue the \mplibtextextlabel{enable}, it is enough to give the string itself as argument to the label commands; textext is called to typeset it, but in the background. Very handy if you have a great bunch of labels to handle!

So the following program:

\documentclass[12pt]{scrartcl}
\usepackage{unicode-math}
    \setmainfont{XITS}
    \setmathfont{XITS Math}
\usepackage{luamplib}
\begin{document}
\begin{mplibcode}
beginfig(1);
    label(textext("Pythagorean addition: $a^2+b^2 = c^2$."), origin);
endfig;
\end{mplibcode}
\end{document}

gives exactly the same result as this one:

\documentclass[12pt]{scrartcl}
\usepackage{unicode-math}
    \setmainfont{XITS}
    \setmathfont{XITS Math}
\usepackage{luamplib}
    \mplibtextextlabel{enable}
\begin{document}
\begin{mplibcode}
beginfig(1);
    label("Pythagorean addition: $a^2+b^2 = c^2$.", origin);
endfig;
\end{mplibcode}
\end{document}

That is, with this example you get 12pt-sized OpenType text and math fonts from XITS (which are themselves adaptation of the STIX fonts) in the label:

enter image description here

Aside from ConTeXt, it is also possible to include OpenType fonts in MetaPost labels if you use MetaPost through Lua(La)TeX.

As it was noted in the comments, thanks to Dohyun Kim the btex … etex flags are now recognized by luamplib, but in the recents versions it goes much further than that: luamplib now also includes a textext function that is pretty much the same as its namesake in MetaFun/ConTeXt.

Like the btex … etex flags, textext() (which takes a string of characters as argument) uses by default the fonts of the current Lua(La)TeX document, OpenType or not, to typeset the labels. But it has two big advantages on the btex … etex flags:

  • it allows the treatment of variables in labels; see Metapost label based on variable value
  • if you issue the \mplibtextextlabel{enable}, it is enough to give the string itself as argument to the label commands; textext is called to typeset it, but in the background. Very handy if you have a great bunch of labels to handle!

So the following program:

\documentclass[12pt]{scrartcl}
\usepackage{unicode-math}
    \setmainfont{XITS}
    \setmathfont{XITS Math}
\usepackage{luamplib}
\begin{document}
\begin{mplibcode}
beginfig(1);
    label(textext("Pythagorean addition: $a^2+b^2 = c^2$."), origin);
endfig;
\end{mplibcode}
\end{document}

gives exactly the same result as this one:

\documentclass[12pt]{scrartcl}
\usepackage{unicode-math}
    \setmainfont{XITS}
    \setmathfont{XITS Math}
\usepackage{luamplib}
    \mplibtextextlabel{enable}
\begin{document}
\begin{mplibcode}
beginfig(1);
    label("Pythagorean addition: $a^2+b^2 = c^2$.", origin);
endfig;
\end{mplibcode}
\end{document}

That is, with this example you get 12pt-sized OpenType text and math fonts from XITS (which are themselves adaptation of the STIX fonts) in the label:

enter image description here

Fixed typo and improved text (I think)
Source Link
Franck Pastor
  • 18.8k
  • 1
  • 48
  • 74
Loading
Source Link
Franck Pastor
  • 18.8k
  • 1
  • 48
  • 74
Loading