feat: 添加通用技术报告LaTeX模板及示例文档

添加完整的cveoreport文档类模板,包含:
- 符合国内政府文档规范的文档类定义
- 示例主文档、章节文件和编译脚本
- 多种中文字体文件支持
- 详细的README使用说明
- 特殊环境(重点框、警告框等)和表格样式
This commit is contained in:
陈关州 2026-02-03 22:09:36 +08:00
commit 776190628d
11 changed files with 830 additions and 0 deletions

99
Makefile Normal file
View File

@ -0,0 +1,99 @@
#==============================================================================
# LaTeX文档编译脚本
# 汕头市自然资源动态监测项目方案
#==============================================================================
.PHONY: all clean view
# 编译命令使用lualatex
LATEX = lualatex
LATEX_OPTS = -interaction=nonstopmode -file-line-error
# 主文档名
TARGET = main
# 默认目标强制重新编译PDF
all:
@if [ -f $(TARGET).pdf ]; then \
echo "=== 删除旧PDF强制重新编译 ==="; \
rm -f $(TARGET).pdf; \
fi
@echo "=== 第一次编译 ==="
$(LATEX) $(LATEX_OPTS) $(TARGET).tex || true
@echo ""
@echo "=== 第二次编译(生成目录和引用)==="
$(LATEX) $(LATEX_OPTS) $(TARGET).tex || true
@if [ -f $(TARGET).pdf ]; then \
echo ""; \
echo "编译完成!生成文件:$(TARGET).pdf"; \
ls -lh $(TARGET).pdf; \
else \
echo "编译失败,请检查错误信息"; \
exit 1; \
fi
# 生成PDF
$(TARGET).pdf: $(TARGET).tex techreport.cls
@if [ -f $(TARGET).pdf ]; then \
echo "=== 已有旧版PDF删除重新编译 ==="; \
rm -f $(TARGET).pdf; \
fi
@echo "=== 第一次编译xelatex==="
$(LATEX) $(LATEX_OPTS) $(TARGET).tex || true
@echo ""
@echo "=== 第二次编译(生成目录和引用)==="
$(LATEX) $(LATEX_OPTS) $(TARGET).tex || true
@if [ -f $(TARGET).pdf ]; then \
echo ""; \
echo "编译完成!生成文件:$(TARGET).pdf"; \
ls -lh $(TARGET).pdf; \
else \
echo "编译失败,请检查错误信息"; \
exit 1; \
fi
# 快速编译draft模式
draft:
$(LATEX) --draftmode $(LATEX_OPTS) $(TARGET).tex
# 清理辅助文件
clean:
@echo "清理辅助文件..."
rm -f $(TARGET).aux $(TARGET).log $(TARGET).out
rm -f $(TARGET).toc $(TARGET).lof $(TARGET).lot
rm -f $(TARGET).bbl $(TARGET).blg $(TARGET).synctex.gz
rm -f $(TARGET).fdb_latexmk $(TARGET).fls
rm -f missfont.log
@echo "清理完成!"
# 预览PDF
view: $(TARGET).pdf
@if command -v xdg-open > /dev/null 2>&1; then \
xdg-open $(TARGET).pdf; \
elif command -v open > /dev/null 2>&1; then \
open $(TARGET).pdf; \
else \
echo "请手动打开 $(TARGET).pdf"; \
fi
# 查看辅助文件大小
size:
@echo "辅助文件大小:"
@ls -lh $(TARGET).aux $(TARGET).log $(TARGET).out $(TARGET).toc 2>/dev/null || echo "无辅助文件或文件不存在"
# 帮助信息
help:
@echo "LaTeX文档编译脚本 - 汕头市自然资源动态监测项目方案"
@echo ""
@echo "可用命令:"
@echo " make - 完整编译PDF推荐"
@echo " make draft - 快速编译不生成最终PDF"
@echo " make clean - 清理辅助文件"
@echo " make view - 编译并预览PDF"
@echo " make help - 显示此帮助信息"
@echo ""
@echo "编译说明:"
@echo " - 使用xelatex编译"
@echo " - 需要运行两次以正确生成目录和引用"
@echo " - 字体使用fonts文件夹中的本地字体simsun.ttc, TimesNewRoman.ttf等"

169
README.md Normal file
View File

