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@thmtype{theorem}
    \theoremstyle{plain}
    \newtheorem*{namedtheorem}{\thmsname}
    \newenvironment{namedthm}[1][Undefined Theorem Name]{
      \ifx{#1}{Undefined Theorem Name}\renewcommand\nm@thmtype{theorem*}
      \else\renewcommand\thmsname{#1}\renewcommand\nm@thmtype{namedtheorem}
      \fi
      \begin{\nm@thmtype}}
      {\end{\nm@thmtype}}

\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
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to