There should be a slightly less obvious way to do it.  I have considered 
doing it, but it makes the .rst files a bit more difficult to read.  Note 
that I have not tried this, it is only a guess at what you would need to do.

First redefine the latex_elements dict:
latex_elements = {
    # ... put your stuff here
    # Customize below for your template
    'preamble': my_preamble,

    # Redefine tableofcontents to be the commands you want to run
    'tableofcontents': \make_title_page_only,                               
 

    # .. Anything else you want to do
}

Then in your preamble, define \make_title_page_only to print just the title 
page.  Eg remove \tableofcontents

Now, update your index.rst file to have a toctree that isn't numbered:
.. toctree::
    
    copyright
    trademark
    main_toctree

Now you can put in your copyright, etc

Move the normal toctree into a separate file called main_toctree.rst (or 
pick a better name).  In that one, you probably want it numbered:
.. raw:: latex

    \tableofcontents

.. toctree::
    :numbered:
    :glob:

    put_your_previous_toctree_entries_here    

Now your .rst files should build your html files and latex files in the 
same order and you *should* be able to have .rst content before your table 
of contents.  This now makes it a bit more difficult to get your 
header/footers correct (if you switch between roman/arabic numbers in you 
footers for example).  You maybe able work around this by including more .. 
raw:: latex directives.

If you go that route and it works, please let me know.

On Tuesday, December 20, 2016 at 7:03:13 AM UTC-8, Warren Block wrote:
>
> On Mon, 19 Dec 2016, Peter Burdine wrote: 
>
> > Yes, that is exactly why it is setup that way.  Remember that it is only 
> part of the solution.  The latex code still needs to in the preamble or a 
> style file and you need to overwrite the correct entry in the 
> latex_elements dict. 
> > 
> > This is only for latex output so none of this information is in .rst 
> files.   I am not sure what you meant by "Can this be used to control the 
> order of Sphinx-generated elements". 
>
> The hope was that it would allow putting a section of copyright and 
> trademark information before the table of contents, yet still being able 
> to write that section in rst for consistency with the rest of the 
> document and being able to generate both HTML and PDF output from it. 
>
> But no, it appears not. 
>
> > On Dec 19, 2016 5:03 PM, "Warren Block" <[email protected] 
> <javascript:>> wrote: 
> >       On Thu, 15 Dec 2016, Peter Burdine wrote: 
> > 
> >       Then I define the following for the front matter (note that some 
> of these are commands defined in the preamble or other included .tex/.sty 
> file): 
> > 
> >       latex_contents = r''' 
> >           \setupHeadFootForFrontMatter 
> >           \formattoc 
> >           \maketitle 
> >           \signaturepage 
> >           \revisionhistory 
> >           \tableofcontents 
> >           \clearpage 
> >           \listoffigures 
> >           \clearpage 
> >           \listoftables 
> >           \clearpage 
> >           \setupHeadFootForText 
> >           \pagenumbering{arabic} 
> >           \pagestyle{plain} 
> >       ''' 
> > 
> > 
> > Can this be used to control the order of Sphinx-generated elements, like 
> to put a copyright page before the table of contents?  (That can be done by 
> editing the generated .tex file, moving the call to \tableofcontents, but 
> that's ugly.)

-- 
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.

Reply via email to