Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass{article}
- usepackage{cancel}
- usepackage{tikz}
- usetikzlibrary{calc,positioning,tikzmark}
- tikzset{CancelTo/.is family,
- CancelTo,
- angle/.initial=60,
- name/.initial=tmp,
- node/.style={},
- arrow/.style={->},
- topoffs/.initial=2pt,
- nodeaboveoffs/.initial=1pt,
- nodeleftoffs/.initial=0pt
- }
- newcommand{CancelTo}[3][]{bgrouptikzset{CancelTo/.cd,#1}
- tikzmarknode{pgfkeysvalueof{/tikz/CancelTo/name}}{#3}
- begin{tikzpicture}[overlay,remember picture]
- draw[/tikz/CancelTo/arrow] let p1=($(pgfkeysvalueof{/tikz/CancelTo/name}.north)-(pgfkeysvalueof{/tikz/CancelTo/name}.south)$),n1={0.5*y1*cot(pgfkeysvalueof{/tikz/CancelTo/angle})},n2={y1/sin(pgfkeysvalueof{/tikz/CancelTo/angle})}
- in ([xshift=-n1]pgfkeysvalueof{/tikz/CancelTo/name}.south) -- ++ (pgfkeysvalueof{/tikz/CancelTo/angle}:n2+pgfkeysvalueof{/tikz/CancelTo/topoffs})
- node[above left=pgfkeysvalueof{/tikz/CancelTo/nodeaboveoffs} and pgfkeysvalueof{/tikz/CancelTo/nodeleftoffs},inner sep=0pt,font=scriptsize,/tikz/CancelTo/node] (tmplabel) {#2};
- path let p1=($(tmplabel.north east)-(pgfkeysvalueof{/tikz/CancelTo/name}.east)$) in
- pgfextra{xdefmydist{x1}};
- end{tikzpicture}egroupvphantom{cancelto{#2}{#3}}hspace{mydist}}
- newcommand{pd}[2]{frac{partial #1}{partial #2}}
- begin{document}
- textbf{Problem 1 (``narrow" term):}
- With zero offset:
- begin{equation}
- CancelTo[nodeleftoffs=0pt]{ignore}{pd{f}{x}} +
- pd{g}{y} = 0
- end{equation}
- With offset of $-11$pt:
- begin{equation}
- CancelTo[nodeleftoffs=-11pt]{ignore}{pd{f}{x}} +
- pd{g}{y} = 0
- end{equation}
- What I would like to get (spacing between first fraction and $+$ unaffected):
- begin{equation}
- CancelTo[nodeleftoffs=-11pt]{ignore}{pd{f}{x}} !!!!!! +
- pd{g}{y} = 0
- end{equation}
- textbf{Problem 2 (``wide" term):}
- Equation without arrow:
- begin{equation}
- (a+b)pd{f}{x} + pd{g}{y} = 0
- end{equation}
- Equation with arrow and zero offset:
- begin{equation}
- CancelTo[nodeleftoffs=0pt]{ignore}{(a+b)pd{f}{x}} +
- pd{g}{y} = 0
- end{equation}
- What I would like to get (spacing between first fraction and $+$ unaffected):
- begin{equation}
- CancelTo[nodeleftoffs=-11pt]{ignore}{(a+b)pd{f}{x}} ;, +
- pd{g}{y} = 0
- end{equation}
- end{document}
Add Comment
Please, Sign In to add comment