gpt4 book ai didi

emacs - 组织模式 LaTeX 导出 - 使待办事项变为红色

转载 作者:行者123 更新时间:2023-12-04 15:20:02 26 4
gpt4 key购买 nike

我在 Emacs 中使用 Org Mode,并且我使用了 Export to LaTeX 选项。输出很好,但我很想展示:

  • TODO 为红色
  • DONE 为绿色

  • 所以他们脱颖而出。

    有办法吗?

    最佳答案

    从 ox-latex.el 修改相应的函数

    我将 org-latex-format-h​​eadline-default-function 从 ox-latex.el 复制到我的 .emacs 并添加了两个案例 TODO 和 DONE。我建议不要替换原来的函数,而是把它放在你的 .emacs 中。

    当您导出到 LaTeX 时,它将使任何包含字符串的“TODO”变为红色,任何“DONE”变为绿色。确保你把

    #+Latex_header:\usepackage{xcolor}

    在您的组织标题中。
    您可以在“格式”之后编辑字符串来自定义它。
    如果您有其他待办事项关键字,您也可以添加更多案例。

    (defun org-latex-format-headline-colored-keywords-function
    (todo todo-type priority text tags info)
    (concat
    (cond ((string= todo "TODO")(and todo (format "{\\color{red}\\bfseries\\sffamily %s} " todo)))
    ((string= todo "DONE")(and todo (format "{\\color{green}\\bfseries\\sffamily %s} " todo))))
    (and priority (format "\\framebox{\\#%c} " priority))
    text
    (and tags
    (format "\\hfill{}\\textsc{%s}"
    (mapconcat (lambda (tag) (org-latex-plain-text tag info))
    tags ":")))))

    (setq org-latex-format-headline-function 'org-latex-format-headline-colored-keywords-function)

    关于emacs - 组织模式 LaTeX 导出 - 使待办事项变为红色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36197545/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com