基于LaTeX的加减乘除练习题自动生成方法(卷娃必备工具)

所需软件

安装VSCode,官方下载链接

配置LaTex

参考如下链接,VSCode配置LaTex

代码


%用XeLaTex编译
\documentclass[11pt]{ctexart}
\usepackage{amsmath,geometry,paralist,lastpage,graphicx,fancyhdr}
\geometry{a4paper, left=1.5cm, right=1.5cm, top=1.75cm, bottom=1.5cm, nohead}
\usepackage{lineno,indentfirst}
\usepackage{tikz,array,forloop}
\newcounter{x}
\newcounter{y}

\begin{document}

	\begin{center}
        {\songti\zihao{2}\textbf{乘法练习题}}\\
		\vspace{2em}
        {\songti\zihao{5}学号\underline{\hspace{9.2em}}~姓名\underline{\hspace{9.2em}}~日期\underline{\hspace{9.2em}}}\\
		\vspace{2em}
	\end{center}
	\vspace{1em}
            \begin{tabular}{ p{3.5cm} p{3.5cm} p{3.5cm}  p{3.5cm}}

                \forloop{y}{0}{\value{y} < 17}{
                \forloop{x}{0}{\value{x} < 4}{ % generates the header row of the table
                    $
                \pgfmathrandominteger{\numberOne}{10}{100} %随机生成10-100的数字
                \pgfmathrandominteger{\numberTwo}{2}{9} %随机生成2-9的数字
                \numberOne
                \pgfmathparse{ifthenelse(\numberOne<\numberTwo, "+", "-")}\pgfmathresult %符号
                \numberTwo
                =
                $ \par
                \ifthenelse{\value{x}<3}{&}{}
                            % one less '&' than the number of columns
                            }\\
                }
            \end{tabular}
\end{document}

点击构建项目即可生成pdf文件,修改相应注释行的代码几个生成各种要求的计算题,Latex也可以生成更加专业复杂的数学公式,因此用来出题再合适不过了。
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值