TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to create an electrical phase symbol in ConTeXt like that produced by the \phase{} command from LaTeX's steinmetz package.

Here is what the symbol looks like:

Is there something out there already or do I need to brew my own? If I do, suggestions would be appreciated. I'm relatively new to ConTeXt and MetaPost.

Here is the meat from the steinmetz package, for reference.

\stm@phasetot=\stm@phasedp \advance\stm@phasetot .35ex \advance\stm@phasetot\stm@phaseht
\stm@phasewd=\wd\stm@phasebox \advance\stm@phasewd .5\stm@phasetot
\setbox\stm@phasebox=\vbox to\stm@phaseht{
        \dimen@ .5\stm@phasetot \edef\ph@dx{\strip@pt\dimen@}%
\advance\stm@phasedp .35ex \advance\stm@phasedp .6pt
\dp\z@=\stm@phasedp \box\stm@phasebox}
share|improve this question
Welcome to TeX.sx! – Torbjørn T. Mar 5 '13 at 19:08
In the documentation for MakeCirc, there appears to be a command \modarg which looks like it could be used for this. Unfortunately I couldn't get the package to work, so I cannot confirm it. – morbusg Mar 8 '13 at 6:43

The following gives something like usable results:

  picture p;
  pair zu, zl;
  numeric delta, width;
  path roof;
  width = 2.5 pt;
  p := \MPbetex{txt};
  zl := llcorner (p); zu := ulcorner (p);
  delta := ypart(zu) - ypart(zl);
  roof := zu -- zl + (-delta - width, -width) -- lrcorner (p) + (0, -width);
  pickup pencircle scaled 0.7pt;
  draw roof withcolor black;
  draw p withcolor black;

  \setMPtext{txt}{$ #1 $}
  \hbox{\lower 4pt \hbox{\useMPgraphic{formula}}}


\putfm {1+2+3+4}

Lorem ipsum dolor sit amet, consectetuer \putfm {1-2-3-4-5} adipiscing
elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae,
felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget,
consectetuer id, vulputate a, magna. Donec vehicula augue eu
neque. Pellentesque habitant morbi tristique \putfm {\{a,b\}} senectus
et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras
viverra metus rhoncus sem. Nulla et lectus vestibulum urna fringilla
ultrices.  Phasellus eu tellus sit amet tortor gravida
placerat. Integer sapien est, iaculis in, pretium quis, viverra ac,
\putfm {1+2+3+4+5} nunc. Praesent eget sem vel leo ultrices
bibendum. Aenean faucibus.  Morbi dolor nulla, malesuada eu, pulvinar
at, mollis ac, nulla.  Curabitur auctor semper nulla. Donec varius
orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagittis
quis, diam. Duis \putfm {\Sigma x_i} eget orci sit amet orci dignissim



enter image description here


  1. I'm not really familiar with setting Metapost graphics inline, and there is clearly too much horizontal space in the above when the formula is set inline. Using setbounds in Metapost will give control over the resulting bounding box. I didn't fiddle with this, because what you want will depend on how you are putting these formula inline, and perhaps you don't want to do that at all;
  2. The last formula, with the \Sigma, has the Steinmetz line too close to the formula inside.
  3. The last and third-from-last formulae have the wrong baseline, because their formulae inside have a different depth which the code doesn't handle. To handle this requires more complex code, such as setting inside a box register, looking at the depth, and doing a \raise dependent on this value. I can try to fix this if it is important. The Latex steinmetz code you posted seems to do this and this is worth fixing.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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