Hi Mathias, Le 21/12/2018 à 14:25, Mathias Weidner a écrit :
Hi,I want to write a book using Sphinx and I'm using the latexpdf target for PDF output with scrbook as docclass like this in conf.py: latex_elements = { ... 'maketitle': r''' \uppertitleback{ This work is licensed under a Creative Commons\\ Attribution-NonCommercial-ShareAlike 3.0 Unported License } \maketitle ''', } latex_docclass = { 'manual': 'scrbook', } Unfortunately this didn't work as expected, so I looked around and found in venv/lib/python2.7/site-packages/sphinx/texinputs/sphinxmanual.cls a \renewcommand{\maketitle}. After fiddling around a little bit, the only solution I came up with was to comment out the \renewcommand and then it worked as I expected. My question: is there an easier way to get the \maketitle from scrbook working.
This is a good point. I think Sphinx should define and use a \sphinxmaketitle rather than \renewcommand the \maketitle. As it stands, workaround is not trivial, as you discovered. My recommendation is that you copy the sphinxmanual.cls you found out to the source repertory of your Sphinx project, remove from it or comment out the Sphinx definition of \maketitle, and instruct Sphinx to use this modified file via the latex_additional_files config variable. latex_additional_files = ['sphinxmanual.cls'] https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-latex_additional_files Thus this is same as your solution except that you don't fiddle with (in virtual env) Sphinx install and keep possibility to use Sphinx version in other project. Could you please open an issue at the github tracker https://github.com/sphinx-doc/sphinx with a title such as LaTeX: custom document class ``\maketitle`` is overwritten with no possibility to keep its meaning This being said, using other classes with Sphinx than the LaTeX standard ones is definitely not guaranteed to work, (I know KOMA-script is pretty much standard in some countries), and we can't afford to add tests for it, there are too many degrees of freedom at work. (you may need make clean, no time to check, don't recall if needed or not in such case, but anyway in some weird cases auxiliary files of previous LaTeX runs may create complications with new set-up so it is good idea) Best, Jean-François -- You received this message because you are subscribed to the Google Groups "sphinx-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sphinx-users. For more options, visit https://groups.google.com/d/optout.
