Text FormattingTable of Contents Formatting

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
mrdwustl
Posts: 7
Joined: Wed Mar 31, 2010 2:56 am

Table of Contents Formatting

Post by mrdwustl »

Hello. I am trying to make a table of contents and all of the page numbers are not correctly corresponding with the right pages. In fact, they are all coming up as page ii.

Any idea how to get the page numbers correctly display? Thanks.

Code: Select all

\documentclass[11pt]{article}

\usepackage[top=0.75in, bottom=1in, right=0.75in, left=0.75in]{geometry}
\usepackage{amssymb}
\usepackage{listings}
\usepackage[sc]{mathpazo}
\usepackage{natbib}
\usepackage{graphicx}
\usepackage{subfigure}
\usepackage{ctable}
\usepackage{subfigure}
\usepackage{float}

\begin{document}

\pagenumbering{roman}
\tableofcontents
\cleardoublepage
\addcontentsline{toc}{section}{Introduction}
\addcontentsline{toc}{subsection}{Literature Review}
.
.
.
\newpage \pagenumbering{arabic}

\section*{Introduction}
text
\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

mas
Posts: 226
Joined: Thu Dec 04, 2008 4:39 am

Table of Contents Formatting

Post by mas »

You should put the addcontentsline after the relevant section declarations.

Code: Select all

...
.
.
.
\newpage \pagenumbering{arabic}

\section*{Introduction}
\addcontentsline{toc}{section}{Introduction}
text

\section*{Literature Review}
\addcontentsline{toc}{subsection}{Literature Review}
text
\end{document}
Regards

OS: Debian/GNU Linux; LaTeX System : TeXLive; Editor : Vim
mrdwustl
Posts: 7
Joined: Wed Mar 31, 2010 2:56 am

Re: Table of Contents Formatting

Post by mrdwustl »

Works, thanks!
Post Reply