Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sagemath and tex4ebook #108

Open
apaeffgen opened this issue Jun 16, 2023 · 2 comments
Open

sagemath and tex4ebook #108

apaeffgen opened this issue Jun 16, 2023 · 2 comments

Comments

@apaeffgen
Copy link

I tried successfully to convert a tex-file with sagemath included.
Unfortunately i had to change the ending from tex to txt. The Testfile is attached below.
I am new to tex4ebook, so i do not know, what is going on behind, but i experience the following glitches.

  1. Comiling with tex4ebook test.tex produces errors
  2. tex4ebook -x test.tex in the first step works
  3. Afterwords sage has to be envoked. That works
  4. tex4ebook -x test.tex produces an error in the second step
  5. tex4ebook test.tex afterwords works. When the process produced all necessary pictures the -x option works as well without any error.
    Hopefully someone can reproduce the problem and show some inside why this happens and how to avoid it?
    See the original testfile and the shortend error-log

test.txt
ErrorLog.txt

@apaeffgen
Copy link
Author

In the first steps i ended up with a cut epub-file.

Now i can not reproduce the error myself again. Now it works in all steps without the -x flawlessly.
Are there some caches? Or what could be the reason?

The errors had been warnings about the domfilter and cut of the epub file i half, leaving the whole file unusable.

[WARNING] domfilter: DOM parsing of testch5.xhtml failed:
[WARNING] domfilter: ...ive/2022/texmf-dist/tex/luatex/luaxml/luaxml-mod-xml.lua:175: Unbalanced Tag (/mtext) [char=12730]

@michal-h21
Copy link
Owner

You certainly don't need the -x option, this is necessary only if you use commands that require XeTeX. I think your document should work even with the default PDFTeX driver, or with the -l option. Anyway, I've found that the issue with MathML is caused by the \TeX command used in math text. The following configuration file should fix that:

\Preamble{xhtml}
\catcode`\:=11
\def\TeX{\ifmathml
   \ifmtext  TeX\else\HCode{<\a:mathml mtext
      \mml:class="TeX">TeX</\a:mathml mtext>}\fi\else \mml:TeX\fi}
\catcode`\:=12
\begin{document}
\EndPreamble

Compile using:

 $ tex4ebook -c config.cfg test.tex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants