slatex / sTeX

A semantic Extension of TeX/LaTeX
50 stars 9 forks source link

smsmode regression (probably with listings) #280

Closed kohlhase closed 3 years ago

kohlhase commented 3 years ago

when formatting .../MathHub/MiKoMH/TDM/source/doccomp/en/perl.tex, I get


(/Users/kohlhase/localmh/MathHub/MiKoMH/TDM/source/doccomp/en/sed.tex)
./perl.tex:5: Incomplete \ifx; all text was ignored after line 28.
<inserted text> 
                \fi 
l.5 ...odule[path=doccomp/en/sed]{sedstreameditor}

./perl.tex:21: LaTeX Error: \begin{@module} on input line 4 ended by \end{module}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.21 \end{module}

./perl.tex:21: Missing } inserted.
<inserted text> 
                }
l.21 \end{module}

)
! Emergency stop.
<*> \input perl.tex

!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on perl.log.

The problem seems to be in import of ./sed.tex, which contains listings, but if formatted alone, that gives no problems.

Jazzpirate commented 3 years ago

I can't get sed.tex to work either... I get Module program-execution not loaded in GenICT/source/python/nutshell.tex. MiKoMH/TDM and MiKoMH/GenICT are up to date...

kohlhase commented 3 years ago

I cannot reproduce your problem. pulled/pushed all, does that help you?

kohlhase commented 3 years ago

I am on master BTW

Jazzpirate commented 3 years ago

pulled everything, still doesn't work though :/ Seemes also related to lstlistings though, wil investigate...

Jazzpirate commented 3 years ago

Okay, I think I've gotten to the root of the problem now, but I currently have no solution:

  1. In order for TeX to not throw errors due to unknown unicode tokens in smsmode, \lstinline and lstlisting-environments need to be "executed", to add required support for unicode characters.
  2. \lstinline and lstlisting-environments can activate math escape, in which case arbitrary macros can occur in its body, which (in smsmode) are not necessarily defined, leading to very unexpected behaviour

I think the correct solution is to not allow lstlisting in smsmode after all, and instead allow for arbitrary unicode in smsmode. Will need to figure out how to do that...

kohlhase commented 3 years ago

I have converted to \lstinputmhlisting and that works for me. I have the feeling that your implementation of \lstinine only works as \lstinline|...| but not with \lstinline!...!. I have also eliminated almost all of these but there is still one in .../sed.tex with

\lstinline!.*\.html|.*\.txt!

where I cannot,.

Jazzpirate commented 3 years ago

I have the feeling that your implementation of \lstinine only works as \lstinline|...| but not with \lstinline!...!.

No, that wasn't it. I'm now working on a solution by ignoring everything lst again, and instead temporarily redefining \PackageError (which is what inputenc uses to throw unicode errors) - not the nicest solution, but it's probably within the intended specification of smsmode...

Jazzpirate commented 3 years ago

"solved" in last push. listings are now being ignored again, but PackageError is disabled in smsmode, which should suppress the unicode errors in listings. Notably, this will also suppress sTeX errors, but that should be no problem, since these will reappear when the module being read is actually activated subsequently...

kohlhase commented 3 years ago

excellent, thanks.