\documentclass[fontset=fandol]{ctexart}
\ctexset{section/format+={\raggedright}}
\parindent=0pt
\begin{document}
\begingroup\ctexset{section/format+=\centering}
\tableofcontents
\endgroup
\section{aaaa}
\section{bbbb}
\section{cccc}
\section*{ddd}
\end{document}一般情况下 \section 等命令不建议放在组中(因为它们可能为了实现某些效果会重定义 \par),但只在目录里这么做还是问题不大的,目录条目一般都会使用自定义的格式,而不像普通段落那样。







问 在ctexart框架中,希望不借助tocloft的设置修改「目录」的对齐情况而不影响`\section*`