Differences Between Theorems Modules (AMS and non AMS)
Jean-Marc Lasgouttes
lasgouttes at lyx.org
Thu Sep 15 15:50:16 UTC 2022
Le 15/09/2022 à 14:17, Udicoudco a écrit :
> Hello again,
>
> I took a look at the Named Theorems Module today, and the LaTeX code
> there seems to be a bit strange. In the preamble of the layout Named
> Theorem there is the following code:
>
> \newcommand\thmsname{\protect\theoremname}
> \newcommand\nm at thmtype{theorem}
> \theoremstyle{plain}
> \newtheorem*{namedtheorem}{\thmsname}
> \newenvironment{namedthm}[1][Undefined Theorem Name]{
> \ifx{#1}{Undefined Theorem Name}\renewcommand\nm at thmtype{theorem*}
> \else\renewcommand\thmsname{#1}\renewcommand\nm at thmtype{namedtheorem}
> \fi
> \begin{\nm at thmtype}}
> {\end{\nm at thmtype}}
Hi again Udi,
This module has been proposed in ticket 6279
https://www.lyx.org/trac/ticket/6279
Updating and fixing it would be great. I think that the LabelString
could be empty, so that it is clear that the argument inset will be used
as a label. And the default could be set to "theorem", for example.
Feel free to propose a replacement.
JMarc
>
> \ifx is not really a macro with two arguments, but it is only looking
> at the next two tokens, it compares the token { with the one after it,
> which causing, in this situation, to get always the false output.
>
> This means that if a user would not give a name via the optional
> argument, the output theorem will have a label "Undefined Theorem
> Name", which I don't think is the preferable outcome (and it might not
> be what the author of the module meant as well).
>
> In addition, note that if there was a case that the true case was
> happening, the environment theorem* is not defined anywhere in the
> module, which will cause a LaTeX Error: Environment theorem*
> undefined.
>
> I think it is reasonable to change this module in a way that if the
> optional argument is empty, the output would be a theorem with the
> label "Theorem".
>
> This way, there is only need for one layout in this module, the Named
> Theorem layout, Since the Theorem* layout defined there would be
> achievable with the Named Theorem with the default optional argument
> (or by setting it to Theorem).
>
> Also note that every line that does not end with a control word, TeX
> will see a n end-of-line character, hence will add an (what i believe
> to be in this case, an undesired) space (since space after control
> words are ignored). So in the current code, there are also a few extra
> spaces in the environment namedthm.
>
> Best Regards,
> Udi
More information about the lyx-devel
mailing list