扩展表格以添加其他列并使用 TiKz 在同类项周围绘制对角线圆

扩展表格以添加其他列并使用 TiKz 在同类项周围绘制对角线圆

我正在为我的学生创建一组解决方案,以帮助他们学习如何将两个多项式相乘。

下面的 mwe 适用于 2 x 2 表(二项式 x 二项式)。

在此处输入图片描述

但我需要用在“同类项”周围画一个圆圈来表示二项式乘以三项式,如下所示。

在此处输入图片描述

我扩大列数的尝试彻底失败了。

请注意,问题 #1(二项式 x 三项式)未反映在上面的 2 x 2 图像中。只是想表明现有代码有效。

因此,我们非常感谢您的帮助。

姆韦

\documentclass[12pt]{exam}

\printanswers
% un-comment to print solutions.
\renewcommand{\solutiontitle}{}

\usepackage{multirow, tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\usepackage[table]{xcolor}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{cancel}
\usepackage{framed}
\usepackage{multicol}
\usepackage{tasks}
\usepackage[a4paper,margin=0.5in,include head]{geometry}

\everymath{\displaystyle}
\setlength\parindent{1em}

\pagestyle{head}
\header{Algebra II: Test 2 Review (Units 10 and 11)}
       {}
       {014/03/21} 

\newcommand{\pagetop}{%
\noindent 
  \fbox{\fbox{\parbox{\dimexpr\textwidth-4\fboxsep-4\fboxrule}{
  
    \bigskip
    \bigskip 
  }}}
  \bigskip
  \vspace{0.5mm}
}

\settasks{after-item-skip=1em,
          after-skip=2cm,
          label-width=2em,
          item-indent=3em,
          label=(\arabic*),
          column-sep=2em
          }
\begin{document}

%definition for bigskip = 1 line to replace all \bigskip
\def\bigskip{\vskip\bigskipamount}

\begin{tasks}
[style=enumerate](2)
% Prob #1
\task $(3x+2)(5x^2-4x+7)$
\begin{solutionorbox}[5cm]

Use the area model to multiply two polynomials.

\newcommand\mcc[1]{\multicolumn{1}{c}{#1}} 
\hspace{1cm}
\renewcommand\arraystretch{2}
\begin{tabular}{ c | c | c | }
  \mcc{} & \mcc{\textcolor{red}{$5k$}} & \mcc{\textcolor{red}{$+6$}} \\
    \cline{2-3}
 \textcolor{red}{$k$} & $5k^2$ & $6$ \\
    \cline{2-3}
 \textcolor{red}{$+2$} & $10k$ & $12$ \\
    \cline{2-3}
\end{tabular}

\vspace{0.5cm}
Product $={\color{black} 5k^2+16k+6}$ 
\\

\end{solutionorbox}

\vspace{0.25cm}
% Prob #1
\task $\dfrac{5k^2+10k+24}{6k+12}$
\begin{solutionorbox}[5cm]
step-by-step solution goes here
\end{solutionorbox}
\end{tasks}
\end{document}

答案1

开始吧,fit图书馆tikzmark是你的朋友 ;-) (我使用了 35 度的旋转角度,但你可能希望根据自己的需要进行调整)

在此处输入图片描述

\documentclass[12pt]{exam}

\printanswers
% un-comment to print solutions.
\renewcommand{\solutiontitle}{}

\usepackage{multirow, tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\usepackage[table]{xcolor}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\usetikzlibrary{fit}
\usepackage{amsmath}
\usepackage{cancel}
\usepackage{framed}
\usepackage{multicol}
\usepackage{tasks}
\usepackage[a4paper,margin=0.5in,include head]{geometry}

\everymath{\displaystyle}
\setlength\parindent{1em}

\pagestyle{head}
\header{Algebra II: Test 2 Review (Units 10 and 11)}
       {}
       {014/03/21} 

\newcommand{\pagetop}{%
\noindent 
  \fbox{\fbox{\parbox{\dimexpr\textwidth-4\fboxsep-4\fboxrule}{
  
    \bigskip
    \bigskip 
  }}}
  \bigskip
  \vspace{0.5mm}
}

\settasks{after-item-skip=1em,
          after-skip=2cm,
          label-width=2em,
          item-indent=3em,
          label=(\arabic*),
          column-sep=2em
          }
\begin{document}
\newcommand\mcc[1]{\multicolumn{1}{c}{#1}} 

%definition for bigskip = 1 line to replace all \bigskip
\def\bigskip{\vskip\bigskipamount}

\begin{tasks}
[style=enumerate](2)
% Prob #1
\task $(3x+2)(5x^2-4x+7)$
\begin{solutionorbox}[5cm]

Use the area model to multiply two polynomials.

\hspace{1cm}
\renewcommand\arraystretch{2}
\begin{tabular}{ c | c | c | }
  \mcc{} & \mcc{\textcolor{red}{$5k$}} & \mcc{\textcolor{red}{$+6$}} \\
    \cline{2-3}
 \textcolor{red}{$k$} & $5k^2$ & $6$ \\
    \cline{2-3}
 \textcolor{red}{$+2$} & $10k$ & $12$ \\
    \cline{2-3}
\end{tabular}

\vspace{0.5cm}
Product $={\color{black} 5k^2+16k+6}$ 
\\

\end{solutionorbox}

\vspace{0.25cm}
% Prob #1
\task $\dfrac{5k^2+10k+24}{6k+12}$
\begin{solutionorbox}[5cm]
  step-by-step solution goes here
  
\renewcommand\arraystretch{2}  
\begin{tabular}{ c | c | c | c | }
  \mcc{}                & \mcc{\textcolor{red}{$5x^2$}}      & \mcc{\textcolor{red}{$-4x$}}        & \mcc{\textcolor{red}{$+7$}}       \\
  \cline{2-4}
  \textcolor{red}{$3x$} & $15x^2$                            & \tikzmarknode{firstDiagB}{$-12x^2$} & \tikzmarknode{secondDiagA}{$21x$} \\
  \cline{2-4}
  \textcolor{red}{$+2$} & \tikzmarknode{firstDiagA}{$10x^2$} & \tikzmarknode{secondDiagB}{$-8x$}   & $14$
  \begin{tikzpicture}[overlay,remember picture]
    \node[draw=red, rotate fit=35, rounded corners, fit=(firstDiagA)(firstDiagB)]{};
    \node[draw=green, rotate fit=35, rounded corners, fit=(secondDiagA)(secondDiagB)]{};
  \end{tikzpicture}                                                                                                                    \\
  \cline{2-4}
\end{tabular}

\end{solutionorbox}
\end{tasks}
\end{document}

相关内容