0

I am using MiKTex 2.9. I would like to include the 'Abbreviations' page in my contents page, along with the roman numeral page number. However when I use the \section{section name}command it gives the title a section number. And when I use \section*{section name}, the title does not appear in the contents page. I have also tried the suggestion from Using scrbook, how to suppress page numbers for all but several chapters in TOC? but I get an 'undefined control error'.

Can you please advise? I have attached my MWE.

    \documentclass[a4paper,11pt]{article}
\usepackage{color}
\usepackage{graphicx, epstopdf}
\usepackage{gensymb}
\usepackage{times}
\usepackage{adjustbox}
\usepackage{tabulary}
\usepackage{tabularx}
\usepackage{booktabs,caption, makecell}
\usepackage{pdflscape,afterpage,caption}
\usepackage[british]{babel}
\usepackage[backend=bibtex, citestyle=ieee, bibstyle=ieee]{biblatex}
\usepackage[section]{placeins}%Allows you to permanently fix figures. 

\begin{document}
\pagenumbering{roman}
\newpage
\tableofcontents
\newpage
\section*{Abbreviations}
\begin{table}[ht]
\setlength\tabcolsep{60pt}
\centering
  \small
 % your table
    \hspace*{-18mm}%
\begin{tabular}{cc}
\toprule
{Abbreviation}&{Explanation}\\ [0.5ex]
\midrule
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
\bottomrule
 \end{tabular}%
    \hspace*{-12mm}%
\label{table:ETD Raman}
\end{table}
\newpage
\pagenumbering{arabic}
\section{Test 1}
Video provides a powerful way to help you prove your point. When you click Online Video, you can paste in the embed code for the video you want to add. You can also type a keyword to search online for the video that best fits your document.

\end{document}

Thanks in advance!

1
  • Using a table environment is wrong here, remove it. Also, Always do \cleardoublepage before changing the pagenumbering style. Also, package times is obsolete for many years, just to point out a few things in your code.
    – Johannes_B
    Feb 24, 2018 at 9:42

1 Answer 1

1

Use the standard LaTeX command \addcontentsline{<file>}{<kind>}{<text>} immediately after your \section*{Abbreviations} as:

\section*{Abbreviations}
\addcontentsline{toc}{section}{Abbreviations}

which will put an unnumbered section style heading and page number into the .toc file for printing in the ToC.

7
  • 1
    this will work if the abbreviations list is less than a page, but if it's longer than a page, the page number in the toc will be wrong. in that case, since \newoage immediately precedes \section*{Abbreviations}, the \addcontentsline cam be moved up to precede the \section* line. Feb 21, 2018 at 19:11
  • @barbarabeeton. My table is greater than a page but your suggestion does not seem to work. The order that I currently have (from top to bottom of page) is: '\newpage' , \addcontentsline{toc}{section}{Abbreviations} , \section*{Abbreviations}. Any advice you can give would be great.
    – Kevin
    Feb 22, 2018 at 12:24
  • @Kevin -- after looking more closely at the structure of your example, it is clear that this answer will work as advertised. (there are circumstances where my suggestion is more reliable. however, using the example as you have framed it, either order works. so there must be something else affecting your real file. remember that you have to process the file twice to add an entry to the toc.) Feb 22, 2018 at 14:13
  • @barbarabeeton When is your suggestion more reliable? My understanding is that a \section command might start a new page before the title but will not immediately start one after the title, so a following \addcontentsline will use the page number of the section's title. Feb 22, 2018 at 19:55
  • @Kevin Did my answer work for you? If not please give a MWE showing the failure. Feb 22, 2018 at 19:58

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