使用 xlop 和 tikz 的新命令

使用 xlop 和 tikz 的新命令

\newcommand考虑这个例子。当数字的数量随?而变化时,最简单的获得相同样式的方法是什么?

如果是两位数字:

在此处输入图片描述

我可以创建四个命令,但是我只想针对这四种情况使用一个命令。

有什么建议吗?

\documentclass[17pt,a4paper]{extarticle}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{librebaskerville}
\usepackage{pbsi}
\usepackage{xcolor}
\definecolor{vert}{RGB}{63,168,102}
\definecolor{bleu}{RGB}{50,85,163}
\definecolor{rouge}{RGB}{204,38,43}
\definecolor{vertf}{RGB}{63,145,103}%{63,168,102}
\usepackage{tikz}
\usetikzlibrary{calc,shapes,positioning}
\usepackage{xlop}

\opset{%
operandstyle.1.5=\color{magenta},
operandstyle.1.1=\color{vertf},
operandstyle.1.2=\color{bleu},
operandstyle.1.3=\color{rouge},
operandstyle.1.4=\color{vert},
operandstyle.2.5=\color{magenta},
operandstyle.2.1=\color{vertf},
operandstyle.2.2=\color{bleu},
operandstyle.2.3=\color{rouge},
operandstyle.2.4=\color{vert},
columnwidth=1cm,lineheight=1cm,
carrystyle=\scriptsize\color{white},
resultstyle.1=\color{vertf},
resultstyle.2=\color{bleu},
resultstyle.3=\color{rouge},
resultstyle.4=\color{vert},
resultstyle.5=\color{magenta},
columnwidth=1cm,lineheight=1cm,
intermediarystyle.1.1=\color{vertf},
intermediarystyle.1.2=\color{bleu},
intermediarystyle.1.3=\color{rouge},
intermediarystyle.1.4=\color{vert},
intermediarystyle.2.1=\color{bleu},
intermediarystyle.2.2=\color{rouge},
intermediarystyle.2.3=\color{vert},
intermediarystyle.3.1=\color{rouge},
intermediarystyle.3.2=\color{vert},
intermediarystyle.3.3=\color{brown},
carrystyle=\scriptsize\color{white}}



%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%

\tikzset{fonte/.style={font=\bsifamily}}

\tikzset{ligne/.style={ thick,opacity=0.8}}

\begin{tikzpicture}

\node[text centered] (op) {\opadd[resultstyle=\color{white}]{3254}{4569}};

\node[vert,fonte](m) at ($(op.north)+(-1cm,0cm)$) {th};

\node[rouge,fonte](c) at (op.north) {h};

\node[bleu,fonte](d) at ($(op.north)+(1cm,0cm)$) {t};

\node[vertf,fonte](u) at ($(op.north)+(2cm,0cm)$) {o};

%Ones

\draw[vertf,ligne](u)--++(0cm,-5cm);

%tens

\draw[bleu,ligne](d)--++(0cm,-5cm);

%hundreds

\draw[rouge,ligne](c)--++(0cm,-5cm);

%thousands

\draw[vert,ligne](m)--++(0cm,-5cm);

\end{tikzpicture}



What about :



\opadd{45}{36} 



 or 

\opmul{24}{13}

\end{document}

相关内容