\documentclass[12pt,reqno,a4paper]{amsart}
\usepackage{extsizes}
\usepackage{blindtext}
\textheight 9.3in \textwidth 6.5in
\calclayout
\usepackage{mathtools}
\usepackage{amsmath,amsthm,amsfonts,amssymb}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{corollary}{Corollary}[section]
\usepackage{hyperref}
\usepackage{mathrsfs}
\usepackage[all]{xy}
\usepackage[normalem]{ulem}
\newtheorem{lemma}{Lemma}[subsection]
\newtheorem*{question}{Question}
\theoremstyle{definition}
\newcommand{\mc}{\mathcal}
\newcommand{\mf}{\mathfrak}
\newtheorem*{solution}{Solution}
\newtheorem{definition}{Definition}[section]
\newtheorem{remark}{Remark}[section]
\newtheorem{proposition}{Proposition}[section]
\newtheorem{exercise}{Exercise}
\newtheorem{example}{Example}[section]
\usepackage{tikz-cd}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{datetime}
% \renewcommand{\baselinestretch}{2}
\usepackage{color}
\pagestyle{myheadings}
\newcommand{\xra}{\xrightarrow}
\newcommand{\ra}{\rightarrow}
\title{A}
\author{B}
\begin{document}
\today
\begin{abstract}
\end{abstract}
\maketitle
\tableofcontents
\section{asdsd}
\subsection{A $p\colon \underline{X}\ra \mc{D}$B}
\end{document}
When I do not run \tableofcontents, I see no problem. If I run \tableofcontents, I see
line 3: Missing $ inserted. ...htarrow \mathcal {D}$B}}{2}{subsection.1.1}
line 3: Missing $ inserted. ...htarrow \mathcal {D}$B}}{2}{subsection.1.1}
: It is better to use one of the extsizes classes, if you can.
line 48: Token not allowed in a PDF string (PDFDocEncoding):(hyperref) removing `math shift'
line 48: Token not allowed in a PDF string (PDFDocEncoding):(hyperref) removing `\mskip'
line 48: Token not allowed in a PDF string (PDFDocEncoding):(hyperref) removing `\mathpunct'
line 48: Token not allowed in a PDF string (PDFDocEncoding):(hyperref) removing `\nonscript'
line 48: Token not allowed in a PDF string (PDFDocEncoding):(hyperref) removing `\mkern'
line 48: Token not allowed in a PDF string (PDFDocEncoding):(hyperref) removing `\thinmuskip'
line 48: Token not allowed in a PDF string (PDFDocEncoding):(hyperref) removing `\mskip'
line 48: Token not allowed in a PDF string (PDFDocEncoding):(hyperref) removing `math shift'
line 48: Token not allowed in a PDF string (PDFDocEncoding):(hyperref) removing `\@@underline'
line 48: Token not allowed in a PDF string (PDFDocEncoding):(hyperref) removing `\hbox'
line 48: Token not allowed in a PDF string (PDFDocEncoding):(hyperref) removing `\mathsurround'
line 48: Token not allowed in a PDF string (PDFDocEncoding):(hyperref) removing `\z@'
line 48: Token not allowed in a PDF string (PDFDocEncoding):(hyperref) removing `math shift'
line 48: Token not allowed in a PDF string (PDFDocEncoding):(hyperref) removing `\rightarrow'
line 48: Token not allowed in a PDF string (PDFDocEncoding):(hyperref) removing `math shift'
: Label(s) may have changed. Rerun to get cross-references right.
In above, first two came as errors in red font. It is mentioned as file document.toc Third is as a warning. It is mentioned as file extsizes.sty
Everything else came as warnings in the file document.tex
hyperrefshould (in most cases) be loaded last. Apart from that, Equations in section heading/title might be interesting. – leandriis Apr 28 '19 at 18:05