3

I want to cross out sentences and equations. I used the solution given in Cross out words with overlapping to nearby words

\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}

But it throws exception:

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.

3 Answers 3

2

Why not using 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}

enter image description here

1

It is not so easy to put align into boxes (you essentially have to use a minipage), so tcolorbox has a key for the AMS environments. In your case, one can use ams align* lower. Of course, one needs to remove the separator with lower separated=false. I also switched to \begin{tcolorbox}...\end{tcolorbox} instead of \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}

enter image description here

3
  • Can I put text after the equations?
    – Gqqnbig
    Commented Nov 24, 2019 at 7:40
  • @Gqqnbig I do not think that this is possible out of the box. You could use e.g. aligned instead of align.
    – user194703
    Commented Nov 24, 2019 at 11:03
  • @Gqqnbig However, if you only want to cross out some text with some align environment, this can be achieved much easier, you do not need tcolorbox for that. You can also just use a minipage but will of course lose breakable then.
    – user194703
    Commented Nov 24, 2019 at 11:43
1

Obtaining what you want with pstricks is easy:

\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} 

enter image description here

7
  • This doesn't solve the problem regarding tcolorbox, does it? Crossing out some stuff can be achieve in multiple ways without forcing the OP to compile with -shell-escape or xelatex.
    – user194703
    Commented Nov 24, 2019 at 11:49
  • It doesn't indeed, and I didn't claim so. I just wanted to show the *result * could be obtained with a short code.
    – Bernard
    Commented Nov 24, 2019 at 11:54
  • The OP has a breakable in their box, and some text above the equation. Does your short code also allow one to have the thing break over two or more pages?
    – user194703
    Commented Nov 24, 2019 at 12:05
  • If it is put inside the \tcolorbox, I guess so, provided the crossed out equation is not broken, of course (not tested).
    – Bernard
    Commented Nov 24, 2019 at 12:08
  • 1
    The OP crosses out the whole box, not just the equation.
    – user194703
    Commented Nov 24, 2019 at 12:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .