1

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>. !............................................... 
7
  • Re: Edit2 error: have you installed dvisvgm? Commented Aug 27, 2018 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. Commented Aug 27, 2018 at 1:47
  • @NickD: Yes, dvisvgm is installed. Commented Aug 27, 2018 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. Commented Aug 29, 2018 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 ...))). Commented Aug 29, 2018 at 14:25

1 Answer 1

3

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.

7
  • (setq org-preview-latex-default-process 'luatex) yields error "cond: Unknown conversion process luatex for LaTeX fragments". Am I not using it correctly? Commented Aug 24, 2018 at 15:37
  • Unfrotunately, it's quite a bit more complicated than that @George. :( Try the setting suggested in this Emacs SE answer. Commented Aug 24, 2018 at 16:01
  • I get the following error message when using these settings: link. Commented Aug 26, 2018 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. Commented Aug 27, 2018 at 17:14
  • After checking *Org Preview LaTeX Output* it appears I'm getting a different error. See my post above edited. Commented Aug 27, 2018 at 20:56

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.