[metapost] TeX formulas and withpen

Petr Kalinin petr at kalinin.nnov.ru
Thu Oct 1 17:18:58 CEST 2009

Hello,

The following code

beginfig(1)
draw btex $\sqrt a \over b$ etex withpen pencircle scaled 2pt;
endfig

produces a formula with very thick lines in the fraction and in the
square root sign over a. This seems very strange for me. Is there any
way to override this without changing the actual draw command?

I have experimented with generated .mpx file and this seems to root from
the possibility to override pen when drawing a picture, like following:

picture p;
p:=nullpicture;
addto p doublepath (0,0)--(1cm,0) withpen pencircle scaled 0.4;
draw p withpen pencircle scaled 2pt;

which results in a thick line, while removing "withpen pencircle scaled
2pt" results in a thin line.

In fact, I was using GnuPlot to produce metapost output, and have found
that GnuPlot changes the currentpen via drawoptions, thus affecting also
the text typesetted via btex/etex. As a result, the lines in my
fractions have different widths depending on the last plot line drawn
before them. Can you suggest any way to override this problem?

--
Thanks,
Petr Kalinin,
petr at kalinin.nnov.ru