Skip to content

Commit

Permalink
初始化
Browse files Browse the repository at this point in the history
  • Loading branch information
tansongchen committed Jan 10, 2021
0 parents commit f7cbaf0
Show file tree
Hide file tree
Showing 6 changed files with 854 additions and 0 deletions.
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# `pkupcl` 文档类

本文档类用于北京大学物理化学实验课程的实验报告,以 GPLv3 协议发布。

本文档类需要用 `xelatex` 引擎编译。对于不含参考文献的文章,用 `xelatex` 编译两次即可。

本文档类依赖于 `geometry``graphicx``booktabs``titlesec``mhchem``enumitem``siunitx``fancyhdr` 宏包,依赖于 `SimSun`(宋体)、`SimHei`(黑体)、`FangSong`(仿宋)、`Times New Roman``Arial``Monaco` 字体,请在编译前安装。

使用方法详见 `example.tex`
Binary file added example.pdf
Binary file not shown.
71 changes: 71 additions & 0 deletions example.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
\documentclass{pkupcl}
\title{某物理量的测定}
\author{张三}
\id{1800000000}
\group{第1组1号}
\date{2020 年 1 月 1 日}
\temperature{20.0}
\pressure{100.0}
\abstract{本实验测定了某物理量。}
\keyword{甲\quad\quad\quad 丁}
\begin{document}
\makecover
\section{引言}

一些引言。

\section{方法}

\subsection{仪器和试剂}

\subsubsection{试剂}

\ce{H2O}。

\subsubsection{仪器}

\subsection{实验内容}

\begin{enumerate}
\item ……;
\item ……。
\end{enumerate}

\section{结果与讨论}

\subsection{主要结果 1 及其讨论}

数据如表 1 所示。

\begin{table}[!ht]
\centering
\caption{表格}
\begin{tabular}{cc}
\toprule
表头 A & 表头 B \\ \midrule
1 & 2 \\
3 & 4 \\ \bottomrule
\end{tabular}
\end{table}

\subsection{主要结果 2 及其讨论}

图片如图 1 所示。

\begin{figure}[!ht]
\begin{center}
\includegraphics[width=0.7\textwidth]{logo.png}
\caption{图片}
\end{center}
\end{figure}

\section{实验结论}

\section*{参考文献}

\begin{enumerate}[label={[\arabic*]}]
\item 北京大学化学学院物理化学实验教研组,物理化学实验(第4版),北京大学出版社,2002.
\item 松鼠,Chem \& Coding | 用LaTeX完成物化实验报告(2) 封面的制作,知乎,2017.
\end{enumerate}

\end{document}
Binary file added logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
100 changes: 100 additions & 0 deletions pkupcl.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
\ProvidesClass{pkupcl}

% 加粗图注、表注的序号
\LoadClass[zihao=-4]{ctexart}
\ctexset{
figurename=\textbf{},
tablename=\textbf{}
}

% 宏包
\RequirePackage[hmargin=3cm,vmargin=4cm]{geometry}
\RequirePackage{graphicx}
\RequirePackage{booktabs}
\RequirePackage{titlesec}
\RequirePackage[version=4]{mhchem}
\RequirePackage{enumitem}

% 带单位的物理量
\RequirePackage{siunitx}
\sisetup{detect-family}

% 页眉页脚
\RequirePackage{fancyhdr}
\pagestyle{fancy}
\lhead{\sffamily \footnotesize 物理化学实验}
\chead{\sffamily \footnotesize \@title}
\rhead{}
\lfoot{}
\cfoot{}
\rfoot{}

% 字体
\setmainfont{Times New Roman}
\setsansfont{Arial}
\setmonofont{Monaco}
\setCJKmainfont[AutoFakeBold=3]{SimSun}
\setCJKsansfont[AutoFakeBold=3]{SimHei}
\setCJKmonofont[AutoFakeBold=3]{FangSong}

% 各级标题样式
\titleformat{\section}[block]{\bfseries\sffamily}{\textsf{\arabic{section}}}{1em}{}[]
\titleformat{\subsection}[block]{\bfseries}{\textsf{\arabic{section}.\arabic{subsection}}}{1em}{}[]
\titleformat{\subsubsection}[block]{\ttfamily}{\textsf{\arabic{section}.\arabic{subsection}.\alph{subsubsection}}}{1em}{}[]

% 文档元信息
\newcommand{\id}[1]{\def\@id{#1}}
\newcommand{\group}[1]{\def\@group{#1}}
\newcommand{\temperature}[1]{\def\@temperature{#1}}
\newcommand{\pressure}[1]{\def\@pressure{#1}}
\renewcommand{\abstract}[1]{\def\@abstract{#1}}
\newcommand{\keyword}[1]{\def\@keyword{#1}}

% 制作封面
\newcommand{\makecover}{
\begin{figure}[!ht]
\centering
\includegraphics[width=0.7\linewidth]{logo}
\end{figure}

\begin{center}
\sffamily
\zihao{-0} 物理化学实验报告
\end{center}

\vspace*{1cm}

\begin{table}[!ht]
\sffamily
\centering
\begin{huge}
\begin{tabular}{p{4cm} p{8cm}<{\centering}}
题目: & \@title \\ \cline{2-2}
\end{tabular}
\end{huge}
\end{table}

\vspace*{0.5cm}

\begin{table}[!ht]
\sffamily
\centering
\begin{large}
\begin{tabular}{p{3cm} p{7cm}<{\centering}}
\qquad 名: & \@author \\ \cline{2-2}
\qquad 号: & \@id \\ \cline{2-2}
\qquad 别: & \@group \\ \cline{2-2}
\qquad 期: & \@date \\ \cline{2-2}
\qquad 温: & \SI{\@temperature}{^\circ C} \\ \cline{2-2}
\qquad 压: & \SI{\@pressure}{kPa} \\ \cline{2-2}
\end{tabular}
\end{large}
\end{table}

\rule{\textwidth}{0.3pt}

\paragraph*{摘要} \@abstract
\paragraph*{关键词} \@keyword

\newpage
}

0 comments on commit f7cbaf0

Please sign in to comment.