Le 24/10/2015 17:17, Guy Rutenberg a écrit :
Hi,
I've encounter a minor bug in the previewing of math macro: That is,
after you create a math macro it would normally exapand the macro in
normal math mode to the LyX representation of the macro. However, if the
macro name is a single digit (e.g. \1) LyX wouldn't preview the macro.
Apart form that, the document will compile fine.
My guess this bug originates from TeX allowing letter-strings for macro
names, however it also allows single non-letter characters.
The command must begin with an escape character (category code
<https://en.wikibooks.org/w/index.php?title=Category_code&action=edit&redlink=1>
0)
and be composed of a series of letters (category code
<https://en.wikibooks.org/w/index.php?title=Category_code&action=edit&redlink=1>
11)
or one single non-letter, following the escape character.
(https://en.wikibooks.org/wiki/TeX/def).
If someone could point me in the right direction in the source, I'll
happily attempt to fix it myself.
Thanks.
Guy
Hi Guy,
Thank you for your proposition. I only encountered macro templates
briefly. If I were you I would start fiddling with the function
validName() in mathed/MathMacroTemplate.cpp and any location where it is
used. I am not an expert of the macro code, so maybe other issues will
arise.
It seems that LyX is already aware of the proper format when typing
macros in mathed. The bug is then that macro templates do not use the
same macro name format as in mathed. We happened to be discussing a
related issue in <http://www.lyx.org/trac/ticket/8567> where the macro
name is deleted on opening if it is invalid, so this is also something
to keep an eye on.
Guillaume