【问题标题】:Pandoc markdown: default colour for inline verbatimPandoc markdown:内联逐字的默认颜色
【发布时间】:2015-12-27 15:28:04
【问题描述】:

有没有办法在 Pandoc markdown 中设置内联逐字 sn-ps (`...`) 的默认颜色?例如,文档中的所有逐字语句都是红色而不是黑色?

我知道,我能做到,例如

Normal text `verbatim`{.bash} normal text

用于语法高亮逐字 sn-p。但是,我想要的是所有逐字 sn-ps 的简单默认颜色。

我使用 pandoc 通过 LaTeX 转换为 PDF,并使用 LaTeX 模板。如果允许启用此行为,我可以对 LaTeX 模板进行任何更改。

【问题讨论】:

    标签: markdown pandoc


    【解决方案1】:

    Pandoc 将 verbatim 内容转换为 LaTeX 中的 \texttt{}。你可以重新定义这个命令来设置它的样式:

    \usepackage[usenames, dvipsnames]{color}
    
    % overwrite \texttt command to use coloring
    \let\oldTexttt\texttt
    \renewcommand{\texttt}[1]{\oldTexttt{\textcolor{red}{#1}}}
    

    如果您在 LaTeX 模板中包含上面的 sn-p,您的 pdf 将包含红色的verbatim 内容。

    【讨论】:

    • 完美运行,谢谢!只是最后一行的错字,\OldTexttt 应该是\oldTexttt
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-03
    相关资源
    最近更新 更多