From 163e367e33ef24ca69353c20f2de951173fbe267 Mon Sep 17 00:00:00 2001 From: Shawn Jones Date: Thu, 8 Aug 2024 11:06:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BF=BD=E7=95=A5=E6=96=87?= =?UTF-8?q?=E4=BB=B6=EF=BC=9B=E6=96=87=E5=AD=97=E9=AB=98=E4=BA=AE=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ lisp/init-org.el | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/.gitignore b/.gitignore index 41acfe2..efb655a 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ org-roam.db server/ *~ eln-cache/ +bookmarks +.org-id-locations diff --git a/lisp/init-org.el b/lisp/init-org.el index d26def2..3d9cd84 100644 --- a/lisp/init-org.el +++ b/lisp/init-org.el @@ -44,6 +44,8 @@ "\\documentclass[10pt,a4paper]{article} \\usepackage{fontspec} % 引入 fontspec 包 \\usepackage{xeCJK} % 引入 xeCJK 包处理中文 +\\usepackage{xcolor} % 引入xcolor +\\definecolor{hltextcolor}{RGB}{255, 69, 0} % 配置颜色 % 设置英文字体 \\setmainfont{Consolas} \\setsansfont{Arial} @@ -86,6 +88,15 @@ (while (re-search-forward "hypersetup.*" nil t) (replace-match ""))) +;; 高亮字体 +(defun org-latex-highlight-texttt (text backend info) + "Highlight =text= with \\textcolor{hltextcolor}{\\texttt{}} in LaTeX export." + (when (org-export-derived-backend-p backend 'latex) + (replace-regexp-in-string "\\\\texttt{\\([^}]+\\)}" "\\\\textcolor{hltextcolor}{\\\\texttt{\\1}}" text))) + +(add-to-list 'org-export-filter-final-output-functions 'org-latex-highlight-texttt) + + (add-hook 'org-export-before-processing-hook 'my/org-latex-remove-hypersetup) ;; 配置 Org Babel 支持多种编程语言 (org-babel-do-load-languages