Files
ouc-report-latex-template/report.tex
T
2022-05-14 13:01:53 +08:00

341 lines
11 KiB
TeX

%!TEX program = xelatex
\documentclass{report}
\usepackage{graphicx}
\usepackage[dvipsnames]{xcolor}
\usepackage{wrapfig}
\usepackage{enumerate}
\usepackage{amsmath,mathrsfs,amsfonts}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{colortbl}
\usepackage{multirow,makecell}
\usepackage{multicol}
\usepackage{ulem} % \uline
\usepackage{listings}
\usepackage{tikz}
\usepackage{tcolorbox}
\usepackage{fontawesome}
\usepackage[justification=centering]{caption}
\usepackage{draftwatermark}% 所有页加水印
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% title and author
%% 标题和作者
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title{\bfseries\sffamily
这是一个Latex模板\\
\normalfont\zihao{-3}
Subtitle Here
}
%%作者这里,可以加入自己的网站,图标,可以使用fontawesome
\author{作者名字 \\ \faGithubAlt~ https://github.com/}
%%可以加入日期
\date{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% head and foot
%% 页眉页脚
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{fancyhdr}
\RequirePackage{zhnumber}
\RequirePackage{lastpage}
\pagestyle{fancy}
\fancyhf{}
\renewcommand\headrulewidth{.5pt}
\renewcommand\footrulewidth{0pt}
%\futurelet\TMPheadrule\def\headrule{{\color{violet}\TMPheadrule}}
%\renewcommand{\sectionmark}[1]{\markright{#1}}
\fancyhead[C]{\fzkai{这是一个Latex模板}}
%\fancyhead[C]{\@title}
%\fancyhead[R]{\thepage}
%\fancyfoot[L]{\fzkai{\@author}}
\fancyfoot[C]{\thepage / \pageref{LastPage}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 设置页面水印
% \usepackage[firstpage]{draftwatermark} % 只有第一页加水印
\SetWatermarkText{中国海洋大学计算机科学与技术学院} % 设置水印文字内容
% \SetWatermarkText{\includegraphics{fig/ZJDX-WaterMark.eps}} % 设置水印LOGO
\SetWatermarkLightness{0.95} % 设置水印透明度 0-1
\SetWatermarkScale{0.2} % 设置水印大小 0-1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 正文开始
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\sloppy % 解决中英文混排文字超出边界问题
%首页封面开始
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 封面页面开始
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{titlepage}
\centering % 居中显示
\scshape %
\vspace*{\baselineskip} % 顶部空白
%------------------------------------------------
% 标题
%------------------------------------------------
\rule{\textwidth}{1.6pt}\vspace*{-\baselineskip}\vspace*{2pt} % 上面粗的线
\rule{\textwidth}{0.4pt} % 细线
\vspace{0.75\baselineskip} % 和标题之间的空白
{\hm\bfseries \zihao{2} 这是一个\\ 很好用的Latex模板\\} % 标题
\vspace{0.75\baselineskip} % 标题下面的空白
\rule{\textwidth}{0.4pt}\vspace*{-\baselineskip}\vspace{3.2pt} % 细线
\rule{\textwidth}{1.6pt} % 粗线
\vspace{2\baselineskip} % 标题后的空白
%------------------------------------------------
% 副标题
%------------------------------------------------
{\hm \zihao{3} 这里是副标题} % 副标题
\vspace*{3\baselineskip} % 空白
%------------------------------------------------
% 作者信息
%------------------------------------------------
作者
\vspace{0.5\baselineskip} % 作者前空白
{\scshape\Large 作者名字 } % 作者列表
\vspace{0.5\baselineskip} % 空白
\fzkai{一级单位 \\ 二级单位 \\ 三级单位} % 作者单位
\vfill % 空白
%------------------------------------------------
% 出版社或单位
%------------------------------------------------
%\plogo % Publisher logo
\vspace{0.3\baselineskip} % 空白
%2017 % Publication year
{\large 2022年3月} % 日期
\end{titlepage}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 封面页面结束
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 正文开始
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\maketitle
\thispagestyle{empty}
\begin{abstract}
这是一个很好用的Latex模板,经过不断的修改和迭代进化。这里,就介绍一下这个模板的使用方法,希望对你有所帮助。
\vspace{2ex}
\textbf{关键字:}Latex,\hspace{.5em}模板,\hspace{.5em}学习
\end{abstract}
\section{准备工作}
在正式开始使用模板之前,需要你安装LiveTex,并安装任何可用的编辑器。
不需要再做其他配置,字体在font文件夹中,编译时会自动调用,无须额外安装。
\section{字体}
在模板中,默认使用的字体是鸿蒙字体,除此之外,还定义了一些其他的中文字体。
英文字体,默认使用的是鸿蒙字体(HarmonyOS Sans),现在你看到的应该就是这个字体的效果。这些设置,可以在cls中,字体设定里面进行修改。
中文字体,使用的是鸿蒙字体、方正小标宋、方正楷体、方正仿宋、方正中等线等。
中文的默认字体衬线字体是方正书宋,加粗字体是方正小标宋,就像这样:\textbf{这里是加粗字体}。斜体的字体是方正楷体,就像这样:\textit{这里是中文斜体}。斜体粗体的字体是方正仿宋,就像这样:\textbf{\textit{这里是粗体斜体}}。中文的无衬线字体sans font使用的是方正黑体,你应该可以在标题中看到它。中文等宽字体,使用的是方正中等线字体。
默认的无衬线字体是鸿蒙字体,你应该可以在各种标题中看到它的样子。
同样,上述的字体,在cls中,都可以进行设置。
另外,可以使用额外的命令,来临时改变某一段文字的字体设置,这些命令包括:fzss(方正书宋)、 fzxbs(方正小标宋)、、fzkai(方正楷体)、fzfs(方正仿宋)、fzzdx(方正中等线)、hm(鸿蒙字体)。使用方法是使用斜线命令的方式,这样:{\fzss 方正书宋}{\fzxbs 方正小标宋}{\fzkai 方正楷体}{\fzfs 方正仿宋}{\fzzdx 方正中等线}{\hm 鸿蒙字体}
\section{标题}
文档模板支持三级标题,并且自动编号。上面就是一级标题的样子。
\subsection{这里是二级标题}
\subsubsection{这里是三级标题}
\section{列表}
列表分为有序列表和无序列表。
\subsection{无序列表}
无序列表使用itemize。
\begin{itemize}
\item \textbf{第一个有序列表}。可以在这里写列表的内容。
\item \textbf{第二条列表}。这里继续显示列表内容。
\end{itemize}
默认的前缀是实心的 黑色原点, 但是我们可以在 \textbackslash item[] 中进行自定义符号, 一般来说, 想要的符号都能够进行显示。
\begin{itemize}
\item[-] 条目1
\item[+] 条目2
\item[x] 条目3
\item[/] 条目4
\item[*] 条目5
\item[a] 条目6
\item[$\circ$] 条目7
\item[$\bigotimes$] 条目8
\item .....
\end{itemize}
\subsection{有序列表}
有序列表使用enumerate。
\begin{enumerate}
\item 方括号中写的是列表的样式。可以是()、[]等。如果要改变编号样式,可使用begin\{enumerate\}[(1)]等。
\item 如果使用了特殊的样式导致没有了缩进,可以使用begin\{enumerate\}[itemindent=2em]设置缩进。
\end{enumerate}
\section{图表信息}
可以插入表格,如表\ref{table1}所示\footnote{更复杂的表格,可以使用在线工具生成 https://www.tablesgenerator.com/}
\noindent
\begin{table}[h!]
\caption{一个表格的实例}\label{table1}
\begin{tabularx}{\textwidth}{>{\hsize=.6\hsize\raggedright\arraybackslash}X>{\raggedright\arraybackslash}X}\toprule
\bfseries{食物} & \bfseries{菜谱}\\ \midrule
热狗 & 面包、香肠 \\
包子 & 面粉、馅料 \\ \bottomrule
\end{tabularx}
\end{table}
可以插入图片,如图\ref{fig1}所示。
\begin{figure}[!h]
\centering
\includegraphics[width=12cm]{figs/1.jpg}
\caption{这是一个示例图片}
\label{fig1}
\end{figure}
在其他的地方,通过输入图片的label来引用图片,就像这样:如图\ref{fig1}所示。
\section{代码}
模板中支持插入代码片段。
就像下面这些例子一样:
\begin{lstlisting}[language=TypeScript,caption={src/app/app.module.ts}]
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
@NgModule({
imports: [ BrowserModule ],
providers: [ Logger ],
declarations: [ AppComponent ],
exports: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
\end{lstlisting}
\begin{lstlisting}[language=Java,caption={src/app/app.module.ts}]
import org.sun.com;
public class helloworld{
public static void main()
{
System.out.println("hello world!");
}
}
\end{lstlisting}
\begin{lstlisting}[style=bashstyle]
cd my-app
ng serve --open
\end{lstlisting}
\begin{lstlisting}[style=bashoutputstyle]
blablabla
\end{lstlisting}
还可以展示linux shell命令:
\begin{invertedshellbox}
npm install -g @angular/cli
\end{invertedshellbox}
也可以使用shell box。
\begin{shellbox}
cd my-app
ng serve --open
\end{shellbox}
还可以展示shell执行结果:
\begin{lstlisting}[style=bashoutputstyle]
src
app
app.component.css
app.component.html
app.component.spec.ts
app.component.ts
app.module.ts
assets
.gitkeep
environments
environment.prod.ts
environment.ts
browserslist
favicon.ico
index.html
...
\end{lstlisting}
\section{文本框}
模板支持三中文本框,分别是titledbox、notebox和importantbox。
\begin{titledbox}{HTTP/Console 内核}
HTTP 内核继承自 \verb|Illuminate\Foundation\Http\Kernel| 类,该类定义了一个 \verb|bootstrappers| 数组,这个数组中的类在请求被执行前运行,这些 \verb|bootstrappers| 配置了错误处理、日志、检测应用环境以及其它在请求被处理前需要执行的任务。
\end{titledbox}
\begin{notebox}
HTTP 内核继承自 \verb|Illuminate\Foundation\Http\Kernel| 类,该类定义了一个 \verb|bootstrappers| 数组,这个数组中的类在请求被执行前运行,这些 \verb|bootstrappers| 配置了错误处理、日志、检测应用环境以及其它在请求被处理前需要执行的任务。
\end{notebox}
\begin{importantbox}
HTTP 内核继承自 \verb|Illuminate\Foundation\Http\Kernel| 类,该类定义了一个 \verb|bootstrappers| 数组,这个数组中的类在请求被执行前运行,这些 \verb|bootstrappers| 配置了错误处理、日志、检测应用环境以及其它在请求被处理前需要执行的任务。
\end{importantbox}
\section{图标}
模板还支持使用图标,图标主要来自于fontawesome。其使用说明,可以参考文件夹中的fontawesome.pdf。
\faHeart
\end{document}