0

Can you render http://github.com/Anton-Latukha/haskell-notes/README.org using M-x org-latex-preview on the inline math expressions using Org version > 9.0 default settings?

For me, I get a weird rendering on the inline \(\) math expressions when I do M-x org-latex-preview on them wherein an image of TLT TLT and then the math expression rendered about one line below that happens in every inline math expression. Can you just tell me if the math expressions render normally for you? That way I'll know that I have something weird in my environment or config. Note: I deleted the ltximg directory that org-preview-latex feature automatically creates, so that wasn't it.

The file referenced in the subject line is the only place this happens. I can copy an inline math expression from that file and put it in a different file and it renders fine, i.e., without the TLT TLT image.

For backstory, I've ruled out or had answered my previous related questions:

org-preview-latex rendering weirdness when a space after initial inline expression delimiter

and

https://tex.stackexchange.com/questions/551266/strange-rendering-of-latex-fragments-in-org-mode-buffer

which led up to this special case. It only happens in this file.

  • 1
    Try taking out a single \(...\) expresion at a time and putting them in a separate file, without all the baggage that he has included in the document. I bet you will have much better luck. IOW, it's not the math expressions that cause any of the problems: it's all the other stuff that he has put into the file. I extracted all the formulas from the first 2400 lines or so of the file (about 30 expressions), put them all into one org file and did C-c C-x C-l`: nice previews of all of them. – NickD Jun 27 at 1:51
  • 1
    Here's another hint: change all the #+latex_header: lines to #+latex_header_extra: lines (so that they don't affect preview). There will stilll be problems, but it's much better (and you don't need LuaTeX to process the fragments, although you will still need it if you decide you want to export the file). – NickD Jun 27 at 1:56
  • @NickD, thanks for the tip about #+latex_header_extra. Also thanks for all your help per the investigation you did per your first comment above! – Joe Jun 28 at 0:23
0

I resolved this issue with some key help from @David Carlisle's comment to my earlier question here: https://tex.stackexchange.com/questions/551266/strange-rendering-of-latex-fragments-in-org-mode-buffer. The TLT TLT image indicates the direction of the language.

Looking through the file in question, I noticed that there is a latex header option set in this particular file of:

#+latex_header: \setotherlanguage{arabic}    % Especially right-to-left languages must be activated after all packages loaded

Commenting out that latex_header directive solved the issue. Well, that and using luatex and not the default Org org-preview-latex-process-alist and instead using the one referenced here: https://stackoverflow.com/questions/41568410/configure-org-mode-to-use-lualatex/56851313#56851313.

Why luatex was required and it wouldn't work with Org's default latex and dvipng setup is not clear to me. Unicode math symbols maybe somewhere in that file perhaps? I don't yet know.

Update: This link, https://tex.stackexchange.com/a/72/31810, goes into the differences between latex, pdflatex, xelatex, and lualatex. It appears since arabic is supported in the file in question and lualatex is known to support arabic particularly well, in addition to unicode, that may be why I found success using lualatex. Of course the author of the file is using a setup that handles that latex_header I had to comment out just fine, so I am still in search of a better config to handle this file without having to comment out the use of #+latex_header: \setotherlanguage{arabic}, but at least I can render this particular file with it commented out. If you know of what I need to do to make it work without commenting that out, please let me know in comments.

| improve this answer | |

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.