请提供MWE, 我这边没有问题
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\section{$\bar{s},\underline{aa}$}
\subsection{$r_1>\bar{\mu}_1$and$r_2<\underline{\mu}_2$}
\subsection{The worst case prior in $[\underline{\mu}, \bar{\mu}] \times[\underline{\sigma}, \bar{\sigma}]$}
\end{document}
texlive2023 + PDFLaTeX
问 为什么在\section中使用\underline就报错?