Red*_*son 2 unicode emacs latex org-mode
我正在使用 emacsorg-mode排版注释并通过 LaTeX 将它们导出为 pdf。一切正常,除非我使用 Unicode 符号,例如
\begin{equation}
\left( \frac{P^2}{2m} + V(x,y,z) \right) ? = E ?
\end{equation}
Run Code Online (Sandbox Code Playgroud)
我在哪里使用?. 使用#+latex_compiler: lualatex和
(setq org-latex-pdf-process
'("lualatex -shell-escape -interaction nonstopmode %f"
"lualatex -shell-escape -interaction nonstopmode %f"))
Run Code Online (Sandbox Code Playgroud)
我已经设法使用 LuaLaTeX 将或多或少的问题导出到 PDF,但是C-c C-x C-l对于带有 Unicode 符号的公式()的预览完全中断。
我需要在我的 emacs 配置中进行哪些更改才能将 LuaLaTeX 用于与 LaTeX 相关的所有内容org-mode?
将以下代码添加到您的 init 文件中(注意,它向 org-preview-latex-process-alist 的值添加了一个元素,因此必须在加载 org 后添加此代码- 您可能还需要(需要 'org)) :
;; lualatex preview
(setq org-latex-pdf-process
'("lualatex -shell-escape -interaction nonstopmode %f"
"lualatex -shell-escape -interaction nonstopmode %f"))
(setq luamagick '(luamagick :programs ("lualatex" "convert")
:description "pdf > png"
:message "you need to install lualatex and imagemagick."
:use-xcolor t
:image-input-type "pdf"
:image-output-type "png"
:image-size-adjust (1.0 . 1.0)
:latex-compiler ("lualatex -interaction nonstopmode -output-directory %o %f")
:image-converter ("convert -density %D -trim -antialias %f -quality 100 %O")))
(add-to-list 'org-preview-latex-process-alist luamagick)
(setq org-preview-latex-default-process 'luamagick)
Run Code Online (Sandbox Code Playgroud)
我不得不添加一个支持数学的字体 (XITS),所以 org 文件本身现在看起来像这样:
#+LATEX_HEADER: \usepackage{unicode-math}
#+LATEX_HEADER: \setmainfont{XITS}
#+LATEX_HEADER: \setmathfont{XITS Math}
#+LATEX_HEADER: \setmathfont[range={\mathcal,\mathbfcal},StylisticSet=1]{XITS Math}
* A formula for lua
\begin{equation}
\left( \frac{P^2}{2m} + V(x,y,z) \right) ? = E ?
\end{equation}
Run Code Online (Sandbox Code Playgroud)
导出为 PDF 和预览似乎都有效。