Skip to content

Instantly share code, notes, and snippets.

@tanzby
Created November 24, 2020 10:24
Show Gist options
  • Save tanzby/9586d427a53092310bd0d3ba75badc2e to your computer and use it in GitHub Desktop.
Save tanzby/9586d427a53092310bd0d3ba75badc2e to your computer and use it in GitHub Desktop.
Latex Document Class for Writing a Tech Report
\ProvidesClass{techrep}[Latex class for Tech Report]
\NeedsTeXFormat{LaTeX2e}
\LoadClass[10pt, a4paper, UTF8]{ctexart}
\usepackage[
top=2cm,
bottom=2cm,
left=2cm,
right=2cm
]{geometry}
\ctexset
{
section = {
nameformat = {\zihao{-3}\heiti},
format += \zihao{-3} \heiti \raggedright, % \zihao{3}为三号
},
subsection = {
nameformat = {\zihao{4}\heiti},
format += \zihao{4} \heiti, % \zihao{-4}为小四号
},
subsubsection = {
nameformat = {\zihao{-4}\heiti},
format += \zihao{-4} \heiti, % \zihao{-4}为小四号
}
}
\RequirePackage{fontspec}
\setmainfont{Times New Roman}
\RequirePackage{bm}
\RequirePackage{fancyhdr} % 页面样式
\RequirePackage{graphicx} % 插入图片
\RequirePackage{algorithm} % 算法插入
\RequirePackage{algpseudocode} % 算法插入
\RequirePackage{amsmath} % 数学公式
\RequirePackage{hyperref} % 超链接生成
\RequirePackage{tabularx} % 表格
\RequirePackage{xcolor}
\RequirePackage[cache=false]{minted} % 代码
\RequirePackage{tikz} % 绘图
\usetikzlibrary{arrows.meta, calc, positioning, graphs, arrows,shapes.geometric}
\makeatletter
\renewcommand\maketitle
{
\begin{center}
\fangsong \Huge {\@title} \\
\vspace*{0.5cm}
\songti \large
\@author \\
\today
\end{center}
}
\makeatother
\pagestyle{fancy}
\fancypagestyle{main}{
\fancyhf{}
\fancyhead{}
\fancyfoot{}
\fancyfoot[C]{\thepage \bfseries}
\renewcommand\headrulewidth{0pt}
\renewcommand\footrulewidth{0pt}
}
\appto\mainmatter{\pagestyle{main}}
\mainmatter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment