Rivers分享 http://blog.sciencenet.cn/u/sdssxwfd

博文

Python 试题选择系统(tex)版中试题标准模板

已有 642 次阅读 2024-3-2 09:10 |系统分类:教学心得

在《基于Python的数学专业题库(tex版)选择系统》

https://blog.sciencenet.cn/home.php?mod=space&uid=216525&do=blog&id=1316022

的博文中用到的《试题标准.tex》

\documentclass[b4paper,twocolumn,twoside,landscape,GBK]{ctexart}

\usepackage{exam}      %徐伟制作QQ41751356

\lyear{2023-2024}      %学年

\term{一}              %学期

\qimz{末}              %期末还是期终

\school{数学科学学院}  %输入学院

\kemu{数学实验}        %考试科目

\grade{2020}           %适用年级

\zuanye{数学师范,数学公费师范班}%适用专业

\leixing{A}            %试卷类型

\score{否}             %是否显示分数表,是显示,否不显示

\binding{否}           %是否在第一页显示装订线,是:显示装订线,否:不显示,其余每页不想装订线要手动注释掉

\ansshow{否}           %是否输出答案标题,是输出,否输出试题标题

%%%%%%%%%%%%%%%%%%

\columnseprule=1pt     %如果不想要分栏线请把本句注释掉

\begin{document}

\ifthenelse{\equal{\ansshow}{是}}{\centerline{\textbf{\Large\school\lyear学年第\term  学期期\qimz考试试题\leixing答案}}\hspace{0.4cm}\vspace{0.4cm}}{\maketitle}

\usetag{an,ti}   %题目请用\tagged{ti}标记,答案请用 \tagged{an}标记

%\section{正文}

\end{document} 

使用的试题库标准格式:

\documentclass[GBK]{ctexart}

\usepackage{Testmodule}      %徐伟制作QQ41751356

\usepackage{geometry}

\begin{document}

\usetag{an,ti}

\centerline{\Large\textbf{几何画板试题库}}

\section{Excel判断题}

\begin{enumerate}

\item \tagged{ti}{Excel中单变量求解的结果与初值有关。}\tagged{an}{An: 对}

\end{enumerate}

\section{判断题}

\begin{enumerate}

\item \tagged{ti}{几何画板可以画直线、线段、射线。}\tagged{an}{对}

\end{enumerate}

\section{填空题}

\begin{enumerate}

\item \tagged{ti}{选定不在同一直线上的三点构造过三点的弧,可以给出按$\underline{\hspace{1cm}}$(逆时针或顺时针)方向从选定的第一个点过第二点到第三点的弧。} \tagged{an}{逆时针}

\end{enumerate}

\section{简答题}

\begin{enumerate}

\item \tagged{ti}{Excel中如果要在同一行或同一列的连续单元格使用相同的计算公式快捷的操作方式是什么。}\tagged{an}{An: 先在第一个单元格输入公式,然后用鼠标拖动单元格的填充柄来实现公式的复制。}

\end{enumerate}

\section{操作题}

\begin{enumerate}

\item \tagged{ti}{牛顿迭代法函数求解。} \tagged{an}{ An: \lstinputlisting[language=Matlab]{./code/jieda15.m}}

\end{enumerate}

\end{document}

下面是本标准中使用的自制宏包的内容:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% EXAM Template

%% Template by Hurricane.QQ:981824245

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\NeedsTeXFormat{LaTeX2e}[1995/12/01]

\ProvidesPackage{exam}[2017/12/24 v1.0 exam Template]

\typeout{exam Template for  exam Version 3.0,本宏包适于CTEX3.0}

%\LoadClass{exam}[2007/10/19]

%\RequirePackage[b4paper,twocolumn,landscape]{ctexart}[2007/10/19]本宏包适于ctex3.0

%============================用到的宏包=======================

\RequirePackage{tagging}

\RequirePackage{ifthen}

\RequirePackage{ctex}

\RequirePackage{titletoc,titlesec,ctexheading}%,ctexcap}

\RequirePackage{geometry,textcomp}

\RequirePackage{amsmath,amsthm,amsfonts,amssymb,bm}

\RequirePackage{fancyhdr,fancybox}        %页码宏包 ,fancybox

\RequirePackage{lastpage}                 %,totpages

\RequirePackage{calc,multicol}

\RequirePackage{dashrule,rotating}

\RequirePackage{enumerate}

\RequirePackage{graphicx,graphics,listings,xcolor}

\RequirePackage{array,tabularx}

%=============================评分表==========================

