3

How difficult is it to enhance (=copy the code of the package in my project and adapt it) the Cancel package, Cancel package, with a command \cancelno{〈label〉}{〈expression〉} such that

  • a slash is put on the underlying 〈expression〉 as by \cancel
  • no arrow
  • the number/text 〈label〉 is put on top of 〈expression〉 in the middle

the goal is to describe which term cancel with which term, this is useful if one has lets say 16 terms each cancelling with each other.

I think that the command \cancelto of the package should be a good model.

In the following MEW one should replace \cancelto with \cancelno and obtain the desired result.

\documentclass{article}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{cancel}
\begin{document}
\section{Something}

\begin{align*}
\left(\begin{bmatrix}a\\b\\c\end{bmatrix}
\times
\begin{bmatrix}x\\y\\z\end{bmatrix}\right)
\cdot\begin{bmatrix}a\\b\\c\end{bmatrix}
&=\begin{bmatrix}bz-cy\\cx-az\\ay-bx\end{bmatrix}
\cdot\begin{bmatrix}a\\b\\c\end{bmatrix}\\
&=\cancelto{1}{bza}-\cancelto{2}{cya}+\cancelto{3}{cxb}
-\cancelto{1}{azb}+\cancelto{2}{ayc}-\cancelto{3}{bxc}
\end{align*}

\end{document}

enter image description here

PeptideChain
  • 1,335
  • These question is a duplicate of https://tex.stackexchange.com/q/14385/138900 are you agree with that ? – AndréC Aug 17 '19 at 09:53
  • These question is too a duplicate of https://tex.stackexchange.com/q/218372/138900 are you agree with that ? – AndréC Aug 17 '19 at 09:54
  • related: https://tex.stackexchange.com/q/234535/138900 – AndréC Aug 17 '19 at 09:55
  • 1
    @AndréC The other question is about changing the format of the arrow (downwards instead of upwards) in case of expression that are replaced by a value. This question in another concept: I want to visualize which terms get canceled with which terms (that is, a grouping of the terms that cancel with each other) – PeptideChain Aug 17 '19 at 09:56
  • 1
    @AndréC also the other two have to do with layout and not with meaning. The arrow in my case would be misleading since I want to group the terms and not replace them. – PeptideChain Aug 17 '19 at 09:59

1 Answers1

5

Presumably it is possible.

\documentclass{article}
\usepackage{amsmath}
\usepackage{cancel}
\newcommand{\mycancel}[2]{\overset{#1}{\cancel{#2}}}
\begin{document}
\section{Something}

\begin{align*}
\left(\begin{bmatrix}a\\b\\c\end{bmatrix}
\times
\begin{bmatrix}x\\y\\z\end{bmatrix}\right)
\cdot\begin{bmatrix}a\\b\\c\end{bmatrix}
&=\begin{bmatrix}bz-cy\\cx-az\\ay-bx\end{bmatrix}
\cdot\begin{bmatrix}a\\b\\c\end{bmatrix}\\
&=\mycancel{1}{bza}-\mycancel{2}{cya}+\mycancel{3}{cxb}
-\mycancel{1}{azb}+\mycancel{2}{ayc}-\mycancel{3}{bxc}
\end{align*}
\end{document}

enter image description here