第一个cls文件

可以算完成了我的一个夙愿吧。之前一直很想研究一下cls和sty文件的书写,现在终于有机会了。美赛过了以后,发现自己确实在数据处理和可视化方面一点经验也无。

队友都不会latex,最后还是用word排版了,hh。我思考了很久,还是遵从团队的决定吧!

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{ssirep}[done by Wang Erhe]
\LoadClass[UTF8]{ctexart}
\RequirePackage{ctex}%需要中文
\RequirePackage{geometry}%页边距调整
\RequirePackage{setspace}%行距调整
\RequirePackage{graphicx}%图片支持
\RequirePackage{xcolor} %代码着色
\RequirePackage{listings}%代码支持
\RequirePackage{float}%图片强制放置
\RequirePackage{underscore}%下划线支持
\RequirePackage{titlesec}%段标题格式修改
\RequirePackage{fontspec}
\geometry{%
	a4paper,%
	left=3.18cm,%
	right=3.18cm,%
	top=2.54cm,%
	bottom=2.54cm%
}%页边距调整

\newcommand{\@course}{}
\renewcommand{\@author}{}
\newcommand{\@inst}{}
\newcommand{\@major}{}
\newcommand{\@number}{}
\newcommand{\@tutor}{}
\newcommand{\@labtype}{}
\newcommand{\@labname}{}
\newcommand{\@teammate}{}
\newcommand{\@labplace}{}
\newcommand{\@year}{}
\newcommand{\@mounth}{}
\newcommand{\@day}{}

\newcommand{\info}[6]{
	\renewcommand{\@course}{#1}
	\renewcommand{\@author}{#2}
	\renewcommand{\@inst  }{#3}
	\renewcommand{\@major }{#4}
	\renewcommand{\@number}{#5}
	\renewcommand{\@tutor }{#6}
}

\newcommand{\labinfo}[7]{
	\renewcommand{\@labtype }{#1}
	\renewcommand{\@labname }{#2}
	\renewcommand{\@teammate}{#3}
	\renewcommand{\@labplace}{#4}
	\renewcommand{\@year }{#5}
	\renewcommand{\@mounth }{#6}
	\renewcommand{\@day }{#7}
}

\renewcommand{\thesection}{\chinese{section}}
\titleformat{\section}{\Large}{\thesection\,、}{1ex}{}

\newcommand{\cover}[1]{
	\newgeometry{top=5.18cm}
	\thispagestyle{empty}
	\begin{center}
		\begin{figure}
			\centering
			\includegraphics[scale=0.4]{#1}
		\end{figure}
		\vspace{3ex}
		\textbf{\Large 本科实验报告}\\
		\vspace{10ex}
		\Large
		课程名称:\underline{\hbox to 5cm{\hfill \@course\hfill}}\\
		\vspace{3ex}
		姓\qquad 名:\underline{\hbox to 5cm{\hfill \@author\hfill}}\\
		\vspace{3ex}
		学\qquad 院:\underline{\hbox to 5cm{\hfill \@inst  \hfill}}\\
		\vspace{3ex}
		专\qquad 业:\underline{\hbox to 5cm{\hfill \@major  \hfill}}\\
		\vspace{3ex}
		学\qquad 号:\underline{\hbox to 5cm{\hfill \@number \hfill}}\\
		\vspace{3ex}
		指导教师:\underline{\hbox to 5cm{\hfill \@tutor   \hfill}}\\
		\vspace{10ex}
		\@year 年\@mounth 月 \@day 日
	\end{center}
	\restoregeometry
	\clearpage
}

\newcommand{\secpage}{
	\begin{center}
		\textbf{\Large 浙江大学实验报告}
	\end{center}
	\parbox{\linewidth}{
		\begin{spacing}{2}
			课程名称: \underline{\hbox to 5cm{\hfill \@course \hfill}}\qquad 
			实验类型: \underline{\hbox to 5cm{\hfill \@labtype\hfill}}
			
			实验项目名称:\underline{\hbox to 10cm{\hfill \@labname  \hfill}}
			
			学生姓名:\underline{\hbox to 3.3cm{\hfill\@author \hfill}}
			专业:\underline{\hbox to 3.6cm{\hfill \@major  \hfill}}
			学号:\underline{\hbox to 3.7cm{\hfill \@number  \hfill}}
			
			同组学生姓名:\underline{\hbox to 3.3cm{\hfill\@teammate\hfill}}
			指导老师:\underline{\hbox to 3.3cm{\hfill  \@tutor \hfill}}
			
			实验地点: \underline{\hbox to 3.7cm{\hfill \@labplace \hfill}}
			实验日期:\underline{\hbox to 1cm{\hfill\@year\hfill}}年\underline{\hbox to 0.5cm{\hfill\@mounth\hfill}}月\underline{\hbox to 0.5cm{\hfill \@day\hfill}}日\\
		\end{spacing}	
	}
}

\definecolor{mygreen}{rgb}{0,0.6,0}
\definecolor{mygray}{rgb}{0.5,0.5,0.5}
\definecolor{mymauve}{rgb}{0.58,0,0.82}
\linespread{1.5}%行距调整
\setmonofont{Consolas}
\lstset{
	backgroundcolor=\color{white},   % choose the background color
	basicstyle=\footnotesize\ttfamily, % size of fonts used for the code或改成\small\monaco稍大
	numbers=left,                        % 设置行号
	numberstyle=\footnotesize,            % 设置行号字体大小
	columns=fullflexible,
	breaklines=true,                 % automatic line breaking only at whitespace
	captionpos=b,                    % sets the caption-position to bottom
	tabsize=4,                       % 把tab扩展为4个空格,默认是8个太长
	commentstyle=\color{mygreen},    % 设置注释颜色
	keywordstyle=\color{blue}\bfseries,       % 设置keyword颜色
	stringstyle=\color{mymauve},     % string literal style
	frame=single,                        % 设置有边框
	rulesepcolor=\color{red!20!green!20!blue!20},
	identifierstyle=\color{black},
}


  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值