3

I need to underline the word "References" in the table of contents of an article-based document. These are not my specs, so please do not criticize me for this request. Basically, I need the TOC to look like:

  1. Chapter 1
  2. Chapter 2

References

where References in underlined.

I am currently using packages titletoc and titlesec. This must be easy, right?

Thanks in advance.

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{babel}
\begin{document}
This is a test...

\tableofcontents{}


\section{This is a section}

test one two three as seen in 

and here is a reference \cite{Niesen}. 


\section{this is the second section}

\addcontentsline{toc}{section}{References}\bibliographystyle{plain}
\begin{thebibliography}{100}

\bibitem{Niesen}
Niesen, Social networks/blogs now account for one in every four and a half
  minutes online,
  http://blog.nielsen.com/nielsenwire/global/social-media-accounts-for-22-perc%
ent-of-time-online/, report (June 2010).
\end{thebibliography}

\end{document}
  • Welcome to TeX.SE. It would be helpful if you composed a fully compilable MWE including \documentclass and the appropriate packages that sets up the problem. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem. – Peter Grill Oct 28 '14 at 20:51
  • \documentclass[english]{article} \usepackage[T1]{fontenc} \usepackage[latin9]{inputenc} \usepackage{babel} \begin{document} \tableofcontents{} \section{This is a section} here is a reference \cite{Niesen}. \section{this is the second section} \addcontentsline{toc}{section}{References}\bibliographystyle{plain} \begin{thebibliography}{100} \bibitem{Niesen} Niesen, Social networks/blogs now and a half minutes online, blog.nielsen.com/nielsenwire/global/… ent-of-time-online/, report (June 2010). \end{thebibliography} \end{document} – user65240 Oct 28 '14 at 21:08
  • 1
    @user65240 -- please incorporate your example in your question. you should be able to edit it yourself. – barbara beeton Oct 28 '14 at 21:13
  • Thanks, I'm trying. :) Is there a way to attach - or do I just add the content? – user65240 Oct 28 '14 at 21:17
  • You can select the code and click on the {} button above the editing window. – egreg Oct 28 '14 at 21:18
2

If you're adding the bibliography by hand, it's better to have the \addcontentsline inside the thebibliography environment. If you're using BibTeX, then you should check whether the bibliography starts a new page, and possibly add \pagebreak before \addcontentsline in case it does or the table of contents entry would be off by one.

Anyway, the trick is to say

\addcontentsline{toc}{section}{\protect\underline{\refname}}
  • Thanks, that is the solution I was looking for. I'm using LyX so I just tried to post a minimal working example - but I'm using BibTeX with a \pagebreak before the \addcontentsline. – user65240 Oct 28 '14 at 21:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.