Adding MS-Word-like comments in LaTeX - 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.

Related

Styling of biblography - change underline to italic (Latex)

I am struggeling with latex biblography styling.
Using the predefined
\bibliographystyle{plain}
style i get a nice result:
When adding the following package:
\usepackage {ulem}
I get this result in the biblography:
How can i remove the underline of the journal and get it italic?
I tried:
\renewcommand{\uline}[1]{\textit{#1}}
and also following, to undefine \uline
\renewcommand\uline[1]{}
But both create a lot of "Missing } inserted.\end{thebibliography}" in the bbl file. Is there a way to revert the \usepackage command or get back the old style?
One of the features of the ulem package is to redefine \emph so that it uses \uline, so (as is presumably already clear to you) that's why you're getting underline in the bibliography, where text was emphasised before.
The documentation for the ulem package notes that adding the [normalem] option when loading the ulem package means that \uline is defined but \emph isn't redefined. I don't know if that would be an acceptable solution for you – ie, do you in fact want \emph to be underlined throughout the rest of the document?
Alternatively, if you only want \emph to go back to its original definition for the bibliography, you could try (ulem docs again) giving the command \normalem before loading the bibliography. However, the way that the bibliography is loaded can sometimes make it unexpectedly difficult to fiddle with its formatting (as you've discovered, when trying to redefine \uline).
If these thoughts don't resolve things, try posting a ‘minimal working example’. You may also be better off looking at, or possibly posting to, the TeX stackexchange.
If anyone faced the issue of getting \hbuf errors in the Bibliography.
The Solution by NormanGrey helps in this case also:
The documentation for the ulem package notes that adding the [normalem] option when loading the ulem package...
Thus, just by making a small change in the settings.tex fixed this error:
\usepackage[normalem]{ulem}
It not only removed the underline, it fixed the overflow I had, as you can see here:
to
Thank you a lot.

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.

Simple preprocessor for latex: detect whether you are an included file or being compiled stand-alone

I work on a huge script in \latex.
I want to be able to compile each of the chapters as stand-alone, because it is easier for hacking sessions with Latex.
On the other hand, I would like to maintain a document which encompasses the whole script so far written.
I do not know how to maintain both these documents without permanently annoying overhead, as a tex-file can either be written stand-alone or to be included.
It would be great help to have something a Latex-preprocessor available that is capable of C-like #define and #ifdef-#else-#endif statements. This would facilitate writing to a great extent. Do you know whether something like this exists in latex, or how can you do something equivalent? Google hasn't supplied me with a satisfying answer to this.
EDIT:
Some remarks in order to avoid misunderstandings: I am aware of the very simple built-in TEX-preprocessor, but these commands don't work properly as I expected. Hence a reference to these will not help me out.
The chapters in my script shall look something like this (Pseudo-Code)
IF being_just_included defined
%No header here, and document has already begun
ELSE
\input{common_header.tex} %Header things all my documents use
\begin{document}
ENDIF
%%% Lots of stuff
IF being_just_included defined
%Nothing to do here
ELSE
\end{document}
END IF
In contrast, my complete script source file should look like this
\input{common_header.tex}
DEFINE being_just_included
\begin{document}
\input{preamble.tex}
\input{first_chapter.tex}
\input{second_chapter.tex}
\input{third_chapter.tex}
\end{document}
Could you post a code which performs something like this?
Thank you very much for this package and the hint to the forum.
After some time I've figured out there exists a tex preprocessor, which is similar to the CPP. Maybe not well-engineered, but it serves my purpose quite well.
The magic lines are:
\def\justbeingincluded{justbeingincluded}
\ifx\justbeingincluded\undefined
\fi
to be used appropiatly within the respective source files.
One way of doing this is to use the standalone package, intended for this specific purpose.
You may also care to browse through, and perhaps join, TeX and Friends.

LaTeX, ntheorem package and memoir document class: no room for new \count error

So I want to use memoir document class and the ntheorem package with the thmmarks option. When I try and compile a file like this, I get "no room for a new \count" errors. What can I do about this?
ntheorem with thmmarks option works fine in article, and ntheorem works alright in memoir as long as I don't try and use the thmmarks option...
To reformulate the question: Is there a way to, I don't know, cut out parts of the memoir class definitions that I don't use to free up some \counts for ntheorem thmmarks? Or is there a way to alter how many \counts LaTeX allows so that there are enough to share?
(I'm fully aware that insisting on using memoir for typesetting a theorem-heavy document is a little perverse, but what the heck.)
See the TeX FAQ entry about this error: No room for a new “thing”.
With any modern LaTeX installation, you're going to be using eTeX. Thus, based on that FAQ entry, you should be able to fix the problem by inserting
\usepackage{etex}
immediately after your \documentclass line. If that's insufficient, try also adding the \reserveinserts{n} line suggested there with some appropriate number of additional inserts (which I guess you can find by trial and error), to reserve additional space. (A bit of Google-searching on reserveinserts ntheorem indicates that this is a common problem with the ntheorem package, and finds a suggestion of 10 as a reasonable value, though you may need more.)
If that works, you might also write to the Memoir class author, and suggest that he add a note to this effect in the manual.
This thread also suggests an alternate method of loading the ntheorem package that may help, if \reserveinserts doesn't do the trick:
http://newsgroups.derkeiler.com/Archive/Comp/comp.text.tex/2009-03/msg00531.html
memoir wasn't really designed to be setting all that math-- hence the name memoir and as such, memoir does things in kind-of its own way, and provides much more functionality out of the box than article, report, or book. this comes at a cost though, as some packages aren't compatible with memoir... you might be better of using article, report or book. However, there is an extensive list of errors in the memoir manual. read it!

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.

Resources