Consider the expression \mathscr{APPLE}. This should render as follows:

enter image description here

Yet in org-mode (using latex fragment previews), it renders as:

enter image description here

Moreover, when exporting, matscr renders properly in HTML (when viewed in a browser), but does not render properly when exporting to pdf! How does one fix this behavior?

EDIT: Certain unicode characters also fail to render properly. For example $\phi$ renders fine but $ϕ$ does not render fine. I hope these errors are related so that fixing one fixes the other.

EDIT2: I get the following error message when using the settings suggested by Omar: link.

EDIT3: The more specific error I'm getting (after checking *Org Preview LaTeX Output* buffer is:

! Fatal fontspec error: "cannot-use-pdftex"
! The fontspec package requires either XeTeX or LuaTeX.
! You must change your typesetting engine to, e.g., "xelatex" or
! "lualatex"instead of plain "latex" or "pdflatex".
! See the fontspec documentation for further information.
! For immediate help type H <return>.
  • Re: Edit2 error: have you installed dvisvgm? – NickD Aug 27 '18 at 1:44
  • Org depends on external facilities to do all this. You seem to expect to be able to customize org-mode and solve all the problems. That is not the case: you have to install all the external tools that are needed AND customize org-mode to use them. Just setting your expectations here. – NickD Aug 27 '18 at 1:47
  • @NickD: Yes, dvisvgm is installed. – George Aug 27 '18 at 2:48
  • 1
    There are two separate questions here which need separate answers: (a) rendering of mathscr (b) use of unicode-math. Omar's answer works for the first case in a standard set-up. The solution to (b) is more involved and less clear. – Andrew Swann Aug 29 '18 at 8:08
  • @George After EDIT3, I think you misunderstood what you were supposed to do with the '(org-preview-latex-process-alist (quote ...)). That's a fragment of a custom-set-variables form, so you need to wrap it like so: (custom-set-variables '(org-preview-latex-process-alist (quote ...))). – Omar Aug 29 '18 at 14:25

The \mathscr problem is simply that Org mode LaTeX doesn't by default load the LaTeX package that provides that command. Just add #+LATEX_HEADER: \usepackage{mathrsfs} to your Org file and that should fix both preview and PDF export.

As for getting unicode math to work, you need, again, to load a package (so add #+LATEX_HEADER: \usepackage{unicode-math} to your Org file), but there's a wrinkle this time: the unicode-math package doesn´t work with pdflatex, only xetex or luatex, so you additionally need to customize the org-latex-pdf-process variable (for PDF export) and the org-preview-latex-process-alist and org-preview-latex-default-process variables (for LaTeX preview) to choose one of those compilers.

  • (setq org-preview-latex-default-process 'luatex) yields error "cond: Unknown conversion process luatex for LaTeX fragments". Am I not using it correctly? – George Aug 24 '18 at 15:37
  • Unfrotunately, it's quite a bit more complicated than that @George. :( Try the setting suggested in this Emacs SE answer. – Omar Aug 24 '18 at 16:01
  • I get the following error message when using these settings: link. – George Aug 26 '18 at 21:46
  • @George: I got the same error message. :( The process also left a buffer named *Org Preview LaTeX Output* that contained the message: "DVI error: DVI format 6 not supported". I found this question related to that error message. – Omar Aug 27 '18 at 17:14
  • After checking *Org Preview LaTeX Output* it appears I'm getting a different error. See my post above edited. – George Aug 27 '18 at 20:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.