基本方式:
\usepackage[explicit]{titlesec}
\titlespacing*{\section}{0pt}{1.2ex plus .0ex minus .0ex}{.3ex plus .0ex}
\titlespacing*{\subsection}{0pt}{1.2ex plus .0ex minus .0ex}{.3ex plus .0ex}
其中[explicit]是可选的字段。
\section表示对section进行调整。第二个字段代表段前,第三个字段是段后。
如果需要调整标题的字体。可以按照这样处理:
\titleformat{\section} % command
%[hang] % shape
{\normalfont\Large\bfseries} % format
{\thesection} % label
{1em} % Spacing between label and title
{\MakeUppercase{#1}} % before code
\titleformat{\section} 代表对section 标题格式调整。
{1em} % Spacing between label and title
这个调整的是数字序号,和实际标题内容之间的间隔。这个在调整的时候非常有用。
{\MakeUppercase{#1}} % before code 代表首字母大写。
如果是IEEEcls里面,会出现
!Undefined control sequence. <argument> \subparagraph
这样的错误,只要在使用titlesec package之前定义命令:
\newcommand{\subparagraph}{}
\usepackage{titlesec}
另外:\section*{},星号代表自动取消标题后面段落的首行缩进。
恢复缩进只要取消星号即可。
\titlespacing{\section}{0pt}{1.2ex plus .0ex minus .0ex}{.3ex plus .0ex}
\titlespacing{\subsection}{0pt}{1.2ex plus .0ex minus .0ex}{.3ex plus .0ex}