How do I get rid of the "Release 1" in the Page Header of the Sphinx Latex Output? - latex

I'm using the "manual" document class of Sphinx and I'm quite happy with how the Latex Output looks like, except for the page header. It contains the title of my paper, as well as a "Release 1".
Since I'm writing a paper and not a documentation, I clearly don't need the release information. Unfortunately, it is very hard to find information on how to customize Sphinx latex output.
Does somebody know how to do it?

To suppress the release info at the top of your Latex output, you need to set the release and latex_elements['releasename'] to empty strings in your conf.py. So you might add or modify something like this in conf.py:
release = ''
latex_elements = { 'releasename': '' }
Then the release info will be hidden.

As of Sphinx 1.5 something, the workaround of setting an empty string stopped working - at least in my case (I had used it to suppress printing "Release " on the title page) . However, setting release to a blank space does work for me. There's more discussion of it here in the Sphinx-Users group: https://groups.google.com/forum/#!topic/sphinx-users/L5PUfwVu8f0
and there was a related bug report filed: https://github.com/sphinx-doc/sphinx/pull/4411

The bellow lines eliminate also the comma in the header. Add them in your conf.py file:
latex_custom = r'''
\makeatletter
\fancypagestyle{normal}{
\fancyhf{}
\fancyfoot[LE,RO]{{\py#HeaderFamily\thepage}}
\fancyfoot[LO]{{\py#HeaderFamily\nouppercase{\rightmark}}}
\fancyfoot[RE]{{\py#HeaderFamily\nouppercase{\leftmark}}}
\fancyhead[LE,RO]{{\py#HeaderFamily \#title}}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\makeatother
'''
latex_elements = {'preamble': latex_custom}
Such a solution affects only the header.
If you want to remove the release sign also from the front page use the solution provided by ddbeck.

You can use stopwords - Stopwords are the words that will not be indexed.
http://sphinxsearch.com/docs/current.html#conf-stopwords

Related

no automatically word wrap with bibliography

