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

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.

Related

NBConvert PDF/Latex page formatting IPython

Got some good advice on suppressing code and other items on NBConvert output,, Here Suppress code in NBConvert? IPython
BUT: now It seems I need to change top and bottom margins And I can see that it seems that it may be set in the sphnix template, (if I even know where it is), which I don't want to mess with but I cannot figure out how to edit the Latex output to get at the margins I attempted to place this in the import headers
\usepackage[margin=0.5in]{geometry}
But nothing happened.. I know squat about latex I am using the TexStudio package to modify the Latex output of NB convert, but at this point I don't see something to modify for margins...
I'm trying to touch up some page flow issues involving placement of output graphs that are just too big so I end up with big ugly blank spots,, pretty sure that if I can get at the margins I can...
To change the margins using your proposed code, you have to put this line after the other inputs, e.g. about line 71. If you put it at the top, it will be overridden by another call. With my notebook this works fine.
I'm pretty sure you know you can specify different margins using
\usepackage[left=0.5in, right=0.5in, top=0.5in, bottom=0.5in]{geometry}
see e.g. wikibooks.
Btw. be aware that the sphinx based templates are removed in current master. The new templates are much more customizable and remove some issues due to the mdframed packages (GitHub Issue)

Odt file, shown with all styles

I'm using odt file as some kind of template and Libre Office as tool to create this template. It usually works fine except one thing.
Let assume our odt file has a paragraph of text.
There is my text.
XML file may or may not look (seems random) like this (messy, not very good thing for for parsing or as a template):
<text:p text:style-name="P7">There is</text:p><text:p text:style-name="P7"> my text<text:p text:style-name="P7">.</text:p></text:p>
Sometimes it's (again seems random) like this (expected result, makes sense after all):
<text:p text:style-name="P7">There is my text.</text:p>
Is there any way to get rid superfluous xml tags? Or at least can user see a raw document in LibreOffice/OpenOffice to manually remove redundancy?
The key is to provide easy tool for a user, to detect and fix artefacts like this.
Have you tried Ctrl-M? If all formatting is defined in styles and style formatting is not manually overridden, it should not disturb the formatting but should remove redundant tags.
A tedious user process would be to cut and paste-special as text and apply style again.
Finally, a macro would definitely do the trick.

Latex Beamer: How is it possible to make piece of text in a frame in italics?

I am using Beamer in order to make a presentation. In one of the frames I want to write something like this:
"Italics is like that"
I used a command \it of Beamer for doing this:
\it{Italics} is like that
But as a result I get:
"Italics is like that"
Is it possible to make italics only a piece of text?
I believe you're looking for \textit{}.
Also, in the future, consider asking LaTeX questions on the TeX - LaTeX Stack Exchange site.
\it is a switch, it changes the font series starting from the point it was issued till the end of the current block. Therefore you have to enclose the block of text it should affect:
{\it Italics} is like that
Alternatively you can use \textit as suggested by gotgenes which only affects the text passed to the command within braces:
\textit{Italics} is like that.
What about \emph{text} ?

Adding MS-Word-like comments in LaTeX

I need a way to add text comments in "Word style" to a Latex document. I don't mean to comment the source code of the document. What I want is a way to add corrections, suggestions, etc. to the document, so that they don't interrupt the text flow, but that would still make it easy for everyone to know, which part of the sentence they are related to. They should also "disappear" when compiling the document for printing.
At first, I thought about writing a new command, that would just forward the input to \marginpar{}, and when compiling for printing would just make the definition empty. The problem is you have no guarantee where the comments will appear and you will not be able to distinguish them from the other marginpars.
Any idea?
todonotes is another package that makes nice looking callouts. You can see a number of examples in the documentation.
Since LaTeX is a text format, if you want to show someone the differences in a way that they can use them (and cherry pick from them) use the standard diff tool (e.g., diff -u orig.tex new.tex > docdiffs). This is the best way to annotate something like LaTeX documents, and can be easily used by anyone involved in the production of a document from LaTeX sources. You can then use standard LaTeX comments in your patch to explain the changes, and they can be very easily integrated. If the document lives in a version control system of some sort, just use the VCS to generate a patch file that can be reviewed.
I have used changes.sty, which gives basic change colouring:
\added{new text}
\deleted{old text}
\replaced{new text}{old text}
All of these take an optional parameter with the initials of the author who did this change. This results in different colours used, and these initials are displayed superscripted after the changed text.
\replaced[MI]{new text}{old text}
You can hide the change marks by giving the option final to the changes package.
This is very basic, and comments are not supported, but it might help.
My little home-rolled "fixme" tool uses \marginpar where possible and goes inline in places (like captions) where that is hard to arrange. This works out because I don't often use margin paragraphs for other things. This does mean you can't finalize the layout until everything is fixed, but I don't feel much pain from that...
Other than that I heartily agree with Michael about using standard tools and version control.
See also:
Tips for collaboratively editing a LaTeX document (which addresses you main question...)
https://stackoverflow.com/questions/193298/best-practices-in-latex
and a self-plug:
How do I get Emacs to fill sentences, but not paragraphs?
You could also try the trackchanges package.
You can use the changebar package to highlight areas of text that have been affected.
If you don't want to do the markup manually (which can be tedious and interrupt the flow of editing) the neat latexdiff utility will take a diff of your document and produce a version of it with markup added to visually display the changes between the two versions in the typeset output.
This would be my preferred solution, although I haven't tested it out on large, multi-file documents.
The best package I know is Easy Review that provides the commenting functionality into LaTeX environment. For example, you can use the following simple commands such as \add{NEW TEXT}, \remove{OLD TEXT}, \replace{OLD TEXT}{NEW TEXT}, \comment{TEXT}{COMMENT}, \highlight{TEXT}, and \alert{TEXT}.
Some examples can be found here.
The todonotes package looks great, but if that proves too cumbersome to use, a simple solution is just to use footnotes (e.g. in red to separate them from regular footnotes).
Package trackchanges.sty works exactly the way changes.sty. See #Svante's reply.
It has easy to remember commands and you can change how edits will appear after compiling the document. You can also hide the edits for printing.

Incorrect hyperlinking in LaTeX

So far the hyperref package in LaTeX has automatically linked all the items in my report correctly. But there is one that did not get linked properly, possibly because I manually added it to the table of contents like this:
\addcontentsline{toc}{chapter}{Bibliography}
How do I fix this?
You have to use the \phantomsection macro just before or after the \addtocontentsline. This instructs hyperref to add an anchor at that point. Also, take into account that you have to run LaTeX several times to make this anchor to be in the exact place.
If you're using a standard LaTeX document class, such as report, you can use the tocbibind package, and then you won't need the \addcontentsline command and the hyperlinks should work correctly. From the documentation:
The tocbibind package enables the titles of the Table of Contents, the List of Figure, the List of Tables, the Bibliography and the Index all to be added to the Table of Contents.
I'd also suggest looking at the memoir class, which also solves this problem. It's intended to be a replacement for the standard report and book classes, and provides lots of options and commands for customisation.

Resources