Frage

I want to generate a PDF from sphinx that is only black and white. The standard sphinx.sty uses \RequirePackage{color} and \RequirePackage{fancyvrb}.

If I just remove color, I get a whole list of errors. I could not find any reference in fancyvrb's documentation.

How can I achieve that (without rewriting the whole sphinx.sty)?

War es hilfreich?

Lösung

You can edit the conf.py and add addtions to the preamble before the build with custom LaTeX, so that sphinx will render colors as black. For example.

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',
}

This will change all sections and subsections to black and change all your hyperlinks to black as well.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top