添加完整的cveoreport文档类模板,包含: - 符合国内政府文档规范的文档类定义 - 示例主文档、章节文件和编译脚本 - 多种中文字体文件支持 - 详细的README使用说明 - 特殊环境(重点框、警告框等)和表格样式
399 lines
11 KiB
TeX
399 lines
11 KiB
TeX
%==============================================================================
|
||
% cveoreport.cls - 通用技术报告 LaTeX 文档类
|
||
%==============================================================================
|
||
% 模板名称:cveoreport
|
||
% 适用场景:技术方案、报告文档、项目申报书、研究报告等
|
||
% 编译方式:lualatex
|
||
%==============================================================================
|
||
|
||
\NeedsTeXFormat{LaTeX2e}
|
||
\ProvidesClass{cveoreport}[2025/12/29 Universal Technical Report Template]
|
||
|
||
%==============================================================================
|
||
% 基础文档类设置
|
||
%==============================================================================
|
||
\LoadClass[a4paper, UTF8, zihao=-4]{ctexart}
|
||
|
||
%==============================================================================
|
||
% 页面设置(A4,国标规范)
|
||
%==============================================================================
|
||
\RequirePackage[
|
||
top=2.5cm,
|
||
bottom=2.5cm,
|
||
left=3.0cm,
|
||
right=3.0cm,
|
||
headheight=15pt,
|
||
headsep=12pt,
|
||
footskip=12pt
|
||
]{geometry}
|
||
|
||
|
||
%==============================================================================
|
||
% 行距设置(1.5倍行距)
|
||
%==============================================================================
|
||
\RequirePackage{setspace}
|
||
\setstretch{1.5}
|
||
|
||
%==============================================================================
|
||
% 常用宏包
|
||
%==============================================================================
|
||
\RequirePackage{amsmath,amssymb}
|
||
\RequirePackage{xcolor}
|
||
\RequirePackage{graphicx}
|
||
\RequirePackage{pdflscape}
|
||
\RequirePackage{pifont}
|
||
\RequirePackage{booktabs}
|
||
\RequirePackage{array}
|
||
\RequirePackage{tabularx}
|
||
\RequirePackage{longtable}
|
||
\RequirePackage{xltabular}
|
||
\RequirePackage{hyperref}
|
||
\RequirePackage{bookmark}
|
||
\RequirePackage{setspace}
|
||
\RequirePackage{titletoc}
|
||
\RequirePackage[section]{placeins}
|
||
% \RequirePackage{subfigure} % 旧包,已过时,使用 subcaption 替代
|
||
\RequirePackage{subcaption} % 新包,支持子图标题和编号
|
||
\RequirePackage{tcolorbox} % 彩色盒子(用于重点框)
|
||
\RequirePackage{lastpage} % 获取总页数
|
||
\RequirePackage{tikz} % 绘图(用于封面背景)
|
||
\RequirePackage{etoolbox} % 条件控制(用于增强功能)
|
||
|
||
%==============================================================================
|
||
% 编号设置(国内政府文档规范)
|
||
%==============================================================================
|
||
\numberwithin{table}{section}
|
||
\numberwithin{figure}{section}
|
||
\counterwithin{equation}{section}
|
||
|
||
% 章节编号样式(政府文档规范)
|
||
\ctexset{
|
||
section = {
|
||
format = \zihao{-2} \bfseries \centering \vspace{0.5\baselineskip},
|
||
name = {},
|
||
number = \arabic{section}. ,
|
||
aftername = \hspace{0.5em},
|
||
beforeskip = 20pt plus 2pt minus 2pt,
|
||
afterskip = 15pt plus 2pt minus 2pt,
|
||
indent = 0pt
|
||
},
|
||
subsection = {
|
||
format = \zihao{4} \bfseries \raggedright \vspace{0.3\baselineskip},
|
||
name = {},
|
||
number = \arabic{section}.\arabic{subsection},
|
||
aftername = \hspace{0.3em},
|
||
beforeskip = 15pt plus 2pt minus 1pt,
|
||
afterskip = 10pt plus 1pt minus 1pt,
|
||
indent = 0pt
|
||
},
|
||
subsubsection = {
|
||
format = \zihao{-4} \bfseries \raggedright,
|
||
name = {},
|
||
number = \arabic{section}.\arabic{subsection}.\arabic{subsubsection},
|
||
aftername = \hspace{0.3em},
|
||
beforeskip = 10pt plus 1pt minus 0.5pt,
|
||
afterskip = 8pt plus 0.5pt minus 0.3pt,
|
||
indent = 0pt
|
||
},
|
||
paragraph = {
|
||
format = \zihao{-4} \bfseries \raggedright,
|
||
name = {},
|
||
number = {},
|
||
aftername = \hspace{0em},
|
||
beforeskip = 10pt plus 0.5pt,
|
||
afterskip = 12pt,
|
||
indent = 0pt
|
||
}
|
||
}
|
||
|
||
% 设置目录和编号深度
|
||
\ctexset{secnumdepth=4}
|
||
\ctexset{tocdepth=2}
|
||
|
||
%==============================================================================
|
||
% 每章新起一页
|
||
%==============================================================================
|
||
\let\oldsection\section
|
||
\renewcommand\section{\clearpage\oldsection}
|
||
|
||
%==============================================================================
|
||
% 中文标点符号优化
|
||
%==============================================================================
|
||
\RequirePackage{zhnumber}
|
||
|
||
%==============================================================================
|
||
% 目录设置
|
||
%==============================================================================
|
||
\titlecontents{section}[0pt]
|
||
{\zihao{-4}\bfseries\addvspace{2pt}\parindent=0pt}
|
||
{\contentslabel{2em}}
|
||
{}
|
||
{\hspace{2em}\leaders\hbox to 0.35em{\hss.}\hfill\contentspage}
|
||
[]
|
||
|
||
\titlecontents{subsection}[2em]
|
||
{\zihao{-4}\addvspace{1pt}\parindent=0pt}
|
||
{\contentslabel{2em}}
|
||
{}
|
||
{\hspace{2em}\leaders\hbox to 0.35em{\hss.}\hfill\contentspage}
|
||
[]
|
||
|
||
%==============================================================================
|
||
% 图表设置
|
||
%==============================================================================
|
||
% 图片路径
|
||
\graphicspath{{figures/}}
|
||
|
||
% 图片浮动环境默认设置
|
||
\makeatletter
|
||
\def\fps@figure{htbp}
|
||
\def\fps@table{htbp}
|
||
\makeatother
|
||
|
||
% 图表标题格式(简洁样式:图1-1、表1-1)
|
||
\RequirePackage{caption}
|
||
\DeclareCaptionLabelFormat{chinesefig}{图~#2}
|
||
\DeclareCaptionLabelFormat{chinesetable}{表~#2}
|
||
|
||
\captionsetup[figure]{
|
||
labelformat=chinesefig,
|
||
labelsep=quad,
|
||
justification=raggedright,
|
||
position=bottom,
|
||
aboveskip=8pt,
|
||
belowskip=8pt,
|
||
font=small
|
||
}
|
||
\captionsetup[table]{
|
||
labelformat=chinesetable,
|
||
labelsep=quad,
|
||
justification=centering,
|
||
position=top,
|
||
aboveskip=8pt,
|
||
belowskip=6pt,
|
||
font=small
|
||
}
|
||
|
||
% 子图标题设置(使用 subcaption 包)
|
||
\captionsetup[subfigure]{
|
||
labelformat=simple,
|
||
labelsep=space,
|
||
justification=centering,
|
||
font=small,
|
||
aboveskip=4pt,
|
||
belowskip=4pt
|
||
}
|
||
|
||
% 定义图片命令(使用相对宽度)
|
||
\newcommand{\figwidth}[2][0.85]{%
|
||
\includegraphics[width=#1\textwidth]{#2}%
|
||
}
|
||
|
||
%==============================================================================
|
||
% 重点信息框环境
|
||
%==============================================================================
|
||
\newenvironment{keypoint}{
|
||
\begin{tcolorbox}[colback=blue!10, colframe=blue!70, arc=3pt, boxrule=1pt]
|
||
关键要点:
|
||
\vspace{0.3\baselineskip}
|
||
}{
|
||
\end{tcolorbox}
|
||
}
|
||
|
||
\newenvironment{warningbox}{
|
||
\begin{tcolorbox}[colback=red!10, colframe=red!70, arc=3pt, boxrule=1pt]
|
||
注意事项:
|
||
\vspace{0.3\baselineskip}
|
||
}{
|
||
\end{tcolorbox}
|
||
}
|
||
|
||
\newenvironment{tipbox}{
|
||
\begin{tcolorbox}[colback=green!10, colframe=green!70, arc=3pt, boxrule=1pt]
|
||
提示:
|
||
\vspace{0.3\baselineskip}
|
||
}{
|
||
\end{tcolorbox}
|
||
}
|
||
|
||
%==============================================================================
|
||
% 表格设置(国标三线表和完整线框表)
|
||
%==============================================================================
|
||
% 三线表命令
|
||
\newcommand{\topline}{\toprule[1.2pt]}
|
||
\newcommand{\midline}{\midrule[0.6pt]}
|
||
\newcommand{\bottomline}{\bottomrule[1.2pt]}
|
||
|
||
% 完整线框表格命令
|
||
\newcommand{\fulltopline}{\hline}
|
||
\newcommand{\fullmidline}{\hline}
|
||
\newcommand{\fullbottomline}{\hline}
|
||
\newcommand{\fullcline}[2]{\cline{#1-#2}}
|
||
|
||
% 表格单元格对齐
|
||
\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
|
||
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}m{#1}}
|
||
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}m{#1}}
|
||
%\newcolumntype{X}[1]{>{\raggedright\arraybackslash}p{#1}} % X already defined by tabularx
|
||
|
||
%==============================================================================
|
||
% 列表环境设置(修复itemize序号0问题)
|
||
%==============================================================================
|
||
\RequirePackage{enumitem}
|
||
\setlist{
|
||
nosep,
|
||
labelsep=0.5em,
|
||
leftmargin=2\ccwd,
|
||
itemindent=0\ccwd,
|
||
partopsep=0pt,
|
||
parsep=0.5ex
|
||
}
|
||
\setlist[itemize,1]{label=\textbullet}
|
||
\setlist[itemize,2]{label=--}
|
||
\setlist[itemize,3]{label=$\circ$}
|
||
\setlist[enumerate,1]{label=\arabic*.}
|
||
\setlist[enumerate,2]{label=(\alph*)}
|
||
\setlist[enumerate,3]{label=\roman*.}
|
||
|
||
%==============================================================================
|
||
% 页眉页脚设置
|
||
%==============================================================================
|
||
\RequirePackage{fancyhdr}
|
||
\pagestyle{fancy}
|
||
|
||
\fancyhf{}
|
||
\fancyhead[C]{%
|
||
\zihao{-5}
|
||
\ptitle%
|
||
}
|
||
\fancyfoot[C]{%
|
||
\zihao{-5}
|
||
\thepage / \pageref{LastPage}
|
||
}
|
||
|
||
% 封面页和章节首页无页眉
|
||
\fancypagestyle{plain}{
|
||
\fancyhf{}
|
||
\fancyfoot[C]{\zihao{-5} \thepage / \pageref{LastPage}}
|
||
}
|
||
|
||
%==============================================================================
|
||
% 超链接设置
|
||
%==============================================================================
|
||
\hypersetup{
|
||
pdfborder={0 0 0},
|
||
colorlinks=false,
|
||
linkcolor=blue,
|
||
citecolor=blue,
|
||
urlcolor=blue,
|
||
filecolor=blue,
|
||
pdfcreator={LaTeX with lualatex - techreport.cls},
|
||
pdfproducer={LuaLaTeX}
|
||
}
|
||
|
||
%==============================================================================
|
||
% 断词设置
|
||
%==============================================================================
|
||
\RequirePackage{hyphenat}
|
||
|
||
%==============================================================================
|
||
% 常用命令定义
|
||
%==============================================================================
|
||
\providecommand{\strong}[1]{\textbf{#1}}
|
||
|
||
% 带圈数字
|
||
\newcommand{\circlenum}[1]{\textcircled{\scriptsize#1}}
|
||
|
||
% 定义域命令
|
||
\DeclareMathOperator{\dom}{dom}
|
||
|
||
%==============================================================================
|
||
% 封面信息命令(可在 main.tex 中自定义)
|
||
%==============================================================================
|
||
% 主标题(文档名称)
|
||
\newcommand{\ptitle}{}%
|
||
\newcommand{\psubtitle}{}%
|
||
\newcommand{\pauthor}{}%
|
||
\newcommand{\pdate}{}%
|
||
|
||
%==============================================================================
|
||
% 封面命令
|
||
%==============================================================================
|
||
\newcommand{\makecover}{
|
||
\begin{titlepage}
|
||
\thispagestyle{empty}
|
||
|
||
% 主标题
|
||
\vspace{2cm}
|
||
\begin{center}
|
||
\zihao{-1}
|
||
\ptitle%
|
||
\end{center}
|
||
|
||
\vspace{0.8cm}
|
||
|
||
% 副标题说明 - 放大突出
|
||
\begin{center}
|
||
\zihao{1}
|
||
\textbf{\psubtitle}
|
||
\end{center}
|
||
|
||
\vspace{12cm}
|
||
|
||
% 编制单位
|
||
\begin{center}
|
||
\zihao{3}
|
||
\pauthor
|
||
\end{center}
|
||
|
||
\vspace{1cm}
|
||
|
||
% 编制日期
|
||
\begin{center}
|
||
\zihao{3}
|
||
\pdate
|
||
\end{center}
|
||
|
||
% % 版本信息
|
||
% \begin{center}
|
||
% \zihao{5}
|
||
% (内部资料)
|
||
% \end{center}
|
||
|
||
% % 扉页(空白页)
|
||
% \clearpage
|
||
% \thispagestyle{empty}
|
||
% \mbox{}
|
||
\clearpage
|
||
\end{titlepage}
|
||
}
|
||
|
||
%==============================================================================
|
||
% 引用文件环境
|
||
%==============================================================================
|
||
\newenvironment{references}{
|
||
\section*{引用文件}
|
||
\addcontentsline{toc}{section}{引用文件}
|
||
\begin{compactlist}
|
||
}{
|
||
\end{compactlist}
|
||
}
|
||
|
||
%==============================================================================
|
||
% 紧凑列表
|
||
%==============================================================================
|
||
\newenvironment{compactlist}{
|
||
\begin{itemize}
|
||
\itemsep=0pt
|
||
\parsep=0.5ex
|
||
\topsep=0pt
|
||
\end{itemize}
|
||
}{
|
||
\end{itemize}
|
||
}
|
||
|
||
%==============================================================================
|
||
% 结束
|
||
%==============================================================================
|
||
\endinput
|