I'm new here, so I hope I'm adhering to any community rules.
I am trying to create a table of contents for some notes I'd like to record on LaTex. Here is my code:
\documentclass[12pt]{article}
\usepackage[margin=0.90in]{geometry}
\usepackage{amsmath,amsthm,amssymb,scrextend}
\usepackage{fancyhdr}
\usepackage{titlesec}
\makeatletter
\renewcommand\subsection{\addtocontents{toc}{\protect\addvspace{5\p@}}%
\if@openright\cleardoublepage\else\clearpage\fi
\thispagestyle{plain}%
\global\@topnum\z@
\@afterindentfalse
\secdef\@subsection\@ssubsection}
\renewcommand\section{\addtocontents{toc}{\protect\addvspace{20\p@}}%
\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\normalfont\Large\bfseries}}
\makeatother
\begin{document}
% --------------------------------------------------------------
% Start here
% --------------------------------------------------------------
\lhead{Physics in Medicine}
\chead{}
\rhead{Revision Notes}
\lfoot{}
\cfoot{Page \thepage \hspace{1pt} of 16}
\rfoot{}
% \maketitle
\title{\textbf{\textit{Physics in Medicine -- Revision Notes}}}
\date{}
\begin{titlepage}
\vspace{100 mm}
\maketitle
\doublespacing
\tableofcontents
\end{titlepage}
\vfill
\newpage
\singlespacing
\addcontentsline{toc}{section}{Section 1: X-ray imaging}
\addcontentsline{toc}{subsection}{What are x-rays?}
\section*{Section 1: X-ray imaging}
\vspace{2mm}
\newline \noindent \textbf{What are x-rays?}
\vspace{3mm}
\noindent TEXT
\vspace{10mm}
\addcontentsline{toc}{subsection}{Production of x-rays}
\newline \noindent \textbf{Production of x-rays}
\vspace{8mm}
TEXT
\end{document}
But the result is shown on the picture - horrible big spaces between the content lines. Don't know how to fix this so advice is appreciated :)
\documentclass
and ending with\end{document}
, that shows this output. With suuch a document it is easier for the community to reproduce your issue and to suggest solutions.edit
button below the question text, and you can format code within the question but inserting 4 spaces before the code lines, or by selecting the code and pressing the code formatting button (that looks like{}
)