![如何在 LaTeX 中更改所有章节标题的格式?](https://linux22.com/image/425002/%E5%A6%82%E4%BD%95%E5%9C%A8%20LaTeX%20%E4%B8%AD%E6%9B%B4%E6%94%B9%E6%89%80%E6%9C%89%E7%AB%A0%E8%8A%82%E6%A0%87%E9%A2%98%E7%9A%84%E6%A0%BC%E5%BC%8F%EF%BC%9F.png)
答案1
像这样吗?
\documentclass[a4paper, 12pt, fleqn]{article}
\usepackage{titlesec}
\usepackage{xcolor}
\renewcommand{\familydefault}{\sfdefault}
\titleformat{\section}[display]{\centering\Large\bfseries}{}{0pt}{\underline}
\titleformat{\subsection}{\large\bfseries\color{darkgray}}{}{0pt}{\underline}
\titleformat{\subsubsection}{\bfseries\color{gray}}{}{0pt}{}
\setcounter{secnumdepth}{0}
\begin{document}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
Text
\end{document}