mnemosyne-proj / mnemosyne

Mnemosyne: efficient learning with powerful digital flash-cards.

Home Page:https://mnemosyne-proj.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

latex complains about "Undefined control sequence."

matkoniecz opened this issue · comments

From logs when mnemosyne is run in command line and I tried to sync (it later fails, though likely for a different reason)

Command `latex -interaction=nonstopmode tmp.tex` failed with rc=1
Command output:
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=latex)
 restricted \write18 enabled.
entering extended mode
(./tmp.tex
LaTeX2e <2020-02-02> patch level 2
L3 programming layer <2020-02-14>
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo))
(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-dvips.def)
No file tmp.aux.
! Undefined control sequence.
<recently read> \mathcalc 
                          
l.5 $\mathcalc
              {O}(log n)$
[1] (./tmp.aux) )
(see the transcript file for additional information)
Output written on tmp.dvi (1 page, 300 bytes).
Transcript written on tmp.log.

Command input:

\documentclass[12pt]{article}
\pagestyle{empty}
\begin{document}
$\mathcalc{O}(log n)$
\end{document}

Something is wrong in your latex code. First make sure latex can compile tmp.tex outside of Mnemosyne, perhaps adding required packages if needed. (You can add these to config.py in the latex preamble setting)

Hmm, I thought that if it renders fine in mnemosyne then things failing here would be a bug

screen

This is even after deleting the _latex folder? It can't give a latex compile error and show up fine at the same time. Perhaps you're confusing with a different card?

This is even after deleting the _latex folder?

Yes

It can't give a latex compile error and show up fine at the same time.

I am looking at it on PC and latex compile erorr appears during attempt to sync with mobile phone. Is it possible that PC is using some latex compilation not used by mobile sync? And mobile sync making different images?

I have never seen anything on mobile as sync failed.

Perhaps you're confusing with a different card?

mathcalc{O}(log n) appears in exactly one card - I enabled all tags and searched for it to confirm this

screen01

For sync, the server/desktop uses exactly the code. However, what could happen is that config.py on your phone has a different latex_preamble than on your desktop. Perhaps that's the issue? (missing use-package?)

Android App is installed straight from Google Play.

I also have not modified config.py file (EDIT: on PC) and it contains

latex_preamble = r"""
\documentclass[12pt]{article}
\pagestyle{empty}
\begin{document}"""

# Latex postamble.
latex_postamble = r"""\end{document}"""

# Latex command.
latex = "latex -interaction=nonstopmode"

# Latex dvipng command.
dvipng = "dvipng -D 200 -T tight tmp.dvi"

BTW, thanks for https://mnemosyne-proj.org/help/adding-media.php - it allowed me to easily locate preamble

But your preamble on the desktop might have been modified to include e.g. a missing usepackage, In that case, you need to make the same change on your phone.

But your preamble on the desktop might have been modified

I have not modified PC preamble at all (I quoted from PC preamble, for mobile I have no idea where it is stored)

If all 4 latex-related entries in config.py are unchanged from the default, then I'm out of ideas. There should be no reason in that case why viewing a card and preparing it for sync are any different. To be really sure, just delete config.py on your pc, and it will be recreated.