Roman Vostrikov
Roman Vostrikov

Reputation: 41

Sphinx LaTeXPDF output: how to change "style"

I use Sphinx to produce both HTML and PDF documentation. The default PDF output was OK till now, but my manager sent me a Word .dotx template and said that PDF should be the same "corporate" style.

So the question is, how to change the style for PDF output?

The conf.py file gives some options like latex_logo (but what if i need 2 images on a title page?) and "preamb" section with some parameters. But i cant find any manual or a description for available params.

For example, how can i define pictures aligning, or text wrapping, or tables line color and so on?

Upvotes: 4

Views: 2181

Answers (1)

xuhdev
xuhdev

Reputation: 9333

In your case, Sphinx generates the LaTeX output then calls LaTeX compiler to generate the final PDF. This means that your style is largely controlled by options given in LaTeX. For specific problems, you can also search for LaTeX online, not necessarily Sphinx. For example, you can search for "LaTeX figure alignment" instead of "Sphinx PDF figure alignment".

To change your figure alignment, use the option figure_align in latex_elements. For example, 'figure_align': 'ht' would put the figures at the insert point if possible, otherwise it falls back to the top of a page. You can checkout here for LaTeX figure alignment.

The preamble is a very flexible option. The contents of preamble is inserted at somewhere top in the generated LaTeX source file. It allows you to insert the original options provided by LaTeX. For example, if you want to change your table line color to red, insert the following code to your preamble:

\usepackage{xcolor,colortbl}
\arrayrulecolor{red}

Again, these resources only show up as LaTeX keywords resource, not Sphinx (here). IMO searching for your problems on the Internet in LaTeX related resource is the best way.

Also, I have also written a post related to Sphinx PDF output, which may also be helpful for you.

Upvotes: 2

Related Questions