【问题标题】:How to generate black and white pdf from sphinx?如何从 sphinx 生成黑白 pdf?
【发布时间】:2014-05-01 13:03:38
【问题描述】:

我想从 sphinx 生成一个只有黑白的 PDF。标准的sphinx.sty 使用\RequirePackage{color}\RequirePackage{fancyvrb}

如果我只是删除color,我会得到一个完整的错误列表。我在fancyvrb 的documentation 中找不到任何参考资料。

我怎样才能做到这一点(无需重写整个 sphinx.sty)?

【问题讨论】:

    标签: latex python-sphinx


    【解决方案1】:

    您可以在使用自定义 LaTeX 构建之前编辑 conf.py 并在序言中添加添加,以便 sphinx 将颜色渲染为黑色。例如。

    latex_elements = {
    # The paper size ('letterpaper' or 'a4paper').
    #'papersize': 'letterpaper',
    
    # The font size ('10pt', '11pt' or '12pt').
    #'pointsize': '10pt',
    
    # Additional stuff for the LaTeX preamble.
    'preamble': r'''
    \usepackage{titlesec}
    \titleformat{\section}
    {\color{black}\normalfont\Large\bfseries}
    {\color{black}\thesection}{1em}{}
    \titleformat{\subsection}
    {\color{black}\normalfont\Large\bfseries}
    {\color{black}\thesubsection}{1em}{}
    
    \usepackage{hyperref}
    \hypersetup{colorlinks=true,
    linkcolor=black,
    citecolor=black,
    filecolor=black,
    menucolor=black,
    urlcolor=black,
    bookmarksnumbered=true
    }
    '''
    
    # Latex figure (float) alignment
    #'figure_align': 'htbp',
    }
    

    这会将所有部分和子部分更改为黑色,并将所有超链接也更改为黑色。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-07-22
      • 1970-01-01
      • 2021-06-29
      • 2015-03-30
      • 2013-01-18
      • 1970-01-01
      • 1970-01-01
      • 2010-10-08
      相关资源
      最近更新 更多