如何在 tcbox 中放置 \begin{align}?

如何在 tcbox 中放置 \begin{align}?

我想划掉句子和方程式。我使用了划掉与相邻单词重叠的单词

\documentclass{article}\usepackage{xcolor} \usepackage[most]{tcolorbox}

\tikzset{crossout/.style={thick,red,shorten >=-.5cm,shorten <=-.5cm}}

\begin{document}

\tcbox[tcbox raise base,
breakable,nobeforeafter, enhanced jigsaw, opacityback=0, sharp corners, parbox=false, boxrule=0pt, top=0pt,bottom=0pt,left=0pt,right=0pt, boxsep=0pt, frame hidden, parbox=false, 
  finish={\draw[crossout] (frame.south west)--(frame.north east);\draw[crossout] (frame.south east)--(frame.north west);}]{

  Therefore we have

  \begin{align*}
(t=1, m=[0], s=(2,2)) \otimes (t=1, m=[0], s=(4,4)) &= (1, [0,2], (4,4)) \\
(t=3, m=[0], s=(4,4)) \otimes (t=3, m=[0], s=(5,5)) &= (3, [0,4], (5,5)) \\
\end{align*}

}

\end{document}

但它引发异常:

Missing \endgroup inserted.

<inserted text> 
                \endgroup 
l.18 }

I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

 name.tex, line 18
Missing } inserted.

<inserted text> 
                }
l.18 }

I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

 name.tex, line 18
LaTeX Error: \begin{document} ended by \end{align*}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.18 }

Your command was ignored.
Type  I <command> <return>  to replace it with another command,
or  <return>  to continue without it.

答案1

为什么不使用tcolorbox

\documentclass{article}
\usepackage{xcolor}
\usepackage[most]{tcolorbox}

\tikzset{crossout/.style={thick,red,shorten >=-.5cm,shorten <=-.5cm}}

\begin{document}

\begin{tcolorbox}[
  breakable,
  nobeforeafter,
  enhanced jigsaw,
  opacityback=0,
  sharp corners,
  parbox=false,
  boxrule=0pt,
  top=0pt,
  bottom=0pt,
  left=0pt,
  right=0pt,
  boxsep=0pt,
  frame hidden,
  finish={
    \draw[crossout] (frame.south west)--(frame.north east);
    \draw[crossout] (frame.south east)--(frame.north west);
  }
]
Therefore we have
\begin{align*}
(t=1, m=[0], s=(2,2)) \otimes (t=1, m=[0], s=(4,4)) &= (1, [0,2], (4,4)) \\
(t=3, m=[0], s=(4,4)) \otimes (t=3, m=[0], s=(5,5)) &= (3, [0,4], (5,5))
\end{align*}
Be careful not to do this.
\end{tcolorbox}

\end{document}

在此处输入图片描述

答案2

将对齐放入框中并不容易(您基本上必须使用 minipage),因此tcolorbox有一个用于 AMS 环境的键。对于您的情况,可以使用ams align* lower。当然,需要使用 删除分隔符lower separated=false。我还改用\begin{tcolorbox}...\end{tcolorbox}而不是\tcbox{...}

\documentclass{article}
\usepackage{amsmath} 
\usepackage[most]{tcolorbox}

\tikzset{crossout/.style={thick,red,shorten >=-.5cm,shorten <=-.5cm}}

\begin{document}

\begin{tcolorbox}[tcbox raise base,
breakable,ams align* lower,lower separated=false,
nobeforeafter, enhanced jigsaw, opacityback=0, sharp corners, 
parbox=false,
boxrule=0pt, top=0pt,bottom=0pt,left=0pt,right=0pt, boxsep=0pt, frame hidden,
  finish={\draw[crossout] (frame.south west)--(frame.north east);
  \draw[crossout] (frame.south east)--(frame.north west);}]
  Therefore we have
\tcblower
(t=1, m=[0], s=(2,2)) \otimes (t=1, m=[0], s=(4,4)) &= (1, [0,2], (4,4)) \\
(t=3, m=[0], s=(4,4)) \otimes (t=3, m=[0], s=(5,5)) &= (3, [0,4], (5,5)) \\
\end{tcolorbox}
\end{document}

在此处输入图片描述

答案3

获得你想要的东西pstricks很容易:

\documentclass{article}
\usepackage{amsmath}
\usepackage[most]{tcolorbox}
\usepackage{pst-node, auto-pst-pdf}

\begin{document}

\psDefBoxNodes{E}{\centering%
$ \begin{aligned}
 (t=1, m=[0], s=(2,2)) \otimes (t=1, m=[0], s=(4,4)) &= (1, [0,2], (4,4)) \\
(t=3, m=[0], s=(4,4)) \otimes (t=3, m=[0], s=(5,5)) &= (3, [0,4], (5,5))
\end{aligned} $%
}%
\psset{linecolor=red, nodesep=1.5em}
\ncline{E:tl}{E:br}
\ncline{E:bl}{E:tr}

\end{document} 

在此处输入图片描述

相关内容