2

I am trying to strikeout an entire flalign block. This post shows how to strikeout an aligned block using the cancel package, but I'm not able to get it to work for the flalign environment. Any ideas how to get this to work without using tikz?

\documentclass{article}
\usepackage{amsmath}
\usepackage[makeroom]{cancel}

\begin{document}
\begin{equation*}
    \cancel{
        \begin{aligned}
        f(x) &= \sin(x) \\
        g(x) &= \cos(x)
    \end{aligned}
}
\end{equation*}
I want to strikeout this:
\begin{flalign*}
    f(x) &= \sin(x) && \\
    g(x) &= \cos(x) &&
\end{flalign*}
\end{document}

2 Answers 2

2

You can easily define a left-aligned equation environment and then use the method with the nested aligned.

\documentclass{article}
\usepackage{amsmath}
\usepackage[makeroom]{cancel}

% https://tex.stackexchange.com/a/148854
\makeatletter

\newenvironment{flequation}
  {\@fleqntrue\begin{equation}}
  {\end{equation}\@fleqnfalse}
\newenvironment{flequation*}
  {\@fleqntrue\begin{equation*}}
  {\end{equation*}\@fleqnfalse}

\makeatother

\begin{document}

Some text
\begin{flequation*}
  \cancel{
    \begin{aligned}
      f(x) &= \sin(x) \\
      g(x) &= \cos(x)
    \end{aligned}
  }
\end{flequation*}
More text

\end{document}

enter image description here

11
  • @marmot Why? Your post is not wrong. Or are you thinking of this? Commented Apr 28, 2018 at 3:56
  • No, I really think your answer is better. And no, I did not think of this. The purpose of this site is to provide users with very good solutions, and mine is clearly worse than yours, so there is no reason to keep it.
    – user121799
    Commented Apr 28, 2018 at 4:00
  • @marmot I ended up using the minipage solution. I don't have a good reason, but I don't care for \makeatletter. @HenriMenke The post on beginners accepting poor answer choices was interesting. I have been writing LaTeX for a while, but I feel that there is so much I don't know. I was looking something up in Lamport's LaTeX book a while back, and was surprised to find that I have not been using periods correctly in some situations.
    – Jeff
    Commented Apr 28, 2018 at 20:46
  • @Jeff I undeleted my answer but think that you should not accept it since Henri's solution is probably better for the majority of users.
    – user121799
    Commented Apr 28, 2018 at 23:26
  • @Jeff Do I understand this correctly, that you didn't use my answer because it has \makeatletter? If this is such a blocker for you, I can rewrite my answer without it. Commented Apr 28, 2018 at 23:56
1

One option is to put it in a minipage and strike this out.

\documentclass{article}
\usepackage{amsmath}
\usepackage[makeroom]{cancel}

\begin{document}
\begin{equation*}
    \cancel{
        \begin{aligned}
        f(x) &= \sin(x) \\
        g(x) &= \cos(x)
    \end{aligned}
}
\end{equation*}
I want to strikeout this:\\
\xcancel{\begin{minipage}{2cm}~\\[-2\baselineskip]
\begin{flalign*}
    f(x) &= \sin(x) && \\
    g(x) &= \cos(x) &&
\end{flalign*}
\end{minipage}}
\end{document}

enter image description here

The downside of this is that you have to hard code the width of the minipage. You could cure this with a more complicated macro of by using TikZ.

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\newcommand{\tikznode}[3][]{\tikz[remember
picture,baseline=(#2.base)]{\node(#2)[inner sep=0pt,#1]{#3};}}
\begin{document}
\begin{flalign*}
    \tikznode{lt}{\strut}f(x) &= \sin(x) && \\
    g(x) &= \cos(x)\tikznode{br}{\strut} &&
\end{flalign*}
\tikz[overlay,remember picture]{\draw (lt.north) -- (br.south);}
\end{document}

enter image description here

Yet this might be an overkill.

3
  • I'm not a big fan of \tikzmark because unexpected things happen when you have a pagebreak in the middle of your overlay. The \cancel{\begin{aligned}...\end{aligned}} solution looks sane however. (Maybe harmonize your indentation) Commented Apr 28, 2018 at 3:36
  • @HenriMenke I agree with your concern. Yet I don't understand what you precisely mean by indentation. Note that the \cancel{\begin{aligned}...\end{aligned}} is from the OP, and the user uses flalign.
    – user121799
    Commented Apr 28, 2018 at 3:42
  • Sorry, I realised that you just copied from OP after I posted the comment. Commented Apr 28, 2018 at 3:47

You must log in to answer this question.

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