Single Side Latex Output

390 views
Skip to first unread message

Nahuel Defossé

unread,
Dec 7, 2009, 5:56:55 PM12/7/09
to sphinx-dev
Hi!

I've trying to hack the latex output, in manual document class so that page numbers are printed always in the same side.
All I need is to print my document as a Single Sided document, but sphinx by default outputs two sided docs.
Adding \fancyheader{} to latex_preamble in conf.py does nothing, and my latex knowledge is too poor to solve this :'(
Right now I'm manually commenting fancyhdr packge, but I belive there must be a nicer way to acompish this task.

Thanks in advance
Nahuel

akean

unread,
Dec 7, 2009, 7:42:23 PM12/7/09
to sphinx-dev


On Dec 8, 11:56 am, Nahuel Defossé <nahuel.defo...@gmail.com> wrote:
> Hi!
>
> I've trying to hack the latex output, in manual document class so that page
> numbers are printed always in the same side.
> All I need is to print my document as a Single Sided document, but sphinx by
> default outputs two sided docs.
> Adding \fancyheader{} to latex_preamble in conf.py does nothing, and my
> latex knowledge is too poor to solve this :'(

The file manual.cls in your build/latex directory (after sphinx has
built the tex file) has the line

> \LoadClass[twoside, openright]{report}

that's passing the twoside option to the report class -
delete the twoside option and remake the pdf from the tex file, and
the page numbers are all printed on one side.
> \LoadClass[openright]{report}

The file manual.cls is copied into the build/latex directory from the
texinputs directory of your sphinx installation. You could change it
there while you want one-sided printing.
Hope that helps.

--
Anita

Nahuel Defossé

unread,
Dec 7, 2009, 8:09:38 PM12/7/09
to sphinx-dev
Thanks Anita! It helps reducing the blank pages, but headers and footers generated for two side layout.
Odd pages have the page number in the left corner, and even pages have the page number at the right.
Is there any simple solution?

Thanks

2009/12/7 akean <ak...@clear.net.nz>

--

You received this message because you are subscribed to the Google Groups "sphinx-dev" group.
To post to this group, send email to sphin...@googlegroups.com.
To unsubscribe from this group, send email to sphinx-dev+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sphinx-dev?hl=en.



Guenter Milde

unread,
Dec 8, 2009, 4:42:53 AM12/8/09
to sphin...@googlegroups.com
On 2009-12-08, akean wrote:
> On Dec 8, 11:56 am, Nahuel Defossé <nahuel.defo...@gmail.com> wrote:

>> I've trying to hack the latex output, in manual document class so that page
>> numbers are printed always in the same side.
>> All I need is to print my document as a Single Sided document, but sphinx by
>> default outputs two sided docs.
>> Adding \fancyheader{} to latex_preamble in conf.py does nothing, and my
>> latex knowledge is too poor to solve this :'(

> The file manual.cls in your build/latex directory (after sphinx has
> built the tex file) has the line

>> \LoadClass[twoside, openright]{report}

> that's passing the twoside option to the report class -
> delete the twoside option and remake the pdf from the tex file, and
> the page numbers are all printed on one side.
>> \LoadClass[openright]{report}

The openright is not needed either.

>> \LoadClass[openright]{report}

> The file manual.cls is copied into the build/latex directory from the
> texinputs directory of your sphinx installation. You could change it
> there while you want one-sided printing.
> Hope that helps.

It is generally considered harmfull to modify LaTeX style or class files
without renaming: Different output from the same documentclass is hard to
debug.

Therefore I recommend to create a modified version under a different
name, place it alongside the standard manual.cls (on my system this
would be /usr/share/sphinx/texinputs/) or in the TEXPATH (on my system
e.g. ~/texmf/tex/latex/) and configure the latex-documentclass setting
accordingly.

I created a modification of the standard documentclass called
sphinx-manual.cls that can be loaded with the 'oneside' option overriding
the 'twoside' default and 'openany' overriding 'openright' a year
agon(2008/10/18). I think I also posted it to the sphinx list -- on
demand I can post it (again).

Günter



akean

unread,
Dec 8, 2009, 6:54:27 PM12/8/09
to sphinx-dev
bb
I stand corrected, Günter! Wasn't trying to harm - just to help. :(
but wasn't sure if it was worth instructing creation of local
texinputs directory-tree etc.

Perhaps an indication that the parameters passed in to the LaTeX
report class in manual.cls could be made available to the user in
conf.py

LaTeX permits the user to pass these parameters from your own .tex
file, without having to mess with texinputs until you start to develop
your own style files - didn't want to frighten off a latex newbie.

Mea culpa

--
Anita

Nahuel Defossé

unread,
Dec 8, 2009, 11:19:22 PM12/8/09
to sphinx-dev
I've tried to create my own cls file, copyng it from Sphinx one, but it didn't work, so I had overwrite the manual.cls in my makefile (as a rule in latex target). I know it's not the best solution.

Regarding to the page numbers, I've found that I had to override fancyhf definition, I did it in latex_preamble. Final result is OK, but I know it's not clean :(

It would be great to have some Sphinx oriented tex haking doc for those of us who have very little latex experience :)

Thanks


2009/12/8 akean <ak...@clear.net.nz>

Guenter Milde

unread,
Dec 9, 2009, 5:08:49 AM12/9/09
to sphin...@googlegroups.com
On 2009-12-09, Nahuel Defossé wrote:

> I've tried to create my own cls file, copyng it from Sphinx one, but it
> didn't work, so I had overwrite the manual.cls in my makefile (as a rule in
> latex target). I know it's not the best solution.

You might try setting the document class with the
latex_elements['docclass'] setting in config.py.

While http://sphinx.pocoo.org/config.html#confval-latex_elements
says:


Keys that are set by other options and therefore should not be
overridden are:

'docclass' 'classoptions' 'title' 'date' 'release' 'author' 'logo'
'releasename' 'makeindex' 'makemodindex' 'shorthandoff' 'printmodindex'

it is at least worth a try.

Generally, it would be nice if Sphinx were more flexible in the choice
of the document class (and options) and provided its local requirements
in a package (spinx.sty, say) instead of a documentclass.


> Regarding to the page numbers, I've found that I had to override fancyhf
> definition, I did it in latex_preamble. Final result is OK, but I know it's
> not clean :(

Overriding fancyhf configuration in the latex_preamble is clean. This is
what the latex_preamble is for.

> It would be great to have some Sphinx oriented tex haking doc for those of
> us who have very little latex experience :)

You might have a look at the Docutils LaTeX doc
http://docutils.sourceforge.net/docs/user/latex.html (Not all tips there
will apply for Sphinx. While Sphix is based on docutils it differs a lot
in the configuration.)


Günter

Reply all
Reply to author
Forward
0 new messages