Le 09/05/2018 à 15:28, Julian a écrit :
> Dear Jean-François,
> 
> thank you very much for the thoroughly enlightening explanations!
> 
> For me, this signifies that I have quite some cleaning up to do. But at least 
> now I know the right way (or better two 'right ways') to do so. And I am so 
> glad that I can get rid of these double escapes :)
> 
> In the meantime I stumbled accross another problem. The fancy footers we 
> defined in latex are not getting applied to the index page.
> 
> I tried with giving options to the 'printindex' command in the conf file. But 
> this is going to be the same 'issue' as with giving complex options through 
> 'sphinxsetup'. It doesn't work this way.
> 
> I am not yet run out of ideas how to try, but if you are willing to give a 
> hint, how this would be done correctly - I am very happy.
> 


The LaTeX `\printindex` command will execute environment 
`sphinxtheindex` which executes standard LaTeX `theindex`
environment which itself issues 

\thispagestyle{plain}

Possible work-around (***not tested***) put in your extra macros
(attention uses @ letter, so please follow earlier instructions...)


\renewenvironment{sphinxtheindex}
{%
    \if@openright\cleardoublepage\else\clearpage\fi
    \phantomsection % needed as no chapter, section, ... created
    \begin{theindex}%
    \addcontentsline{toc}{chapter}{\indexname}%
%
\pagestyle{normal}%  ADDITION TO DEFAULT USe whatever name you gave to fancy 
header/footer style in place of "normal"
}%
{\end{theindex}}

This is assuming you are using "manual" type class

For howto

\renewenvironment{sphinxtheindex}
{%
    \phantomsection % needed because no chapter, section, ... is created by 
theindex
    \begin{theindex}%
    \addcontentsline{toc}{section}{\indexname}%
%
\pagestyle{normal}%  ADDITION TO DEFAULT
}%
{\end{theindex}}

> In any case many thanks for your quick reply and kind explanations, it is 
> going to direct my efforts during the next hours,

you are welcome

Jean-Francois

> 
> Julian
> 
> 
> 
> 
> 
> 
> 
> On Wednesday, May 9, 2018 at 2:30:35 PM UTC+2, jfbu wrote:
> 
>     Hi
> 
>     Le 09/05/2018 à 11:13, Julian Meier a écrit :
>     > Dear Sphinx Team,
>     >
>     > Thank you for providing sphinx.
>     >
>     > I am tring to get our latex class and sphinx conf work with sphinx 1.7
>     > instead of sphinx 1.5.
>     >
>     > I am almost there, but the latex_elements = {... 'preamble' gets larger 
> and
>     > larger because I am not succeeding in defining the titleformats (color 
> and
>     > font) in our custum latex class - it seems to get overruled by sphinx.
>     >
>     > An example of a defined title is (extract from latex preamble in sphinx
>     > conf):
>     > 
> '\\titleformat{{\\subsection}}{{\\fontsize{{14}}{{20}}\\fontspec{{MyriadPro-Bold}}\\addfontfeature{{Color=Pantone123C}}}}{{\\thesubsection}}{{0.5em}}{{}}\n'
>     > '\\titlespacing{{\\subsection}}{{-32mm}}{{*4}}{{-0.3mm}}\n'
>     >
>     > Now, to my question.
>     >
>     > Which is the recommended way to define custom titles, headers and 
> footers?
>     >
>     > - Definition in custom class file using correct statements (there I got
>     > some problems)
>     > - Definition in the sphinx conf.py latex_elements preamble as 'pure' 
> latex
>     > - Definition in the sphinx conf.py using 'sphinxsetup'
>     >
>     > I hope i provided all the necessary details for you to make a
>     > recommandation.
>     >
>     > Many thanks,
>     >
>     > Julian
>     >
>     >
> 
>     1. Things done from sphinx style file
>     will override things done in a custom class
>     file. The class file is loaded first by LaTeX and
>     `\usepackage{sphinx}` gets executed later.
> 
>     2. The 'sphinxsetup' is only interface to some customization handled
>     by the options of sphinx.sty, e.g. to modify the page margins
>     or the  colours for various elements (everything was hardcoded
>     in earlier Sphinx releases). You can only customize pre-defined
>     (and documented) options
> 
>     http://www.sphinx-doc.org/en/1.7/latex.html#the-latex-style-file-options 
> <http://www.sphinx-doc.org/en/1.7/latex.html#the-latex-style-file-options>
> 
>     3. To do things like custom `titleformat`'s or anything beyond
>     a few lines, the recommended way (for easier maintenance and to avoid
>     bloating conf.py)
>     is to set-up a custom LaTeX package mypackage.sty and then
>     use latex_elements
>     'preamble' key to contain `r'\usepackage{mypackage}'`. You will also need
>     to add 'mypackage.sty' to the latex_additional_files config value, if
>     file mypackage.sty is not installed globally in your TeX installation,
>     but only present at top of source repertory of your Sphinx project.
>     It will then be copied over to build repertory.
> 
>     cf http://www.sphinx-doc.org/en/1.7/latex.html#basic-customization 
> <http://www.sphinx-doc.org/en/1.7/latex.html#basic-customization>
> 
>     A file mypackage.sty  is simply a collection of tex macros with
>     an extra `\ProvidesPackage{mypackage}[2018/05/09 v1 my own macros]` line
>     at top. The @ letter can be used in it. To load more packages from therein
>     use `\RequirePackage{foo}`, not `\usepackage{foo}`.
> 
>     Alternative is to put all macros in a file mymacros.tex.txt,
>     update latex_additional_files accordingly and add
>     `r'''
>     \makeatletter
>     \input{mymacros.tex.txt}
>     \makeatother'''`
>     to 'preamble' key of latex_elements. The `.txt` extension is to
>     avoid confusing the LaTeX Makefile, it does not cause problem
>     to `\input`. The `\makeatletter/\makeatother` is in case "@" letter
>     is used in the macros included mymacros.tex.txt
> 
>     In both cases: don't double escape
>     the backslashes inside the files as they get parsed by LaTeX directly
>     with no Python in-between.
> 
>     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 sphinx-users+unsubscribe-/jypxa39uh5tlh3mboc...@public.gmane.org 
> <mailto:sphinx-users+unsubscribe-/jypxa39uh5tlh3mboc...@public.gmane.org>.
> To post to this group, send email to 
> sphinx-users-/jypxa39uh5tlh3mboc...@public.gmane.org 
> <mailto:sphinx-users@googlegroups.com>.
> Visit this group at https://groups.google.com/group/sphinx-users.
> For more options, visit https://groups.google.com/d/optout.



-- 
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 sphinx-users+unsubscr...@googlegroups.com.
To post to this group, send email to sphinx-users@googlegroups.com.
Visit this group at https://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to