Including \lstlistoflistings and reference it in the table of contents - latex

I have a question about including a directory for listings in my table of content. I'm using \lstlistoflistings and \tableofcontents and the \usepackage{listings}. Now my question:
When I generate the list of listings, it is filled with the listings in my document, but it isn't referenced in my table of contents. There is no entry in my table of contents for the list of listings. Can someone imagine, what i've done wrong? Or is there a special trick for including ist?
Thank you!

It depends a lot on the \documentclass you are using. But for the standard classes (book,article, etc.) this should suffice.
Add this line:
\addcontentsline{toc}{section}{Listings}
right before \lstlistoflistings.
This will probably not work for other classes. If it doesn't work, please tell which class you are using.

Related

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)

LaTeX: Cite, but don't reference

I'm producing a set of documents in LaTeX, and I would like to provide a single, global bibliography page for the whole set. This is because each document is page-limited: I don't want to take up space with references at the bottom of each one.
This means in each case, I would like to cite in the text, but not produce a reference at the end. I am using bibtex/natbib to handle the referencing.
Simplest example:
\documentclass[]{article}
\bibliographystyle{/usr/share/texmf/bibtex/bst/natbib/plainnat.bst}
\usepackage{natbib}
\begin{document}
In \citet*{MEF2010} I described the method.
\bibliography{bibliography.bib}
\end{document}
How can I do this? Essentially I just want it to cite correctly:
In Bloggs, Blagg and Blog (2010) I described the method.
But not add a references section at the end. Any ideas?
Thanks,
David
Instead of using \bibliography{bibliography.bib} you can try \nobibliography{bibliography.bib}.
You still need to enter the path so it can make the cross-references.
It happens due to missing packages. If you want to resolve the problem then enable the automatic installation packet. After that,First, you run the BibTeX file and generate the Pdf file (instead of pdfLatex file) and then pdfLatex to Pdf

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}

LaTeX: disable or turn off hyperlinking for table of contents?

I want a table of contents, but I don't want each line to be a clickable hyperlink. How do I do this?
Details:
I am using the \anothertoc command from the shorttoc package to "import" the TOC from another document. Works fine, except that all the links for the imported TOC are broken (obviously)... so, I want to de-linkify them.
Not sure whether this is relevant, but the TOC that I'm importing is from a document that uses the hyperref package. I have a feeling that hyperref is making the TOCs hyperlinked, but I can't find any option for the hyperref package to disable hyperlinking for TOCs.
You can consider the linktoc parameter when importing the package with for instance
\usepackage[linktoc=none]{hyperref} or
\usepackage[linktoc=page]{hyperref}.
You can refer to paragraph 5.13 of the manual at https://mirrors.chevalier.io/CTAN/macros/latex/contrib/hyperref/doc/hyperref-doc.pdf
How are you "importing" the toc?
I'd have a look at the hyperref manual at : http://www.tug.org/applications/hyperref/manual.html
The simple solution would be to turn off hyperlinking in the document toc that you are importing, though I realize that might not be possible.
A solution using Normadize's answer based on \NoHyper working well with the shorttoc package:
{\protect\NoHyper%
\anothertoc{other-document}{Toc from other document}{1}
\protect\endNoHyper}%

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