Closed gromadan closed 3 years ago
Unfortunately, we must to accept this as the feature of OpTeX because there are limitations of features of TeX and luaTeX. The decision in OpTeX is: to set catcode of _
as letter, because we want to have simple access to the control sequences like \_foo
or \_foo_AB
or \foo_AB
On the other hand we want to keep the math behavior of _
, so it is set as math-active character with meaning "math subsript" and the occurrences of \int_a^b
or \int_{ab}^c
are transformed to \int _a^b
or \int _{ab}^c
by lua pre-processor. See the technical documentation about it for more details.
Unfortunately, LuaTeX is able to intitalize its lua preprocessors only after first line of the document is already read. So, the preprocessor works from second line line in whole document. This is reason of your problems: if your math is written to second (or more) line of your document then preprocessor works.
Moreower, we suppose that user write \sum_k A
becuase \sum_kA
is less readable in source code. So, we were decided that preprocessor ignores the occurrences of \foo_more_than_one_letter
. User can define his/her own macros of type \mymacro_first
, \mymacro_second
.
If you need not to use any control sequence with _
in its name in your document then you can set \mathsboff \catcode
=8at the beginning of your document. Then the behaviour of
` in math is exactly as in plain TeX.
I will add more information about it into the documentation.
Using the underscore for making a lower index after some control sequence (such as
sum
) causes some random errors sometimes.For example
yields an error, while
works fine.
Some more likely issue:
yields an error, while
works fine.
Also
\sum_kA
yields an error, while\sum_k A
is fine.I am not sure if this is an easily repairable bug, or whether it is an unavoidable consequence of changing the category of the underscore. From the user point of view, it is surely easily solvable by just adding the space as I mentioned. But it might be slightly confusing that a formula, which works well in plainTeX as well as LaTeX, does not work here.