[lltx] wrong baseline if text in luamplib graphic

Stephan Hennig mailing_list at arcor.de
Sun Jun 30 19:19:18 CEST 2013


Am 29.06.2013 02:29, schrieb Dohyun Kim:
> 2013/6/29 Stephan Hennig <mailing_list at arcor.de>:
>>
>> Compiling the .tex file with LuaLaTeX, the g sits completely on top
>> of the line.
>> 
> That is a bug of luamplib package. Please apply the following patch
> until the packge is updated.

Thank you!

Let me add a related RFE.  When including graphics with environment
mplibcode in TeX, the bottom of a graphic's bounding box is aligned with
the current base line in TeX.  This is sometimes not what one wants,
i.e., when the graphic contains text with letters that have descenders.
 Such text doesn't nicely line-up with text in TeX.

I propose an optional argument 'baseline' to the mplibcode environment
with valid values bottom, top, center, xaxis (I don't care the names).
With values bottom, top, center the graphic should be aligned with
bottom, top or the center of the bounding box at TeX's current base
line.  With value xaxis, the graphic should be aligned so that the
x-axis of MetaPost's coordinate system is aligned with TeX's current
base line.  This is useful, since -- within MetaPost -- btex .. etex
aligns TeX text with the base line at the x-axis.

An additional optional argument 'voffset' could be used to shift the
graphic vertically by an absolute amount in TeX relative to the base
line as determined by option 'baseline'.

As a bonus, argument 'baseline' could accept numeric values that let one
specify the base line relative to vertical picture size.  That would
give the following corresponding values:

  0   <==>  bottom
  0.5 <==>  center
  1   <==>  top

But allows for more fine grained control of the base line.

There should be means to set global default values, so that they need
not be applied to every mplibcode environment.

I know all this can be achieved from within MetaPost manipulating the
bounding box using the 'setbounds to' command.  But I think alignment is
frequently not a property of the graphic itself, but of the embedding
document/application.  So, a TeX interface seems desirable.

What do people think?

Best regards,
Stephan Hennig


More information about the lualatex-dev mailing list