如何控制表格中 \cline 的出现?

如何控制表格中 \cline 的出现?

下面是多项式长除法示例的代码。我使用命令\onslide<>来控制某些事物首先出现的顺序。唯一的问题是\cline。命令\onslide<>不起作用\cline。在下面的代码中,第二个“\cline{4-10}”在长除法的步骤中出现,但我希望它最后出现。我怎么才能控制它呢?

\documentclass[14pt]{beamer} 
\usepackage{etex}
\usetheme{metropolis}
\usepackage{adjustbox}
\usepackage{tikz}
\usepackage{tikz-cd}
\usepackage{polynom}
\usepackage{colortbl}

\usepackage{pgffor,calc}

\newlength\boxwidth
\newlength\boxheight


\newenvironment<>{varexampleblock}[2][1.0\textwidth]{%
    \setlength{\textwidth}{#1}%
    \setlength{\linewidth}{\textwidth}%
  \begin{actionenv}#3%
    \def\insertblocktitle{#2}%
    \par%
    \setbeamercolor{local structure}{parent=example text}%
    \usebeamertemplate{block example begin}}
  {\par%
  \usebeamertemplate{block example end}%
    \end{actionenv}}


\newcommand\scalemath[2]{\scalebox{#1}{\mbox{\ensuremath{\displaystyle #2}}}}

\title{Polynomial Long Division}
\date{}


\begin{document}

{   
    \setbeamerfont{frametitle}{size=\small}

\begin{frame}[shrink = 20]
\frametitle{Polynomial Long Division} \pause

\begin{varexampleblock}[20cm]{Example} 

\vspace{0.25cm}

Divide $3x^3+12x^2+5x+20$ by $(x+4)$

\pause

\textbf{Solution:} \pause


\begin{tabular}{cccccccccc}
    &     &                          &                      &                   & $\onslide<5->{3x^2}$  &     &      &     &      \\ \cline{4-10} 
$x$ & $+$ & \multicolumn{1}{c|}{$4$} & $3x^3$               & $+$               & $12x^2$               & $+$ & $5x$ & $+$ & $20$ \\
    &     & $\onslide<9->{(-)}$      & $\onslide<6->{3x^3}$ & $\onslide<7->{+}$ & $\onslide<8->{12x^2}$ &     &      &     &      \\ \cline{4-10}
    &     &                          &                      &                   &                       &     &      &     &      \\
    &     &                          &                      &                   &                       &     &      &     &      \\ 
    &     &                          &                      &                   &                       &     &      &     &     
\end{tabular}

   

\end{varexampleblock}

\end{frame}

\end{document}

答案1

快速破解:

\documentclass[14pt]{beamer} 
\usepackage{etex}
\usetheme{moloch}% modern fork of the metropolis theme
\usepackage{adjustbox}
\usepackage{tikz}
\usepackage{tikz-cd}
\usepackage{polynom}
\usepackage{colortbl}

\usepackage{pgffor,calc}

\newlength\boxwidth
\newlength\boxheight


\newenvironment<>{varexampleblock}[2][1.0\textwidth]{%
    \setlength{\textwidth}{#1}%
    \setlength{\linewidth}{\textwidth}%
  \begin{actionenv}#3%
    \def\insertblocktitle{#2}%
    \par%
    \setbeamercolor{local structure}{parent=example text}%
    \usebeamertemplate{block example begin}}
  {\par%
  \usebeamertemplate{block example end}%
    \end{actionenv}}


\newcommand\scalemath[2]{\scalebox{#1}{\mbox{\ensuremath{\displaystyle #2}}}}

\title{Polynomial Long Division}
\date{}


\begin{document}

{   
    \setbeamerfont{frametitle}{size=\small}

\begin{frame}[shrink = 20]
\frametitle{Polynomial Long Division} \pause

\begin{varexampleblock}[20cm]{Example} 

\vspace{0.25cm}

Divide $3x^3+12x^2+5x+20$ by $(x+4)$

\pause

\textbf{Solution:} \pause


\begin{tabular}{cccccccccc}
    &     &                          &                      &                   & $\onslide<5->{3x^2}$  &     &      &     &      \\ \cline{4-10} 
$x$ & $+$ & \multicolumn{1}{c|}{$4$} & $3x^3$               & $+$               & $12x^2$               & $+$ & $5x$ & $+$ & $20$ \\
    &     & $\onslide<9->{(-)}$      & $\onslide<6->{3x^3}$ & $\onslide<7->{+}$ & $\onslide<8->{12x^2}$ &     &      &     &     \visible<10->{ \\ \cline{4-10}}
\end{tabular}

   

\end{varexampleblock}

\end{frame}

\end{document}

enter image description here

相关内容