Unicode 配置组织模式以使用LuaLaTeX
我正在使用emacs的组织模式来排版笔记,并通过LaTeX导出pdf格式。除了使用Unicode符号外,一切都很好,比如Unicode 配置组织模式以使用LuaLaTeX,unicode,emacs,latex,org-mode,Unicode,Emacs,Latex,Org Mode,我正在使用emacs的组织模式来排版笔记,并通过LaTeX导出pdf格式。除了使用Unicode符号外,一切都很好,比如 \begin{equation} \left( \frac{P^2}{2m} + V(x,y,z) \right) Ψ = E Ψ \end{equation} 其中我使用ψ。使用#+latex\u编译器:lualatex和 (setq org-latex-pdf-process '("lualatex -shell-escape -interaction
\begin{equation}
\left( \frac{P^2}{2m} + V(x,y,z) \right) Ψ = E Ψ
\end{equation}
其中我使用ψ
。使用#+latex\u编译器:lualatex
和
(setq org-latex-pdf-process
'("lualatex -shell-escape -interaction nonstopmode %f"
"lualatex -shell-escape -interaction nonstopmode %f"))
我已经设法使用LuaLaTeX导出到PDF,但公式的预览(C-C-x C-l
)对于使用Unicode符号的公式完全被破坏了
我需要在emacs配置中进行哪些更改才能在
组织模式下使用LuaLaTeX处理与LaTeX相关的所有内容?将以下代码添加到您的初始文件中(注意,它会向组织预览LaTeX流程列表的值添加一个元素,因此必须在加载组织后添加此代码-您可能还需要(require'org)):
我必须添加一个启用数学的字体(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}
导出为PDF和预览似乎都能正常工作。我将windows 10与Emacs 26.1结合使用,@NickD的解决方案对我有效,只做了一些小改动
(setq org-latex-pdf-process
'("lualatex -shell-escape -interaction nonstopmode %f"
"lualatex -shell-escape -interaction nonstopmode %f"))
(setq luamagick '(luamagick :programs ("lualatex" "magick")
: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 ("magick 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)
使用而不是转换
convert
不起作用,因为有一个名为convert.exe的默认windows程序
顺便说一句,这个机制是冯舒在2016年5月添加的,所以你需要一个相当新的组织才能使用它。对于org的早期版本,您需要修改org代码本身。
(setq org-latex-pdf-process
'("lualatex -shell-escape -interaction nonstopmode %f"
"lualatex -shell-escape -interaction nonstopmode %f"))
(setq luamagick '(luamagick :programs ("lualatex" "magick")
: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 ("magick 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)