\newcommand{\score}[1]{\gdef\score{#1}} 

\newcommand{\reader}

{\begin{tabular}{|c|c|}\hline 得分 & \\ \hline 阅卷人 & $\qquad$\\ \hline\end{tabular}}

\ctexset{section={name={,、},aftername =\hspace{0pt},format=\large\bfseries\raggedright,number=\chinese{section}}}

\iffalse

\newcommand{\evscore}[1]{\gdef\evscore{#1}} 

\ifthenelse{\equal{\evscore}{是}}{\CTEXset[name={~,~. \reader},number={\chinese{section}},format={\bfseries}]{section}}%

   {\CTEXset[number={\chinese{section}},format={\bfseries}]{section}}\fi%

%==========================插入图片的位置路径====================

\graphicspath{{./}{./img/}{./fig/}{./image/}{./figure/}{./picture/}}

%============================页面设置===========================

\geometry{top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm}

\setlength{\topmargin}{-1.5cm}

\setlength{\footskip}{-2cm}

\setlength{\topskip}{0cm}

%============================条目间距

%\setenumerate[1]{itemsep=0pt,partopsep=0pt,parsep=\parskip,topsep=5pt}

%===========================装订线命令========================

%\oddsidemargin=0.5cm   %奇数页页边距

%\evensidemargin=2.5cm %偶数页页边距

\newcommand\bindingline{\ifthenelse{\isodd{\thepage}}

      {\addtolength{\marginparsep}{-18pt}

      \marginpar{\rotatebox{90}{

        \begin{minipage}{\textheight}

          \begin{center}

           \dotfill{}装\dotfill{} 订\dotfill{} 线\dotfill{}

          \end{center}

       \end{minipage}}

      }}

      {\addtolength{\marginparsep}{15pt}

      \marginpar{\rotatebox{90}{

        \begin{minipage}{\textheight}

          \begin{center}

           \dotfill{}装\dotfill{} 订\dotfill{} 线\dotfill{}

          \end{center}

       \end{minipage}}}

      }}

%==========================定义选择题==============================

\newcommand{\oneline}[4]{\\ \hspace*{2em}A.~#1 \hspace*{2em}\\ \hspace*{2em}B.~#2 \hspace*{2em}\\  \hspace*{2em}C.~#3 \hspace*{2em}\\  \hspace*{2em}D.~#4}  %四个选项占一行

\newcommand{\twoline}[4]

    {\hspace*{2em}\begin{tabular}{*{2}{@{}p{0.25\textwidth}}}A.~#1 & B.~#2\end{tabular}

     \hspace*{2em}\begin{tabular}{*{2}{@{}p{0.25\textwidth}}}C.~#3 & D.~#4\end{tabular}} %四个选项占两行

\newcommand{\fourline}[4]{\hspace*{2em}

        \begin{tabular}{*{4}{@{}p{0.125\textwidth}}}A.~#1 & B.~#2 & C.~#3 & D.~#4\end{tabular}} %共占一行

       %=================自动处理选项间距==========================

  \newlength{\opta}%选项1长度

  \newlength{\optb}%选项2长度

  \newlength{\optc}%选项3长度

  \newlength{\optd}%选项4长度

  \newlength{\maxw}%选项最大宽度

 %====================四个选项时%=================================

  \newcommand{\opt}[4]%命令函数,根据选项的最大宽度自动选择最合适排版形式

   {%

    \settowidth{\opta}{#1}

    \settowidth{\optb}{#2}

    \settowidth{\optc}{#3}

    \settowidth{\optd}{#4}

    \setlength{\maxw}{\opta}

      \ifthenelse{\lengthtest{\optb > \maxw}}{\setlength{\maxw}{\optb}}{}

      \ifthenelse{\lengthtest{\optc > \maxw}}{\setlength{\maxw}{\optc}}{}

      \ifthenelse{\lengthtest{\optd > \maxw}}{\setlength{\maxw}{\optd}}{}

      \ifthenelse{\lengthtest{\maxw > 0.2\textwidth}}%

        {\oneline{#1}{#2}{#3}{#4} }                        %超过1/2文本宽排四行

         {%

           \ifthenelse{\lengthtest{\maxw >0.1\textwidth}}

           {\twoline{#1}{#2}{#3}{#4}}                      %超过1/4文本宽不超过1/2文本宽,排两行

           {\fourline{#1}{#2}{#3}{#4} }%不超过1/4文本宽,排一行

         }%

     }

\lstset{language=Matlab}

\lstset{breaklines}%自动将长的代码行换行排版

\lstset{extendedchars=false,keywordstyle=\color{blue}\bfseries}

%==========================试卷卷头定义============================

\iffalse\newcommand

\currentyear[1]{\ifthenelse{\number\month<8\and\number\month>3}{\textbf{#1-\the\numexpr#1+1\relax}}

{\textbf{#1-\the\numexpr#1+1}}}\fi

\newcommand\lyear[1]{\gdef\lyear{#1}}          %定义学年

\newcommand\term[1]{\gdef\term{#1}}            %定义学期

\newcommand\qimz[1]{\gdef\qimz{#1}}            %定义学期中还是期终

\newcommand\school[1]{\gdef\school{#1}}         %定义学院

\newcommand\kemu[1]{\gdef\kemu{#1}}             %定义科目

\newcommand\zuanye[1]{\gdef\zuanye{#1}}         %定义专业

\newcommand\leixing[1]{\gdef\leixing{#1}}       %定义考试类型

\newcommand\grade[1]{\gdef\grade{#1}}           %定义年级

\newcommand\binding[1]{\gdef\binding{#1}}        %定义学院

\newcommand\leftpage[1]{\the\numexpr#1*2-1\relax}%定义左页码,

\newcommand\rightpage[1]{\the\numexpr#1*2\relax} %定义右页码,

\newcommand{\ansshow}[1]{\gdef\ansshow{#1}}      %定义答案标题

\renewcommand\maketitle{%

   {\textbf{\Large

   \centerline{

    \iffalse\school\currentyear{\number\year}学年第\ifthenelse {\number\month<8\and\number\month>3}{一}{二}\fi       \school\lyear学年第\term  学期期\qimz考试试题\hspace{0.4cm}}}}\vspace{0.4cm}

    

    \centerline{\textbf{考试科目:}\kemu\quad\textbf{年级:}\grade\quad

    \textbf{适用专业:}\zuanye}\vspace{0.1cm}

    \centerline{\textbf{时间:}120分钟\quad\textbf{考试方式:}闭卷\quad\textbf{试卷类别:}\leixing 卷

    \quad\textbf{试题满分:}100分}\vspace{0.2cm}

   \ifthenelse{\equal{\score}{是}}

    {\begin{center}\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|}

        \hline

           题号&一 &二 &三 & 四 &五 &六 & 七 & 八 & 九 & 十 & 总分 \\

        \hline

           得分  &   &  &   &  &$\qquad$ &$\qquad$ &$\qquad$ &$\qquad$ &$\qquad$ &$\qquad$ & \\

        \hline

           阅卷人&$\qquad$ &$\qquad$  &$\qquad$ &$\qquad$  &   &   &  &   &  &   &   \\

        \hline

    \end{tabular}\end{center}} 

    {\centerline{\small\framebox{注意:答案全部写在答题纸上,写清题号,不必抄题.}}}\vspace{0cm}

    %=====================设置页码=======================================

    \pagestyle{fancy}   %fancyhdr宏包新增的页面风格

      \fancyhead{}

      \renewcommand{\headrulewidth}{0pt} % 在页眉不画分隔线,不等于0pt时画线。

      \fancyhf{}

      \lhead{}\chead{}\rhead{}

      \lfoot{\hspace{7.5cm}第\ \leftpage{\thepage}\, 页}%, 共\pageref{LastPage}页}

     %\cfoot{第 \thepage\,页 , 共\pageref{LastPage}页}            %当前页  of 总页数

      \rfoot{第\ \rightpage{\thepage}\ 页\hspace{6.5cm}}

    %====================设置试题装订线======================================

    \ifthenelse{\equal{\binding}{是}}

      {\addtolength{\marginparsep}{-5pt}

      \marginpar{\rotatebox{90}{

        \begin{minipage}{\textheight}

          \begin{center}

           学院:\rule[-.5ex]{6.em}{0.3pt}专业:\rule[-.2ex]{6.em}{0.3pt}年级:\rule[-.2ex]{5em}{0.3pt}

           姓名:\rule[-.2ex]{6.em}{0.3pt}学号:\rule[-.2ex]{6.em}{0.3pt}座号:\rule[-.2ex]{5em}{0.3pt}

           \tiny \hdashrule[-3ex]{\textheight}{0.3pt}{3pt}\\[\smallskipamount]%

           %\makebox[0.6\textheight][s]{装订线内不要答题}\\[-3\smallskipamount]

           \dotfill{} 装\dotfill{}订\dotfill{}线\dotfill{}

           \hdashrule[-3ex]{\textheight}{0.3pt}{3pt}

          \end{center}

       \end{minipage}}}%}

      }

    }               %页码设置可以参考http://www.360doc.com/content/14/0105/22/12050012_342909461.shtml

\endinput

试题库标准格式中使用的宏包: 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% EXAM Template

%% Template by Hurricane.QQ:981824245

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\NeedsTeXFormat{LaTeX2e}[1995/12/01]

\ProvidesPackage{Testmodule}[2017/12/24 v1.0 exam Template]

\typeout{exam Template for  exam Version 1.0}

%\LoadClass{exam}[2007/10/19]

%\RequirePackage[b4paper,twocolumn,landscape]{ctexart}[2007/10/19]

%============================用到的宏包=======================

\RequirePackage{tagging}

\RequirePackage{ifthen}

\RequirePackage{titletoc,titlesec}

\RequirePackage{geometry,textcomp}

\RequirePackage{amsmath,amsthm,amsfonts,amssymb,bm}

\RequirePackage{fancyhdr,fancybox}        %页码宏包 ,fancybox

\RequirePackage{lastpage}                 %,totpages

\RequirePackage{calc,multicol}

\RequirePackage{dashrule,rotating}

\RequirePackage{enumerate}

\RequirePackage{graphicx,graphics,listings}

\RequirePackage{array,tabularx,xcolor}

%使题号靠左

\ctexset{section={name={,、},aftername =\hspace{0pt},format=\large\bfseries\raggedright,number=\chinese{section}}}

%\renewcommand{\section}{\@startsection{section}{1}{0mm} {-\baselineskip}{0.5\baselineskip}{\bf\leftline}}

%==========================插入图片的位置路径====================

\graphicspath{{./}{./img/}{./fig/}{./image/}{./figure/}{./picture/}}

%============================页面设置===========================

\geometry{top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm}

\setlength{\topmargin}{-1.5cm}

\setlength{\footskip}{-2cm}

\setlength{\topskip}{0cm}

%==========================定义选择题==============================

\newcommand{\oneline}[4]{\\ \hspace*{2em}A.~#1 \hspace*{2em}\\ \hspace*{2em}B.~#2 \hspace*{2em}\\  \hspace*{2em}C.~#3 \hspace*{2em}\\  \hspace*{2em}D.~#4}  %四个选项占一行

\newcommand{\twoline}[4]

    {\hspace*{2em}\begin{tabular}{*{2}{@{}p{0.25\textwidth}}}A.~#1 & B.~#2\end{tabular}

     \hspace*{2em}\begin{tabular}{*{2}{@{}p{0.25\textwidth}}}C.~#3 & D.~#4\end{tabular}} %四个选项占两行

\newcommand{\fourline}[4]{\hspace*{2em}

        \begin{tabular}{*{4}{@{}p{0.125\textwidth}}}A.~#1 & B.~#2 & C.~#3 & D.~#4\end{tabular}} %共占一行

       %=================自动处理选项间距==========================

  \newlength{\opta}%选项1长度

  \newlength{\optb}%选项2长度

  \newlength{\optc}%选项3长度

  \newlength{\optd}%选项4长度

  \newlength{\maxw}%选项最大宽度

 %====================四个选项时%=================================

  \newcommand{\opt}[4]%命令函数,根据选项的最大宽度自动选择最合适排版形式

   {%

    \settowidth{\opta}{#1}

    \settowidth{\optb}{#2}

    \settowidth{\optc}{#3}

    \settowidth{\optd}{#4}

    \setlength{\maxw}{\opta}

      \ifthenelse{\lengthtest{\optb > \maxw}}{\setlength{\maxw}{\optb}}{}

      \ifthenelse{\lengthtest{\optc > \maxw}}{\setlength{\maxw}{\optc}}{}

      \ifthenelse{\lengthtest{\optd > \maxw}}{\setlength{\maxw}{\optd}}{}

      \ifthenelse{\lengthtest{\maxw > 0.2\textwidth}}%

        {\oneline{#1}{#2}{#3}{#4} }                        %超过1/2文本宽排四行

         {%

           \ifthenelse{\lengthtest{\maxw >0.1\textwidth}}

           {\twoline{#1}{#2}{#3}{#4}}                      %超过1/4文本宽不超过1/2文本宽,排两行

           {\fourline{#1}{#2}{#3}{#4} }%不超过1/4文本宽,排一行

         }%

     }

\lstset{language=Matlab}

\lstset{breaklines}%自动将长的代码行换行排版

\lstset{extendedchars=false,keywordstyle=\color{blue}\bfseries}

      %=====================设置页码=======================================

    \pagestyle{fancy}   %fancyhdr宏包新增的页面风格

      \fancyhead{}

      \renewcommand{\headrulewidth}{0pt} % 在页眉不画分隔线,不等于0pt时画线。

      \fancyhf{}

      \lhead{}\chead{}\rhead{}

     \cfoot{第 \thepage\,页 , 共\pageref{LastPage}页}            

 %页码设置可以参考http://www.360doc.com/content/14/0105/22/12050012_342909461.shtml

\endinput



https://blog.sciencenet.cn/blog-216525-1423779.html

上一篇:得用dos命令统计文件夹中所有文件名
下一篇:matlab时钟
收藏 IP: 120.224.66.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-28 02:32

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部