% 文件 `hfutexam.cls' % !TEX TS-program = xelatex % !TEX encoding = UTF-8 Unicode % åˆè‚¥å·¥ä¸šå¤§å¦è¯•å·æ¨¡æ¿ % 作者: å¼ ç¥žæ˜Ÿ % 使用å‰è¯·å…ˆå®‰è£…å—体: æ–¹æ£å°æ ‡å®‹ã€æ–¹æ£ä»¿å®‹, å¦åˆ™è¯·ä½¿ç”¨é€‰é¡¹ nofangzheng (采用新宋体和仿宋代替) % 编译模å¼ï¼š XeLaTeX % ä½ å¯ä»¥ä»»æ„ä¿®æ”¹æˆ–å†æ¬¡åˆ†å‘该文件 \NeedsTeXFormat{LaTeX2e} \ProvidesClass{hfutexam}[2025/04/30 v1.10 HFUTExam document class by Zhang Shenxing] % 文档选项 \newif\ifhfut@ShiJuan\hfut@ShiJuantrue \newif\ifhfut@DaTiZhi\hfut@DaTiZhifalse \newif\ifhfut@Simple\hfut@Simplefalse \newif\ifhfut@Fandol\hfut@Fandoltrue \newif\ifhfut@Nosign\hfut@Nosignfalse \DeclareOption{datizhi}{\hfut@ShiJuanfalse\hfut@DaTiZhitrue\hfut@Simplefalse} \DeclareOption{cankaodaan}{\hfut@ShiJuanfalse\hfut@DaTiZhitrue\hfut@Simplefalse} \DeclareOption{simple}{\hfut@ShiJuanfalse\hfut@DaTiZhifalse\hfut@Simpletrue} \DeclareOption{nofangzheng}{\hfut@Fandolfalse} % 默认使用方æ£å—体 \DeclareOption{nosign}{\hfut@Nosigntrue} % 基于 ctexart 文档类 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{ctexart}} \ProcessOptions\relax \ifhfut@Simple\else\PassOptionsToClass{twocolumn}{ctexart}\fi \ProcessOptions\relax \LoadClass[12pt,oneside]{ctexart} % 页é¢è®¾ç½® \RequirePackage{amsmath,amssymb,amsthm, graphicx, enumitem, fancyhdr, lastpage, etoolbox, geometry, tikz, zref-savepos} \RequirePackage[normalem]{ulem} \ifhfut@Simple \geometry{a4paper,scale=0.8} \else \geometry{ paperheight=29.7cm, paperwidth=42cm, left=3.17cm, right=3.17cm, voffset=2.2cm, headheight=78pt, headsep=12pt, footskip=1cm } \setlength\columnsep{0.8cm} % 分æ é—´è· \columnseprule=0.5pt % 分æ 线宽度 \fi % 试å·ä¿¡æ¯ \newcommand{\hfutstretch}{1.5} % ä¸‹åˆ’çº¿å†…ä¸¤ä¾§ç©ºæ ¼é•¿åº¦é™¤ä»¥æ¡ç›®ä¹‹é—´ç©ºæ ¼é•¿åº¦ \newcommand{\hfutul}[1]{\uline{\hspace{\stretch{\hfutstretch}}#1\hspace{\stretch{\hfutstretch}}}} \newcommand{\hfutrule}[1]{\rule{#1}{0mm}} \newcommand{\hfutboxyes}{{\raisebox{-2pt}{\LARGE$\checkmark\hspace{-18pt}\square$}}} \newcommand{\hfutboxno}{{\raisebox{-2pt}{\LARGE$\square$}}} \newcommand{\XueNian}[2]{\gdef\hfut@XueNian{{\hfutFontTimes #1}~{\hfutFontTimes #2}}} \newcommand{\BiaoTi}[1]{\gdef\hfut@BiaoTi{#1}} \newcommand{\XueQi}[1]{\gdef\hfut@XueQi{#1}} \newcommand{\XueFen}[1]{\gdef\hfut@XueFen{#1}} \newcommand{\KeChengXingZhi}[1]{\gdef\hfut@KeChengXingZhi{#1}} \newcommand{\KaoShiXingShi}[1]{\gdef\hfut@KaoShiXingShi{#1}} \newcommand{\KeChengDaiMa}[1]{\gdef\hfut@KeChengDaiMa{#1}} \newcommand{\KeChengMingCheng}[1]{\gdef\hfut@KeChengMingCheng{#1}} \newcommand{\ZhuanYeBanJi}[1]{\gdef\hfut@ZhuanYeBanJi{#1}} \newcommand{\KaoShiRiQi}[1]{\gdef\hfut@KaoShiRiQi{#1}} \newcommand{\MingTiJiaoShi}[1]{\gdef\hfut@MingTiJiaoShi{#1}} \newcommand{\XiZhuRenQianMing}[2][5em]{\gdef\hfut@XiZhuRenQianMing{% \tikz[overlay]\node at (1.5,0.22) {\ifx#2\@empty\else\includegraphics[width=#1]{#2}\fi};% \uline{\hspace{0.5em}\hfutrule{#1}\hspace{0.5em}}}} \BiaoTi{} \XueNian{}{} \XueQi{} \KeChengDaiMa{} \KeChengMingCheng{} \XueFen{} \KeChengXingZhi{} \KaoShiXingShi{} \ZhuanYeBanJi{} \KaoShiRiQi{} \MingTiJiaoShi{} \XiZhuRenQianMing{} % ç²—å—体设定 \newfontfamily\hfutFontTimes[AutoFakeBold={3}]{Times New Roman} % 粗罗马 \ifhfut@Fandol \setCJKfamilyfont{hfutFontTitle}[AutoFakeBold={3}]{FZXiaoBiaoSong-B05S} % ç²—æ–¹æ£å°æ ‡å®‹ \newfontfamily\hfutFontTitleEn[AutoFakeBold={3}]{FZXiaoBiaoSong-B05S} \setCJKfamilyfont{hfutFontHead}[AutoFakeBold={3}]{FZFangSong-Z02S} % ç²—æ–¹æ£ä»¿å®‹ \newfontfamily\hfutFontHeadEn[AutoFakeBold={3}]{FZFangSong-Z02S} \else \setCJKfamilyfont{hfutFontTitle}[AutoFakeBold={3}]{NSimSun} % 粗新宋体 \newfontfamily\hfutFontTitleEn[AutoFakeBold={3}]{NSimSun} \setCJKfamilyfont{hfutFontHead}[AutoFakeBold={3}]{FangSong} % 粗仿宋 \newfontfamily\hfutFontHeadEn[AutoFakeBold={3}]{FangSong} \fi \newcommand{\hfutFontTitle}{\CJKfamily{hfutFontTitle}\hfutFontTitleEn} \newcommand{\hfutFontHead}{\hfutFontHeadEn\CJKfamily{hfutFontHead}} % 釿–°è®¾å®šå—ä½“å¤§å° \renewcommand{\LARGE}{\fontsize{21pt}{25.2pt}\selectfont} \renewcommand{\large}{\fontsize{14pt}{21pt}\selectfont} \renewcommand{\small}{\fontsize{10.5pt}{12.6pt}\selectfont} % 缩进 \setlength{\parindent}{0em} \renewcommand{\indent}{\hspace*{2em}} \newlength{\ltemp} % 页眉页脚 \pagestyle{fancy} \fancyhf{} \newcommand{\hfutpage}{{\hfutFontTimes\thepage}} \newcommand{\hfutlastpage}{{\hfutFontTimes\pageref*{LastPage}}} \ifhfut@ShiJuan % 试å·é¡µçœ‰é¡µè„š \renewcommand\headrulewidth{0.5pt} \renewcommand\footrulewidth{0.5pt} \setCJKfamilyfont{hfutFontSimSun}[AutoFakeBold={3}]{SimSun} % 粗宋体 \fancyhead[C]{\bfseries\large\hfutFontHead\hfutrule{6em} \hfill\makebox[280mm][s]{\LARGE\hfutFontTitle~\hfut@BiaoTi~} \hfill{\CJKfamily{hfutFontSimSun} å…±\uline{\makebox[1.5em]{\hfutlastpage}}页第\uline{\makebox[1.5em]{\hfutpage}}页} \vspace{6pt}% \hfut@XueNian{}å¦å¹´ç¬¬\uline{\hfill\hfut@XueQi\hfill}妿œŸ \hfill 课程代ç \hfutul{\hfut@KeChengDaiMa} \hfill 课程åç§°\hfutul{\hfut@KeChengMingCheng} \hfill å¦åˆ†\uline{\hfill\hfut@XueFen\hfill} \hfill 课程性质: % \ifdefstring{\hfut@KeChengXingZhi}{å¿…ä¿®}{% å¿…ä¿®\hfutboxyes{}选修\hfutboxno{}é™ä¿®\hfutboxno}{% \ifdefstring{\hfut@KeChengXingZhi}{选修}{% å¿…ä¿®\hfutboxno{}选修\hfutboxyes{}é™ä¿®\hfutboxno}{% \ifdefstring{\hfut@KeChengXingZhi}{é™ä¿®}{% å¿…ä¿®\hfutboxno{}选修\hfutboxno{}é™ä¿®\hfutboxyes}{% \hfutul{\hfut@KeChengXingZhi} } } } \hfill 考试形å¼: % \ifdefstring{\hfut@KaoShiXingShi}{å¼€å·}{% å¼€å·\hfutboxyes{}é—å·\hfutboxno}{% \ifdefstring{\hfut@KaoShiXingShi}{é—å·}{% å¼€å·\hfutboxno{}é—å·\hfutboxyes}{% \hfutul{\hfut@KaoShiXingShi} } } \vspace{6pt}% 专业ç级(教å¦ç)\hfutul{\hfut@ZhuanYeBanJi} \hfill 考试日期\hfutul{\hfut@KaoShiRiQi} \hfill 命题教师\hfutul{\hfut@MingTiJiaoShi} \hfill ç³»ï¼ˆæ‰€æˆ–æ•™ç ”å®¤ï¼‰ä¸»ä»»å®¡æ‰¹ç¾å\hfut@XiZhuRenQianMing% } \fancyfoot[C]{\small\vspace{0.5\baselineskip}命题教师注æ„事项: 1. 主考教师必须于考试一周å‰å°†â€œè¯•å·Aâ€ã€â€œè¯•å·Bâ€ç»æ•™ç ”室主任审批ç¾å—åŽé€æ•™åŠ¡ç§‘å°åˆ·ã€‚\hspace{1em}% 2. 请命题教师用黑色水笔工整地书写题目或用A4çº¸æ¨ªå¼æ‰“å°è´´åœ¨è¯•å·ç‰ˆèНä¸ã€‚ } \NewDocumentCommand\fillblank{O{35mm} O{5mm} m}{% \settodepth{\ltemp}{#3}% \uline{\makebox[#1]{\rule{0pt}{#2}\raisebox{\ltemp}{#3}}}% } \fi \ifhfut@DaTiZhi % ç”题纸页眉页脚 \renewcommand\headrulewidth{0.5pt} \renewcommand\footrulewidth{0.5pt} \fancyhead[C]{\bfseries\large\hfutFontHead \makebox[\linewidth][s]{\LARGE\hfutFontTitle~\hfut@BiaoTi~} \vspace{6pt}% \hfut@XueNian{}å¦å¹´ç¬¬\uline{\hfill\hfut@XueQi\hfill}妿œŸ \hfill 课程代ç \hfutul{\hfut@KeChengDaiMa} \hfill 课程åç§°\hfutul{\hfut@KeChengMingCheng} \hfill 命题教师\hfutul{\hfut@MingTiJiaoShi} \hfill ç³»ï¼ˆæ‰€æˆ–æ•™ç ”å®¤ï¼‰ä¸»ä»»å®¡æ‰¹ç¾å\hfut@XiZhuRenQianMing% \vspace{6pt}% æ•™å¦ç级\hfutul{\hfutrule{10em}} \hfill å¦ç”Ÿå§“å\hfutul{\hfutrule{10em}} \hfill å¦å·\hfutul{\hfutrule{8em}} \hfill 考试日期\hfutul{\hfut@KaoShiRiQi} \hfill æˆç»©\hfutul{\hfutrule{6em}}% } \fancyfoot[C]{\small\vspace{0.5\baselineskip}第~\hfutpage~页~~å…±~\hfutlastpage~页} \NewDocumentCommand\fillblank{O{35mm} O{9mm} m}{% \settodepth{\ltemp}{#3}% \uline{\makebox[#1]{\rule{0pt}{#2}\raisebox{\ltemp}{#3}}}% } \fi \ifhfut@Simple % ç®€å•æ¨¡å¼é¡µçœ‰é¡µè„š % \titleformat*{\section}{\bfseries\LARGE\hfutFontTitle} \RequirePackage{hyperref} \renewcommand\headrulewidth{0pt} \renewcommand\footrulewidth{0pt} \renewcommand{\maketitle}{% \phantomsection \addcontentsline{toc}{section}{\hfut@BiaoTi} \begin{center}\bfseries \makebox[\linewidth][s]{\LARGE\hfutFontTitle~\hfut@BiaoTi~} \vspace{6pt}% \makebox[\linewidth]{\large\hfutFontHead~ \hfill \hfut@XueNian{}å¦å¹´ç¬¬\hfut@XueQi{}妿œŸ \hspace{\stretch{3}} \hfut@KeChengMingCheng(\hfut@KeChengDaiMa) \hfill~ } \end{center} } \fancyfoot[C]{\small{}第~\hfutpage~页~~å…±~\hfutlastpage~页} \NewDocumentCommand\fillblank{O{35mm} O{5mm} m}{% \settodepth{\ltemp}{#3}% \uline{\makebox[#1]{\rule{0pt}{#2}\raisebox{\ltemp}{#3}}}% } \fi % 题å·åŠ ç²— \renewcommand{\labelenumi}{{\bfseries \theenumi.}} % 题干 \newcommand\tigan[1]{\noindent{\large\textbf{#1}}} % 打分æ \newcommand\scorebox{% \vspace{0.5\baselineskip}\noindent% \begin{tikzpicture}[overlay,xshift=13.8cm,yshift=-1.6cm]% \draw (0,0) rectangle (3.6,2);% \draw (1.8,0)--(1.8,2);% \draw (0,1)--(3.6,1);% \draw (0.9,1.5) node {\textbf{\normalsize 得分}};% \draw (2.7,1.5) node {\textbf{\normalsize 阅å·äºº}};% \end{tikzpicture}% } \ifhfut@Nosign \renewcommand\scorebox{% \vspace{0.5\baselineskip}\noindent% \begin{tikzpicture}[overlay,xshift=15.6cm,yshift=-1.6cm]% \draw (0,0) rectangle (1.8,2);% \draw (0,1.4)--(1.8,1.4);% \draw (0.9,1.7) node {\textbf{\normalsize 得分}};% \end{tikzpicture}% } \fi % ç”题纸æç¤ºä¿¡æ¯ \newcommand\notice{% \noindent\textbf{\small 考生注æ„事项:\\% \indent 1. 本试å·åˆ†è¯•题与ç”å·ä¸¤éƒ¨åˆ†ï¼›\\% \indent 2. 所有试题的解ç”(包括选择ã€å¡«ç©ºï¼‰å¿…须写在专用ç”å·çº¸ä¸Šï¼Œåœ¨è¯•题上直接作ç”ä¸€å¾‹æ— æ•ˆï¼›\\% \indent 3. 考试结æŸåŽï¼Œå¿…须将试题ã€ç”å·æ•´ç†ä¸Šäº¤ï¼Œä¸å¾—将试题带离考场;\\% \indent 4. 考生务必认真填写ç级ã€å§“åã€å¦å·ç‰ä¿¡æ¯ã€‚}\par% {\leavevmode\xleaders\hbox{\rule[4pt]{8pt}{0.5pt}\,}\hfill\null}% } % 填空题 \newlength{\lxxmax} \newlength{\lquar} \newlength{\lhalf} \newlength{\lfull} % 选择题, æ ¹æ®é€‰é¡¹å†…容长度自动排版 \newcounter{lxxtype} \NewDocumentCommand\xx{O{0} m m m m}{% \setlength{\lfull}{\columnwidth}% \addtolength{\lfull}{-\leftmargin}% \setlength{\lhalf}{0.5\lfull}% \setlength{\lquar}{0.25\lfull}% \setcounter{lxxtype}{0}% \ifnum#1=1\setcounter{lxxtype}{1}\fi% \ifnum#1=2\setcounter{lxxtype}{2}\fi% \ifnum#1=4\setcounter{lxxtype}{4}\fi% \settowidth{\lxxmax}{A.~#2~}% èŽ·å–æœ€é•¿é€‰é¡¹é•¿åº¦ \settowidth{\ltemp}{B.~#3~}% \ifdimcomp\ltemp>\lxxmax{\setlength{\lxxmax}{\ltemp}}{}% \settowidth{\ltemp}{C.~#4~}% \ifdimcomp\ltemp>\lxxmax{\setlength{\lxxmax}{\ltemp}}{}% \settowidth{\ltemp}{D.~#5~}% \ifdimcomp\ltemp>\lxxmax{\setlength{\lxxmax}{\ltemp}}{}% \ifnum\value{lxxtype}=0% \setcounter{lxxtype}{4}% \ifdimcomp\lxxmax>\lquar{\setcounter{lxxtype}{2}}{}% \ifnum\value{lxxtype}=2% \ifdimcomp\lxxmax>\lhalf{\setcounter{lxxtype}{1}}{}% \fi% \fi% \vspace{5pt}% \ifnum\value{lxxtype}=1% \\\makebox[\lfull][l]{A.~#2}% \\\makebox[\lfull][l]{B.~#3}% \\\makebox[\lfull][l]{C.~#4}% \\\makebox[\lfull][l]{D.~#5}% \fi% \ifnum\value{lxxtype}=2% \\\makebox[\lhalf][l]{A.~#2}% \makebox[\lhalf][l]{B.~#3}% \\\makebox[\lhalf][l]{C.~#4}% \makebox[\lhalf][l]{D.~#5}% \fi% \ifnum\value{lxxtype}=4% \\\makebox[\lquar][l]{A.~#2}% \makebox[\lquar][l]{B.~#3}% \makebox[\lquar][l]{C.~#4}% \makebox[\lquar][l]{D.~#5}% \fi% } % 选择题ç”题框 \newcommand\xuanzeti[2]{% \begin{tikzpicture}% \draw (0,0) rectangle (1.8,2);% \draw (0,1)--(1.8,1);% \draw (0.9,0.5) node {#2} (0.9,1.5) node {\textbf{#1}};% \end{tikzpicture}% } % 得分点命令 https://ask.latexstudio.net/ask/question/7557.html \makeatletter \ExplSyntaxOn \zref@require@unique \NewDocumentCommand{\examscore}{O{} m}{ \mode_if_math:TF { \@@_math_cdotfill:n {\text{#2}} } { \__examzh_cdotfill: #2 } \mode_if_math:F{ \ignorespaces } } \cs_new:Npn \__examzh_cdotfill: { \mode_leave_vertical: \cleaders \hb@xt@ .44em {\hss $\cdot$ \hss} \hfill \kern\z@ } \cs_new_protected:Npn \@@_math_cdotfill:n #1 { \stepcounter { zref@unique } \hbox_overlap_right:n { \zsaveposx { \thezref@unique L } \zref@ifrefundefined { \thezref@unique R } { } { \cleaders \hbox_to_wd:nn { .44em } { \hss $\cdot$ \hss } \skip_horizontal:n { \zposx { \thezref@unique R } sp - \zposx { \thezref@unique L } sp } } } \tag * { \zsaveposx { \thezref@unique R } #1 } } \ExplSyntaxOff \makeatother \newcommand\Score[1]{~~~\examscore{#1}} \newcommand\score[1]{~~~\examscore{(#1分)}} \renewcommand\le{\leqslant} \renewcommand\ge{\geqslant}