I am using Sphinx to generate multi-output documents (Epub, HTML, LaTeX). How can I change the use documentclass?

The following snippet should (in my opinion) override the used class but results in

% Generated by Sphinx.

Here's the code from my conf.py:

latex_elements = {
     'papersize': '',
     'fontpkg': '',
     'fncychap': '',
     'maketitle': '',
     'pointsize': '',
     'preamble': '',
     'releasename': "",
     'babel': '',
     'printindex': '',
     'fontenc': '',
     'inputenc': '',
     'classoptions': '',
     'utf8extra': '',

The manual says, it should not be overridden, since other macros are responsible to set it. Is there a workaround?


Looking at https://github.com/basespace/basespace-python-sdk/blob/master/doc/latex/sphinxmanual.cls it seems that class just loads the class specified by \sphinxdocclass so your generated code looks OK.


This comes very late, but maybe it helps...

I am running sphinx 1.8.2

Do not put the docclass into the latex_elements variable dictionary, but put it into the latex_docclass dictionary, with key 'howto' and 'manual'. Example code:

latex_docclass = {
   'howto': 'yourclass1',
   'manual': 'yourclass2',

see: https://www.sphinx-doc.org/en/1.8/usage/configuration.html#confval-latex_docclass


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.