Jürgen Spitzmüller schrieb:

"iiii" is always the shortest 4 character string, while "WWWW" is always
the widest one.

Well, if I only have one 4-char nomencl inset, and this has "iiii", I do not want the length to be "WWWW", do I?

When I have "iiii" as recognized widest label but also have a label "WWW" the 
space would not be enough.
But OK with your solution this doesn't occur. But there is still a remaining 
problem: You use

theFontMetrics(Font()).width(symbol);
in line 246 of InsetNomencl.cpp
while
it is stated in a command in line 215 of InsetBibitem.cpp that this could fail 
in a certain case.

 > Why do you forbid to go under the predefined?

To have a consistent output. In most cases the 1 cm width is enough, so we
have to assure that this width is not undergone, for example when you have
several nomenclatures. I'll send you this evening a LyX example file, to
show what I mean.

I still don't understand. Why shouldn't I be allowed to set a narrower width? This looks plain arbitrary to me.

See the attached example LyX file. The first and second nomenclature have a consistent width, while the third one is what you would get without the ifthen check. I mean the user defines a certain width, so the automatic calculation shouldn't calculate something different, only if this is really needed.

Why is ifthen complicated?

It adds unnecessary LaTeX code and an unnecessary package dependency.

The package dependency is no problem, since ifthen is part of every distribution and there aren't known incompatibilities, and we use ifthen for other purposes as well.

No. A too wide result will be returned for every string who has many rather small letters, and given the frequency of "i" and "l", I think this is no exceptional case at all.

My tests show that your method is indeed the better solution, so fine with me when the remaining issue is clear, see above.

No we have to assure that the width is never below the predefined value.
But to be correct, I'll change the hardcoded "1cm" to the one that is
actually defined in nomencl.cfg, that's only one more line.

So you parse the nomencl.cfg file?

I now removed the hardcoded value of 1cm but use the value in nomencl.cfg. I know this value since this is written to \nomlabelwidth when the nomencl package is loaded in the preamble.
Besides this on MiKTeX there is no nomencl.cfg.

regards Uwe

Attachment: printnomencl.lyx
Description: application/lyx

Reply via email to