windows spacemacs实现org-mode转latex,然后生成pdf

xiaoxiao2021-02-28  126

spacemacs默认英文字体做如下修改安装了完整版ctex套装spacemacs增加layer –> latex增加windows的path路径。解决org-mode里中英文等宽问题。latex编译命令,pdf预览等。实现了org转tex。org文件头增加下述信息

spacemacs默认英文字体做如下修改

dotspacemacs-default-font '("Courier New" :size 13 :weight normal :width normal :powerline-scale 1.1)

安装了完整版ctex套装

spacemacs增加layer –> latex

(latex :variables latex-build-command "XeLaTex")

增加windows的path路径。解决org-mode里中英文等宽问题。latex编译命令,pdf预览等。实现了org转tex。

;;windows setenv PATH (setenv "PATH" "C:/ProgramData/Oracle/Java/javapath;%SystemRoot%/system32;%SystemRoot%;%SystemRoot%/System32/Wbem;%SYSTEMROOT%/System32/WindowsPowerShell/v1.0/;C:/Program Files (x86)/ATI Technologies/ATI.ACE/Core-Static;e:/Program Files/Git/cmd;e:/Program Files/Git/mingw64/bin;e:/Program Files/Git/usr/bin;C:/Program Files/Git/cmd;C:/Program Files (x86)/AMD/ATI.ACE/Core-Static;d:/CTEX/UserData/miktex/bin;d:/CTEX/MiKTeX/miktex/bin;d:/CTEX/CTeX/ctex/bin;d:/CTEX/CTeX/cct/bin;d:/CTEX/CTeX/ty/bin;d:/CTEX/Ghostscript/gs9.05/bin;d:/CTEX/GSview/gsview;d:/CTEX/WinEdt") ;; 中文字体的设置,同时解决中英文字体宽度不一致的问题(org-mode的表格可以中英文对齐)。 ;; 而且解决了中文字体导致emacs卡的现象。 (dolist (charset '(kana han cjk-misc bopomofo)) (set-fontset-font (frame-parameter nil 'font) charset (font-spec :family "微软雅黑" :size 16))) (add-hook 'LaTeX-mode-hook (lambda() (add-to-list 'TeX-command-list '("XeLaTeX" "%`xelatex%(mode)%' %t" TeX-run-TeX nil t)) (setq TeX-global-PDF-mode t TeX-engine 'xelatex) ;;重新定义pdfviewer,我设定为了SumatraPDF。 (setq org-latex-pdf-process '("xelatex -interaction nonstopmode %f")) (setq TeX-command-default "XeLaTeX") (setq TeX-save-query nil ) (setq TeX-show-compilation t) (setq TeX-view-program-list '(("SumatraPDF" "SumatraPDF %o"))) (setq TeX-view-program-selection '((output-pdf "SumatraPDF"))) )) (require 'ox-latex) (add-to-list 'org-latex-classes '("org-article" " \\documentclass{ctexart} \\usepackage[colorlinks,linkcolor=black,anchorcolor=black,citecolor=black,CJKbookmarks=True]{hyperref} \\usepackage{graphicx} \\usepackage{xcolor} \\usepackage{xeCJK} \\usepackage{fixltx2e} \\usepackage{longtable} \\usepackage{float} \\usepackage{tikz} \\usepackage{wrapfig} \\usepackage{latexsym,amssymb,amsmath} \\usepackage{textcomp} \\usepackage{listings} \\usepackage{marvosym} \\usepackage{textcomp} \\usepackage{latexsym} \\usepackage{natbib} \\usepackage{geometry} \\usepackage{epstopdf} \\usepackage{epsfig} \\usepackage{times} \\geometry{a4paper,centering,scale=0.8} \\CTEXsetup[format={\\Large\\bfseries}]{section} \\usepackage{tocbibind} [NO-DEFAULT-PACKAGES] [PACKAGES] [EXTRA]" ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}") ("\\paragraph{%s}" . "\\paragraph*{%s}") ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))

org文件头增加下述信息

#+LATEX_CLASS: org-article #+TITLE: 标题abc
转载请注明原文地址: https://www.6miu.com/read-30461.html

最新回复(0)