A3试卷模板的宏包GEEexam文件中如何添加自定义命令?将自定义命令剪切粘贴至宏包尾部,运行出错!

发布于 2024-09-26 18:00:07

GEEexam.sty

%A3试卷模板的宏包GEEexam文件中如何添加自定义命令?将自定义命令剪切粘贴至宏包尾部,运行出错!


\documentclass[11pt,space]{ctexart} 

\usepackage{GEEexam}%需安装宏包GEEexam %安装路径E:\texlive\2023\texmf-dist\tex\latex\GEEexam

%以下自定义命令已经粘贴在宏包GEEexam的最后,如果此处删除以下命令,则运行出错
%==============================自定义命令=======================================================
%====填空题横线
\ExplSyntaxOn
\NewDocumentCommand \sh{g}
  {\IfNoValueTF {#1}{\,\underline{\hbox to 0.8cm{}}\,}{\,\underline{\hbox to 0.8cm{\hfill#1\hfill}}\,}}%-------更短横线
\ExplSyntaxOff 

\ExplSyntaxOn
\NewDocumentCommand \hh{g}
  {\IfNoValueTF {#1}{\,\underline{\hbox to 1cm{}}\,}{\nolinebreak\textcolor[rgb]{1.00,0.00,0.00}{【#1】}}}%-------短横线
\ExplSyntaxOff

\ExplSyntaxOn
\NewDocumentCommand \hhh{g}
  {\IfNoValueTF {#1}{\,\underline{\hbox to 2.5cm{}}\,}{\nolinebreak\hfill\textcolor[rgb]{1.00,0.00,0.00}{【#1】}}}
\ExplSyntaxOff
%  用法:\hhh输出_______ ;\hhh{增}输出______增_______;\hhh{\raisebox{.8ex}{$[\frac{\pi}{12},\frac{5\pi}{12}]$}}

\ExplSyntaxOn
\NewDocumentCommand \hhhh{g}
  {\IfNoValueTF {#1}{\,\underline{\hbox to 5cm{}}\,}{\nolinebreak\hfill\textcolor[rgb]{1.00,0.00,0.00}{【#1】}}}%-------加长横线
\ExplSyntaxOff 

%====阿拉伯数字转罗马数字\rmnum{ }\Rmnum{ }
\makeatletter
\newcommand{\rmnum}[1]{\romannumeral #1}
\newcommand{\Rmnum}[1]{\expandafter\@slowromancap\romannumeral #1@}
\makeatother

%====带圈数字2 \circnum{1} 项目编号:[\label=\circnum{\arabic*}]
\newcommand{\circled}[2][]{\tikz[baseline=(char.base)]
    {\node[shape = circle, draw, inner sep = -1pt]%圈大小
    (char) {\phantom{\ifblank{#1}{#2}{#1}}};%
    \node at (char.center) {\makebox[0pt][c]{#2}};}}
\robustify{\circled}
\newcommand{\circnum}[1]{\circled[00]{\footnotesize#1}}%数大小

%====正体数学符号
\newcommand{\R}{\mathrm{\mathbf{R}}}
\newcommand{\N}{\mathrm{\mathbf{N}}}
\newcommand{\Q}{\mathrm{\mathbf{Q}}}
\newcommand{\Z}{\mathrm{\mathbf{Z}}}
\newcommand{\dt}{\,\symup{d} t}
\newcommand{\dx}{\,\symup{d} x}
\newcommand{\dy}{\,\symup{d} y}

%====圆弧\wideparen{ }
\DeclareSymbolFont{ugmL}{OMX}{mdugm}{m}{n}
\SetSymbolFont{ugmL}{bold}{OMX}{mdugm}{b}{n}
\DeclareMathAccent{\wideparen}{\mathord}{ugmL}{"F3}

%====平行四边形\parallelogram
\newcommand*\parallelogram{%
  \mathord{\text{%
    \tikz[baseline]
      \draw (0,.1ex) -- (.8em,.1ex) -- (1em,1.4ex) -- (.2em,1.4ex) -- cycle;}}}

%====平行且相等\paralleleq
\usepackage{pict2e}
\newcommand\paralleleq{%
  \begingroup
  \setlength\unitlength{0.1em}%
  \linethickness{0.5\unitlength}%
  \roundcap
  \mathrel{\begin{picture}(6,7)
    \Line(0,-1)(6,-1)
    \Line(0,0.5)(6,0.5)
    \Line(1.5,1.5)(3.5,7)
    \Line(3.5,1.5)(5.5,7)
  \end{picture}}
  \endgroup}

%====全等\congruent
\newcommand*\congruent{%
    \mathrel{\text{%
    \tikz \draw[baseline] (-.22em,-.4ex) arc (-90:-285:0.4ex) (-.22em,-.4ex) .. controls (0,-.4ex) and (0,.4ex) .. (.22em,.4ex) arc (90:-105:0.4ex) (-.4em,-.75ex) -- (.4em,-.75ex) (-.4em,-1.1ex) -- (.4em,-1.1ex);%
}}}

%====绝对值\abs{ }
\newcommand{\envert}[1]{\left\lvert#1\right\rvert}
\let\abs=\envert

%====列举法表示集合\set
\newcommand\set[1]{\left\{\rule{0cm}{1.7ex} {#1} \right\}}

%====描述法表示集合\Set
\newcommand\Set[2]{\left\{\rule{0cm}{1.7ex}\, {#1} \, \middle\vert \, {#2} \,\right\}}
%=====================================自定义命令结束========================================================

\begin{document}
        
    填空题横线\hhh
    
    阿拉伯数字转罗马数字~$\Rmnum{3}$
    
    带圈数字~$\circnum{1}$
    
    正体符号~$\R$
    
    圆弧~$\wideparen{AB}$
    
    平行四边形~$\parallelogram$
    
    平行且相等~$\paralleleq$
    
    全等~$\congruent$
    
    绝对值~$\abs{x}$
    
    列举法~$\set{1,2,3}$
    
    描述法~$\Set{x}{1<x<2}$

\end{document}

查看更多

关注者
0
被浏览
393
1 个回答
D
D 2024-09-26
这家伙很懒,什么也没写!

应该粘贴在endinput前面

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览