% 一级标题:第一章 绪论(对应\section)
\titleformat{\section}[block]
{% 字体设置
\centering % 居中对齐
\bfseries % 加粗
\fontsize{16pt}{16pt}\selectfont % 三号字(16pt),单倍行距
\CJKfontspec{SimHei}% 中文黑体
\fontspec{Times New Roman}% 西文Times New Roman
}
{\thesection}% 题序(如"第一章")
{1\ccwd}% 题序与标题间空1个汉字宽度(1个空格)
{}% 标题内容前无额外内容
{}
\titlespacing{\section}
{0pt}% 左缩进
{15.6pt}% 段前距离
{15.6pt}% 段后距离
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 二级标题:1.1 研究背景(对应\subsection)
\titleformat{\subsection}[block]
{% 字体设置
\raggedright % 左对齐
\bfseries % 加粗
\fontsize{14pt}{14pt}\selectfont % 四号字(14pt),单倍行距
\CJKfontspec{SimHei}% 中文黑体
\fontspec{Times New Roman}% 西文Times New Roman
}
{\thesubsection}% 题序(如"1.1")
{1\ccwd}% 题序与标题间空1个汉字宽度(1个空格)
{}% 标题内容前无额外内容
{}
\titlespacing{\subsection}
{0pt}% 左缩进
{9.1pt}% 段前距离
{9.1pt}% 段后距离
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%三级标题
% 2. 字体与样式(严格匹配要求)
\titleformat{\subsubsection}[block]
{%
\raggedright % 左对齐(无缩进)
\bfseries % 加粗
\fontsize{12pt}{12pt} % 小四号(12pt),单倍行距(标题自身行距=字号)
\CJKfontspec{SimHei}% 中文黑体
\fontspec{Times New Roman}% 西文Times New Roman
}
{\thesubsubsection}% 题序(如"1.4.1")
{1\ccwd}% 题序与标题间空1个汉字宽度(1个空格)
{}% 标题内容前无额外内容
{}
\titlespacing{\subsubsection}
{0pt}% 左缩进(无)
{8pt}% 段前0.5行(基于当前字体的行高)
{8pt}% 段后0.5行
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%四级标题
% 四级标题完整配置(确保显示)
% 四级标题完整配置(与三级标题一致)
\newcounter{subsubsubsection}[subsubsection]
\renewcommand{\thesubsubsubsection}{\arabic{section}.\arabic{subsection}.\arabic{subsubsubsection}.\arabic{subsubsubsection}}
\titleformat{\subsubsubsection}[block]
{%
\raggedright
\bfseries
\fontsize{12pt}{15.6pt}\selectfont
\CJKfontspec{SimHei}
\fontspec{Times New Roman}
}
{\thesubsubsubsection}
{1\ccwd}
{}
{} % 无额外命令
\titlespacing{\subsubsubsection}
{0pt}
{8pt}% 段前0.5行
{8pt}% 段后0.5行(固定值,与三级标题一致)
% 简化自定义命令,移除强制行距
\newcommand{\subsubsubsection}[1]{%
\par
\refstepcounter{subsubsubsection}%
{\raggedright\bfseries\fontsize{12pt}{15.6pt}\selectfont\CJKfontspec{SimHei}\fontspec{Times New Roman}%
\thesubsubsubsection\hspace{1\ccwd}#1\par}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 创建独立正文环境(强制固定行距20磅)
\newenvironment{maintext}{%
\begingroup% 局部作用域,隔离外部设置
\interlinepenalty=0% 允许段落分页
\brokenpenalty=0% 允许段落跨页
\raggedbottom
% 1. 核心:强制行距为20pt,不缩放
\linespread{1}\selectfont% 禁用行距缩放(关键!避免setspace宏包干扰)
\fontsize{12pt}{20pt}\selectfont% 字号12pt,行距绑定为20pt(第二个参数直接控制\baselineskip)
% 2. 锁定行距参数,不允许小于20pt
\setlength{\baselineskip}{20pt}% 显式设置基线距为20pt(双重保障)
\setlength{\lineskiplimit}{19.9pt}% 允许行距最小为19.9pt(仅比20pt小0.1pt,确保正文内强制20pt)
\setlength{\lineskip}{20pt}% 多行环境(如列表、表格)强制行距20pt
% 3. 正文格式设置
\justifying% 两端对齐
\setlength{\parskip}{0pt}% 段落间距0(避免干扰)
\setlength{\parindent}{2em}% 首行缩进2字符
\frenchspacing% 取消句末额外空格
% 4. 确保表格内行距同步为20pt
\AtBeginEnvironment{tabular}{\fontsize{12pt}{20pt}\selectfont\setlength{\baselineskip}{20pt}}
% 5. 移除\everypar强制命令(避免干扰标题后第一个段落)
}{%
\endgroup% 结束局部作用域
}
查看更多