I need to strike out terms in equations. Based on the answers to this question, I've tried the cancel package, but the appearance of the resulting output does not convince me. Consider this example:
\documentclass{article}
\usepackage{cancel}
\newcommand{\pd}[2]{\frac{\partial #1}{\partial #2}}
\begin{document}
\begin{equation}
\cancelto{\mathrm{ignored}}{\pd{f}{x}}
+ \cancelto{\mathrm{ignored}}{\pd{g}{y}} + \pd{h}{z}
\end{equation}
\end{document}
This gives the following output:
If I use the package option makeroom, I get:
This is obviously unsatisfactory. What I would like to be able to do:
- Arrow shapes consistent with those used by TikZ.
- Arrow that are parallel (I would imagine this is difficult to do, so I would be happy to specify the angles manually).
- Ability to specify the anchor of the text at the arrow tip (so that the text could be anchored at the bottom center or bottom right, for example).
- Ability to specify the font size of the text near the arrow tip (which I don't seem to be able to do with
\cancelto). - Automatically add space between the terms similar to what
makeroomdoes (nice to have, but not essential if I can change the font) size because I can fine-tune the spacing if necessary).
Thanks for your help.



ygoes below the baseline whereasxdoes not. Would it be acceptable to just insert a\vphantom{y}in the derivatives w.r.t.x? One way to achieve this is to use\newcommand{\pd}[2]{\frac{\partial #1\vphantom{y}}{\partial #2\vphantom{y}}}. – Jan 14 '19 at 12:19\n2={\y1/sin(60), shouldn't you also use\pgfkeysvalueof{/tikz/CancelTo/angle}? – user1362373 Jan 17 '19 at 06:01\tikzmarknode{\pgfkeysvalueof{/tikz/CancelTo/name}}{#3}, I assume you're assigning the value of the third argument to the angle. But in that case, why doesn't it say/tikz/CancelTo/angle? (I'm asking because I'm trying to add further optional arguments to fine-tune the spacing, but failing miserably, so I'm trying to understand the details of what you've done.) – user1362373 Jan 17 '19 at 06:18\pgfkeysvalueof{/tikz/CancelTo/name}yields the name of the shape. Nodes must have names. By default, all nodes get the name unless you say otherwise. You can add additional keys under\tikzset{CancelTo/.is family, CancelTo, ..., which may help to fine-tune. – Jan 17 '19 at 06:22[3], which I thought indicated the first optional argument, is actually immaterial as far as me adding additional options is concerned. It seems that I can just name the option undertikzsetand then add it in the[]after\CancelTocommand, at least that seems to work. – user1362373 Jan 17 '19 at 08:34[3]is the number of arguments.[]indicates that the first one is an option, and the default is empty. So the syntax is\CancelTo[<pgf keys>]{<text at the end of arrow>}{<object that is to be canceled>}. – Jan 17 '19 at 15:30