Why Bibliography and References appears in Latex TOC? - latex

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)

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?

Latex \tableofcontents command always shows blank Contents on first build

When I generate a .pdf file from a .tex file using pdflatex, only the "Contents" title is shown with no actual TOC. If I run pdflatex my.tex once more, it generates the TOC just fine. I can reproduce this simply by removing the .toc file. What I think is happening is that my .toc file is being generated too late -- so how can I make the TOC work first time? Should I be generating the TOC beforehand without using pdflatex?
This is normal. LaTeX document need several compilations to reach a stable state. Use rubber -d my to compile the right number of times (rubber comes as a package on many linux distros).
I might be mistaken, but I think, that this is the default behaviour. I assume, you also won't find correct cross references (footnotes, end notes, literature) after the first run of pdflatex.
The point is, that LaTeX needs the extra rounds to resolve the references pointing inside the document, to get numbering and page numbers right.
I experienced the same problem with the editor Latexian. What solved the problem was changing the preferences. I changed "Number of typesetter runs at end" to 3, instead of the default 1. Then I added the "Refresh" button to the toolbar and tried refreshing and it worked.

Getting subsection to list in table of contents in LaTeX

I made a table of contents using \tableofcontents Each section is made using \section yet when I do \subsection it is not listed in the table. How do I get it to list there? Thanks.
Which document class are you using? I just tested it for article, and it works fine. In any case, try using this in the preamble:
\setcounter{tocdepth}{2}
Increase 2 if you want to list subsubsection, etc.
Add:
\setcounter{tocdepth}{5}
to the preamble.
See: http://www.devdaily.com/blog/post/linux-unix/latex-setting-table-of-contents-toc-depth
#WhirlWind and #Steve_Tjoa got it and helped me too! One thing though, whatever you set the tocdepth counter to, you may also want to set the secnumdepth.
so i used
\setcounter{tocdepth}{5}
as suggested by #Whirlwind but then the subsubsection in my Table of Contents wasn't numbered. so I added the following to get it to work (thanks to the following link where i found the answer http://www.latex-community.org/viewtopic.php?f=5&t=2351#p9197 )
\setcounter{secnumdepth}{5}

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