0

I'm trying to figure out what I did that screwed up the formatting of this course notes template. I apologize for not having a better MWE, but it seems to all have parts together to it.

MWE (edited): \documentclass[11pt]{article}

\newcommand{\classheader}[1]{\newpage\section*{#1}
\phantomsection \addcontentsline{toc}{section}{(#1)}
}

\usepackage{fancyhdr}
\pagestyle{fancy}
\rfoot{\parbox[t]{0.9in}{\centering Page \thepage\\ \classheader}}

\usepackage{hyperref}

\begin{document}

\thispagestyle{empty}
\tableofcontents

\newpage
\thispagestyle{empty}


\section*{Introduction}

\include{SecurityisMathematics}

\end{document}

Security is Mathematics.tex (as an MWE)

\classheader{Security is Mathematics}
\section{Security is Mathematics}\label{security-is-mathematics}

Insert Text Here

These two documents, compiled while in the same directory, provide the following first page as output. Not exactly what I'm looking for. Any thoughts on how to fix this and make it cleaner? Thanks all!

Output

1

You can drastically reduce your ca 500 line long master document to the following MWE that still reproduces your problem with the table of contents:

\documentclass[11pt]{article}

\newcommand{\classheader}[1]{\newpage\section*{#1}
\phantomsection \addcontentsline{toc}{section}{(#1)}
}

\usepackage{fancyhdr}
\pagestyle{fancy}
\rfoot{\parbox[t]{0.9in}{\centering Page \thepage\\ \classheader}}

\usepackage{hyperref}

\begin{document}

\thispagestyle{empty}
\tableofcontents

\newpage
\thispagestyle{empty}


\section*{Introduction}

\include{SecurityisMathematics}

\end{document}

enter image description here

If you now comment out line 4 (\phantomsection...), you achieve the following output:

enter image description here

Applied to your original example, you get:

enter image description here


Apart from that, you might be interested in using a different documentclass like report or even book that are better suited for longer documents. They also provide the chapter command that automatically starts on a new page.

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.