@ -0,0 +1,169 @@
# cveoreport - 通用技术报告 LaTeX 模板
## 简介
cveoreport 是一个基于 LaTeX 的通用技术报告/方案文档模板,遵循国内政府文档规范,支持中英文混排,适用于技术方案、项目申报书、研究报告等各类文档。
## 文件结构
```
cveoreport/
├── cveoreport.cls # 文档类文件(模板核心)
├── cveoreport.tex # 主入口文件(示例)
├── README.md # 使用说明
├── fonts/ # 字体文件目录
│ ├── simkai.ttf # 楷体
│ ├── simsun.ttc # 宋体
│ ├── HYKaiTiJ.ttf # 汉仪楷体
│ ├── TimesNewRoman.ttf # 英文衬线字体
│ └── Wingdings.ttf # 符号字体
├── sections/ # 章节内容目录
│ └── 示例章节.tex # 示例章节文件
└── figures/ # 图片资源目录
└── (请放置您的图片文件)
```
## 快速开始
### 1. 准备环境
确保系统已安装以下软件:
- TeX Live 或 MiKTeX
- lualatex 编译器
- 建议使用 VSCode + LaTeX Workshop 扩展
### 2. 创建项目
```bash
# 复制模板目录
cp -r cveoreport your_project_name
cd your_project_name
```
### 3. 配置项目信息
编辑 `your_project_name.tex` 文件,修改项目配置:
```latex
% 封面信息定义
\renewcommand{\ptitle}{您的项目标题}
\renewcommand{\psubtitle}{项目副标题}
\renewcommand{\pauthor}{编制单位名称}
\renewcommand{\pdate}{2026年1月}
% PDF 元数据
\hypersetup{
pdftitle={项目标题},
pdfsubject={文档类型},
pdfkeywords={关键词1, 关键词2}
}
```
### 4. 添加章节内容
`sections/` 目录下创建章节文件,然后在主文件中引用:
```latex
\input{sections/概述}
\input{sections/技术方案}
\input{sections/实施计划}
```
### 5. 编译文档
```bash
# 方法1使用 lualatex推荐
lualatex -interaction=nonstopmode your_project_name.tex
lualatex -interaction=nonstopmode your_project_name.tex # 运行两次更新目录
# 方法2使用 Make如果有 Makefile
make
# 方法3使用 VSCode
# 选择编译配方 "lualatex ×2"
```
## 模板特性
### 封面定制
模板提供了 `\makecover` 命令,自动生成标准格式封面,包含:
- 主标题
- 副标题说明
- 编制单位
- 编制日期
### 图表支持
- 支持 `.png`, `.jpg`, `.pdf` 等格式图片
- 提供 `\figwidth[比例]{文件名}` 命令插入图片
- 支持子图subfigure
- 支持长表格longtable
### 特殊环境
| 环境 | 用途 | 样式 |
|------|------|------|
| `keypoint` | 关键要点 | 蓝色边框 |
| `warningbox` | 注意事项 | 红色边框 |
| `tipbox` | 提示信息 | 绿色边框 |
| `references` | 引用文件 | 无编号列表 |
### 表格样式
提供三线表命令:
- `\topline` - 表格顶线
- `\midline` - 表格中线
- `\bottomline` - 表格底线
## 自定义修改
### 修改页面边距
在主文件导言区添加:
```latex
\RequirePackage[top=2.5cm,bottom=2.5cm,left=3.0cm,right=3.0cm]{geometry}
```
### 修改章节样式
在主文件导言区添加:
```latex
\ctexset{section={format=\zihao{-2}\bfseries\centering}}
```
### 添加自定义命令
```latex
\newcommand{\yourcommand}[1]{%
% 您的命令定义
}
```
## 常见问题
### Q: 编译报错 "File not found"
A: 请确保所有图片路径正确,使用相对路径,如 `figures/image.png`
### Q: 中文字体显示为方块
A: 确认系统已安装中文字体,或在 fonts/ 目录放置字体文件
### Q: 如何调整行距
A: 在导言区添加 `\setstretch{1.5}`1.5倍行距)
### Q: 如何添加页眉页脚
A: 模板已预设页眉为项目标题,如需自定义请修改 cls 文件
## 参考资料
- [LaTeX 官方文档](https://www.latex-project.org/)
- [ctex 宏包文档](https://ctan.org/pkg/ctex)
- [hyperref 宏包文档](https://ctan.org/pkg/hyperref)
## 许可证
本模板基于 MIT 许可证开源,欢迎自由使用和修改。
## 作者
模板由 cveoreport 开发维护。
---
如有问题或建议,欢迎提交 Issue 或 Pull Request。

398
cveoreport.cls Normal file
View File

@ -0,0 +1,398 @@
%==============================================================================
% 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-11-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
%==============================================================================
% itemize0
%==============================================================================
\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

BIN
fonts/HYKaiTiJ.ttf Normal file

Binary file not shown.

BIN
fonts/TimesNewRoman.ttf Normal file

Binary file not shown.

BIN
fonts/Wingdings.ttf Normal file

Binary file not shown.

BIN
fonts/simkai.ttf Normal file

Binary file not shown.

BIN
fonts/simsun.ttc Normal file

Binary file not shown.

BIN
main.pdf Normal file

Binary file not shown.

54
main.tex Normal file
View File

@ -0,0 +1,54 @@
%==============================================================================
% cveoreport.tex - 通用技术报告 LaTeX 模板示例
%==============================================================================
% 这是一个使用 cveoreport.cls 模板的标准示例文件
%
% 使用方法:
% 1. 将本文件重命名为 your_project_name.tex
% 2. 修改下方的项目配置信息
% 3. 在 sections/ 目录下创建您的章节文件
% 4. 运行 lualatex 编译
%
% 编译方式:
% lualatex -interaction=nonstopmode your_project_name.tex
% lualatex -interaction=nonstopmode your_project_name.tex % 运行两次以更新目录
%
%==============================================================================
\documentclass{cveoreport}
%==============================================================================
% 项目特定配置(请在此处修改您的项目信息)
%==============================================================================
% 封面信息定义
\renewcommand{\ptitle}{项目标题}
\renewcommand{\psubtitle}{项目副标题说明}
\renewcommand{\pauthor}{编制单位名称}
\renewcommand{\pdate}{2026年1月}
% PDF 元数据覆盖
\hypersetup{
pdftitle={项目标题},
pdfsubject={文档类型},
pdfkeywords={关键词1, 关键词2, 关键词3}
}
\begin{document}
%==============================================================================
% 封面页
%==============================================================================
\makecover
%==============================================================================
% 目录
%==============================================================================
\tableofcontents
%==============================================================================
% 示例章节
%==============================================================================
\input{sections/section1}
\end{document}

110
sections/section1.tex Normal file
View File

@ -0,0 +1,110 @@
%==============================================================================
% 示例章节文件
%==============================================================================
% 将此文件复制到 sections/ 目录下,根据需要修改文件名和内容
% 在主文件中使用 \input{sections/section1} 引用
%==============================================================================
%==============================================================================
% 第一章 引言
%==============================================================================
\section{引言}
\subsection{背景与目的}
本模板旨在提供一个通用的技术报告/方案文档格式,适用于政府、企业、院校等各类组织的文档编制需求。
\subsection{适用范围}
本模板适用于:
\begin{itemize}
\item 技术方案设计文档
\item 项目申报书
\item 研究报告
\item 各类技术文档
\end{itemize}
\subsection{术语定义}
\begin{description}
\item[模板] 预先设计好的文档格式框架
\item[编译] 将 LaTeX 源文件转换为 PDF 的过程
\item[文档类] 定义 LaTeX 文档基本格式的文件
\end{description}
%==============================================================================
% 第二章 文档结构
%==============================================================================
\section{文档结构说明}
\subsection{文件结构}
标准的文档目录结构如下:
\begin{center}
\begin{tabular}{|l|l|}
\hline
文件/目录 & 说明 \\ \hline
your\_doc.tex & 主入口文件 \\ \hline
cveoreport.cls & 文档类文件 \\ \hline
sections/ & 章节内容目录 \\ \hline
figures/ & 图片资源目录 \\ \hline
fonts/ & 字体文件目录 \\ \hline
\end{tabular}
\end{center}
\subsection{常用命令}
本模板提供了以下常用命令:
\begin{keypoint}
\textbf{图片引用}:使用 \texttt{\textbackslash figwidth[比例]\{文件名\}} 命令插入图片
\textbf{重点提示}:使用 \texttt{keypoint} 环境标注关键信息
\end{keypoint}
%==============================================================================
% 第三章 格式示例
%==============================================================================
\section{格式示例}
\subsection{警告框}
\begin{warningbox}
以下是一个重要的注意事项,请仔细阅读。
\end{warningbox}
\subsection{提示框}
\begin{tipbox}
这是一个有用的提示信息。
\end{tipbox}
\subsection{列表格式}
\begin{enumerate}
\item 第一步:准备素材
\begin{enumerate}
\item 收集相关资料
\item 整理数据
\item 绘制图表
\end{enumerate}
\item 第二步:撰写内容
\item 第三步:审核校对
\end{enumerate}
\subsection{数学公式}
\begin{equation}
E = mc^2
\label{eq:emc2}
\end{equation}
公式\eqref{eq:emc2} 是著名的质能等价方程。
%==============================================================================
% 结论
%==============================================================================
\section{结论}
本模板提供了标准的文档格式框架,使用者可根据实际需求进行调整和扩展。
%==============================================================================
% 附录
%==============================================================================
\section{附录}
\subsection{编译说明}
本模板使用 lualatex 编译,确保系统已安装必要的 LaTeX 宏包。
\subsection{字体配置}
如果需要使用自定义字体,请将字体文件放在 fonts/ 目录下,并在文档类配置中进行设置。