Titlesec 问题,无法编译

Titlesec 问题,无法编译

我回到一个几年没用过的 .tex 文件,它不再编译。我把问题缩小到了 titlesec 包(我认为);如果我能找出为什么这个 MWE 无法编译,也许我就能找到答案:

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

   \documentclass[paper=4.25in:6.75in,pagesize=auto,fontsize=9.5pt,headings=small,BCOR=.25mm,openany,DIV=16]{scrbook}

\usepackage{blindtext}

\usepackage[compact]{titlesec}
\titlespacing{\section}{0pt}{2ex}{1ex}
\titlespacing{\subsection}{0pt}{1ex}{0ex}
\titlespacing{\subsubsection}{0pt}{0.5ex}{0ex}
\vspace{-1mm}

\begin{document}
\chapter{red}
\blindtext
\section{blue}
\blindtext
\subsection{green}
\blindtext
\subsubsection{yellow}




\end{document}

这是抛出的错误:

test+001.tex:17: Missing number, treated as zero. 
<to be read again>
                                }
1.17 \section{blue}
?

如果我添加以下行,tex 文件就会编译:

\titleformat{\section}
 {\normalfont\Large\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}
 {\normalfont\large\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}
 {\normalfont\normalsize\bfseries}{\thesubsubsection}{1em}{}

相关内容