LaTeX 用于小学数学

LaTeX 用于小学数学

我想为小学生制作一些数学练习册。具体来说,我希望在每一页上都包含一组简单的加法和乘法。这个想法是为了建立一个儿童能力的诊断测试。

我需要能够以基本的、小学的黑板风格来设置问题。LaTeX 中的数学通常以成熟的内联方式呈现。但我想要小学的东西:每个操作数一行;在操作数和解决方案之间画一条线;大而粗的运算符号。长除法看起来像长除法。诸如此类。

答案1

您可以尝试以下方法:

\documentclass{article}
\usepackage{etoolbox}
\usepackage{graphicx}

\makeatletter
\newlength\ae@top@length
\newlength\ae@bot@length

\def\ae@extra@width{1.25em}
%% the user interface for creating the problems
%% #1=+|-|\times|\div 
%% #2=number with at least as many digits as #3
%% #3=number with no more digits than #2              
\newcommand\operation[3]{%%
  \ifx#1\div
    \ae@setup@division{#1}{#2}{#3};%%
  \else
    \ae@setup@other{#1}{#2}{#3};%%
  \fi
}

%% setup if handling addition, subtraction, or multiplication
\def\ae@setup@other#1#2#3;{%%
  \let\ae@top\relax
  \let\ae@bot\relax
  \ae@format@top#2\relax;%%
  \ae@format@bot#3\relax;%%
  \settowidth\ae@top@length{\ae@top}%%%
  %% create a minipage for displaying the problem
  \begin{minipage}[b]{\dimexpr\ae@top@length+\ae@extra@width}%%
    \hspace*{\fill}%%
    \ae@top\newline
    \rule[-2pt]{\dimexpr\ae@top@length+\ae@extra@width}{0.4pt}%%
    \hspace*{-\dimexpr\ae@top@length+\ae@extra@width}%%
    $#1$
    \hspace*{\fill}%%
    \ae@bot\newline
  \end{minipage}%%
  }

%% setup if handling division
\def\ae@setup@division#1#2#3;{%%
  \let\ae@top\relax
  \let\ae@bot\relax
  \ae@format@top#2\relax;%%
  \ae@format@bot#3\relax;%%
  \settowidth\ae@top@length{\ae@top}%%%
  \settowidth\ae@bot@length{\ae@bot}%%
  %% create a minipage for displaying the problem
  \begin{minipage}[b]{\dimexpr\ae@top@length+\ae@bot@length+4pt+0.4pt}%%
    \hspace*{\fill}%%
    \ae@bot
    \hspace{2pt}%%
      \rule[-2pt]{0.4pt}{\dimexpr2.5ex+2pt}%%
      \rule[\dimexpr2.5ex]{\dimexpr\ae@top@length+4pt}{0.4pt}%%
    \hspace*{-\dimexpr\ae@top@length+4pt}%%
    \hspace{2pt}%%
    \ae@top
  \end{minipage}%%
}

%% a command to format the digits so they line up nicely
\def\ae@digit#1{\scalebox{1.25}{\makebox[6pt]{#1}}}

%% a command to read in the digits
\def\ae@format@the@digits#1#2#3;{%%
  \def\ae@continue{}%%
  \ifx#1\relax
    \def#1{\ae@digit{#2}}%%
  \else
    \edef#1{\expandonce#1\noexpand\ae@digit{#2}}%%
  \fi
  \ifx#3\relax
  \else
    \def\ae@continue{\ae@format@the@digits#1#3;}%%
  \fi
  \ae@continue
}

\def\ae@format@top#1#2;{\ae@format@the@digits\ae@top#1#2;}
\def\ae@format@bot#1#2;{\ae@format@the@digits\ae@bot#1#2;}

\makeatother

\newlength\aetmp
\begin{document}

\operation{\times}{346}{23}

\operation{\times}{634}{213}

\operation{+}{1364}{23}

\operation\div{1364}{23}

\end{document}

结果是

在此处输入图片描述

这里我假设第二个参数总是至少具有与第三个参数一样多的数字。

相关内容