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

  • These question is a duplicate of tex.stackexchange.com/q/14385/138900 are you agree with that ? – AndréC Aug 17 at 9:53
  • These question is too a duplicate of tex.stackexchange.com/q/218372/138900 are you agree with that ? – AndréC Aug 17 at 9:54
  • related: tex.stackexchange.com/q/234535/138900 – AndréC Aug 17 at 9: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 at 9: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 at 9:59
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

  • possible and even that simple! thank you – PeptideChain Aug 17 at 9:05
  • 1
    Are you a schrodinger's marmot? – Artificial Stupidity Aug 17 at 9:38
  • @MoneyOrientedProgrammer So you want to know why Schrödinger's equation was written down/invented in an Alpine hut? I think mankind is not yet ready for that. – Schrödinger's cat Aug 17 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.