sphinx-doc / sphinx-doc/sphinx

How to force own template class in sphinx without howto/manual override

Open
#11,481 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

builder:latex
Dominant language
Python
Stars
8k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

I am using the version sphinx 6.2.1
I want to use my own company template latex class in sphinx for the latex generation only (html unchanged).
I have modified the conf.py in order to use the template class.
The generated tex file contains:
\def\sphinxdocclass{my_own_template}

The class is defined before begin{document}

However, after the begin{document}:
the sphinx class howto/manual override the header of pages as well as the pagestyle with these following lines

\pagestyle{empty}
\sphinxmaketitle
\pagestyle{plain}
\sphinxtableofcontents
\pagestyle{normal}

Is there a way to use a specific template class with using sphinx without getting the sphinxclass which prevents the pagestyle the wanted class ?

Thank you

How to Reproduce

latex_elements = {
'papersize': 'mytemplate',
'passoptionstopackages' : '\PassOptionsToPackage{mytemplate}{my_template}',
'pointsize': '10pt',
'docclass' : 'my_template',
}

latex_docclass = {
'manual': 'my_template',
'howto' : 'my_template',
}

Environment Information
sphinx 6.2.1
Sphinx extensions
extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.napoleon',
    'sphinx.ext.mathjax',
    'myst_parser',
    'sphinx.ext.autosectionlabel',
    'sphinxcontrib.bibtex'
]
Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the conf.py settings for latex_elements and latex_docclass, then inspect the generated .tex around the document start and the listed pagestyle commands. Done means the custom LaTeX class controls the page style for LaTeX output while HTML output remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
latex, python
Domain
documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.