I have a problem with my biblatex. My booktitles don't automaticly break lines in my bibliography. Has someone got a hint how to solve this? Is it possible to get an automatic break or do I have to set them manually? And if I so, how do I do that?
Here my biblatex code snippets:
\usepackage[backend=biber,style=authoryear,sorting=nyt,citestyle=authoryear]{biblatex}
\printbibliography[type=book,title={Books}]
See this example at IEEE: after Metrics is a linebreak is missing.
EDIT: I found the solution here
I was curious about the \emph{} style (mine was always underlining). I put a single \normalem in front of the \printbibliography command and it works fine :)
\normalem
\printbibliography[type=book,title={Books}]
Your book titles are underlined, which is preventing line breaks (underlined text doesn't break). I don't think this is a standard behavior, book titles are usually displayed in italics. Perhaps you are using \underline{} inside your bibliography items definitions?

sphinx customization of latexpdf output?

Just curious if anyone knows how to customize the sphinx output when using the latexpdf target? I've seen lots of custom stuff for html output, but cant seem to find any example of custom pdf output.
Specifically, I'd be interested in customizing the title page, headers, footers, and possibly adding a few pages of front matter before the contents.
Has anyone seen any examples of this kind of customization, or do people pretty much just use the "stock" sphinx output when generating pdfs? Thanks!
Yes i think better or clearer documentation for latex styling would be nice and
some examples.
Here is a question on the sphinx mailing list, which is about about using packages.
sphinx has its own latex documentclass in a file called sphinxmanual.cls or
sphinxhowto.cls, if i remember correctly its a report documentclass that is used as base.
then there is 2 style files, which are the packages, it is those files contents
that are called on when you write \usepackage{mylatexstilefile}
Question about using latex packages
http://groups.google.com/group/sphinx-dev/browse_thread/thread/890dab5e53fff004
Here is my conf.py.
preamb_old = ur'''
%\documentclass{memoir}
\makeatletter
\fancypagestyle{normal}{
\fancyhf{}
\fancyfoot[LE,RO]{{\py#HeaderFamily\thepage}}
\fancyfoot[LO]{{\py#HeaderFamily\nouppercase{\rightmark}}}
\fancyfoot[RE]{{\py#HeaderFamily\nouppercase{\leftmark}}}
\fancyhead[LE,RO]{{\py#HeaderFamily \#title}} % here's the change
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
}
\makeatother
%\color {blue}
%\normalcolor {dark blue}
\pagecolor [RGB]{255, 247, 226}
\definecolor{VerbatimColor}{rgb}{0.95,0.85,0.65}
\definecolor{VerbatimBorderColor}{rgb}{0.5,0.95,0.1}
'''
f = open('graph/static/latexstyling.tex', 'r+')
PREAMBLE = f.read();
latex_elements = {
'papersize':'a4paper',
'pointsize':'11pt',
'classoptions': ',openany',
'babel': '\\usepackage[english]{babel}',
'preamble': PREAMBLE
}
i don't use preamble_old anymore, but it is an example of changes directly in
conf.py, to your latex preamble.
Check out latex_elements and latex_additional_files in the sphinx docs as
a starting point.

Why Bibliography and References appears in Latex TOC?

I am using these commands for including references:
\addcontentsline{toc}{chapter}{References}
\bibliographystyle{agsm}
\bibliography{dissrefs}
The problem is that in the table of contents both References and Bibliography appear, while I just want one to appear. Why is this happening? Can I customise the table of contents entry to be just one of them?
I am using MikTex 2.8 and TexMaker 2.1.
I dont think that you need to use \addcontentsline{toc} bibtex should do it automatically. At least I don't recall ever needing it...
Have you tried commenting out that line?
Edit regarding OPs comment on changing the title of the bibliography:
The bibliography's title can be changed by (to for instance "New Title") using \renewcommand\refname{New Title} for articles and \renewcommand\bibname{New Title} for books.
Instructions are read and processed in the order they appear, I think your problem is related to that order. Try moving things around (I believe that all settings should be put before \tableofcontents, but I'm not sure about that, I'v not used latex for a long time)

How do I disable colors in LaTeX output generated from sphinx?

When I build the LaTeX file generated from sphinx, the TOC entries, and section headers are blue. Is there an easy way to disable coloring these items? If not, is there an easy way to make them black instead? My goal is to print the document on a non-color printer, and the TOC and headings do not look as dark as the rest of the text when I do so.
I would like to make one change that applies to the whole document if possible.
Note: I am using the howto document class.
Update
Thanks to ddbeck's input, I took a closer look at sphinx.sty which defines the colors that I needed to change. I set (created) the latex_elements dictionary in conf.py as follows:
mypreamble ='''
\\pagenumbering{arabic}
\\definecolor{TitleColor}{rgb}{0,0,0}
\\definecolor{InnerLinkColor}{rgb}{0,0,0}
'''
latex_elements = {
'papersize':'letterpaper',
'pointsize':'11pt',
'preamble':mypreamble
}
This worked out exactly as I wanted it. Thanks ddbeck!
You can add LaTeX by using the latex_elements['preamble'] configuration option. If you change the value of that key, you can override Sphinx's normal LaTeX. The docs on this option aren't particularly illuminating, however. You may find this thread from sphinx-dev a bit more helpful; it has more detail on how that might be used, as well as some good links for learning about LaTex (if that's something you need to get black and white output). Finally, it might help to take a look at the default .cls and .sty files.

How to force line wrapping in listings package?

I have a problem concerning the listings package in latex. I need to embed a source code of the following XML document http://www.sparxsystems.com.au/downloads/profiles/EP_Extensions.xml in my master thesis' appendix. The problem is, no matter what options I pass to the package, I don't seem to be able to fit it on the page. The lines in the listing are too long, and the listings package doesn't wrap them, which seems odd... What combination of options will do the trick?
At the moment I use the following lstset instruction:
\lstset{
breakindent=0em,
language=XML,
basicstyle=\footnotesize,
numbers=left,
numberstyle=\footnotesize,
stepnumber=2,
numbersep=5pt,
backgroundcolor=\color{white},
showspaces=false,
showstringspaces=false,
showtabs=false,
frame=single,
tabsize=2,
captionpos=b,
breaklines=true,
breakatwhitespace=true,
breakautoindent=true,
escapeinside={\%*}{*)},
linewidth=\textwidth
}
Which, with no other options set, and combined with the following command:
\lstinputlisting{EP_Extensions.xml}
Lists the given file's source to the following output:
I just had this problem...
breaklines worked for me, though you do need to set it to true - the default is false:
\lstinputlisting[style=Python,
caption=My Class,
label={mine.py},
breaklines=true,
]{../python/mine.py}
is pretty much what I used
I had this problem and this page ranks highly on google so here was the solution for me:
I had the following inclusion: \usepackage[none]{hyphenat} which causes the issue described above. I was using it to fix the problem of latex automatically breaking lines in the middle of a word, which looks really stupid in some circumstances.
After much searching for an alternative to this solution I found nothing suitable and settled for properly broken lines but badly placed hyphenation.
Not a great answer, but one idea is to word wrap the source code before including it. If you're on linux, the command fold can be used for this. Clearly this works best if the text is in a fixed width font, which i would recommend in any case for code listings.
A followup to Aaron's answer. I was using basicstyle=\ttfamily for my listings. I was therefore able to permit line breaking by changing
\usepackage[none]{hyphenat}
to
\usepackage[htt]{hyphenat}
% ^^^
The hyphenat docs describe that the htt option "enables hyphenation of ... text typeset via either \texttt or \ttfamily." In my use case, I didn't see any hyphenation in my listings, but I did get the breaking.

Resources