How do I disable colors in LaTeX output generated from sphinx?

余生长醉 提交于 2019-12-04 16:52:26

问题


When I build the LaTeX file generated from sphinx, the TOC entries, and section headers are blue. Is there an easy way to disable coloring these items? If not, is there an easy way to make them black instead? My goal is to print the document on a non-color printer, and the TOC and headings do not look as dark as the rest of the text when I do so.

I would like to make one change that applies to the whole document if possible.

Note: I am using the howto document class.


Update

Thanks to ddbeck's input, I took a closer look at sphinx.sty which defines the colors that I needed to change. I set (created) the latex_elements dictionary in conf.py as follows:

mypreamble ='''
\\pagenumbering{arabic}
\\definecolor{TitleColor}{rgb}{0,0,0}
\\definecolor{InnerLinkColor}{rgb}{0,0,0}
'''
latex_elements = {
    'papersize':'letterpaper',
    'pointsize':'11pt',
    'preamble':mypreamble
    }

This worked out exactly as I wanted it. Thanks ddbeck!


回答1:


You can add LaTeX by using the latex_elements['preamble'] configuration option. If you change the value of that key, you can override Sphinx's normal LaTeX. The docs on this option aren't particularly illuminating, however. You may find this thread from sphinx-dev a bit more helpful; it has more detail on how that might be used, as well as some good links for learning about LaTex (if that's something you need to get black and white output). Finally, it might help to take a look at the default .cls and .sty files.



来源:https://stackoverflow.com/questions/2241284/how-do-i-disable-colors-in-latex-output-generated-from-sphinx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!