Guest User

Untitled

a guest
Jan 17th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. documentclass{article}
  2. usepackage{cancel}
  3. usepackage{tikz}
  4. usetikzlibrary{calc,positioning,tikzmark}
  5. tikzset{CancelTo/.is family,
  6. CancelTo,
  7. angle/.initial=60,
  8. name/.initial=tmp,
  9. node/.style={},
  10. arrow/.style={->},
  11. topoffs/.initial=2pt,
  12. nodeaboveoffs/.initial=1pt,
  13. nodeleftoffs/.initial=0pt
  14. }
  15. newcommand{CancelTo}[3][]{bgrouptikzset{CancelTo/.cd,#1}
  16. tikzmarknode{pgfkeysvalueof{/tikz/CancelTo/name}}{#3}
  17. begin{tikzpicture}[overlay,remember picture]
  18. 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})}
  19. in ([xshift=-n1]pgfkeysvalueof{/tikz/CancelTo/name}.south) -- ++ (pgfkeysvalueof{/tikz/CancelTo/angle}:n2+pgfkeysvalueof{/tikz/CancelTo/topoffs})
  20. node[above left=pgfkeysvalueof{/tikz/CancelTo/nodeaboveoffs} and pgfkeysvalueof{/tikz/CancelTo/nodeleftoffs},inner sep=0pt,font=scriptsize,/tikz/CancelTo/node] (tmplabel) {#2};
  21. path let p1=($(tmplabel.north east)-(pgfkeysvalueof{/tikz/CancelTo/name}.east)$) in
  22. pgfextra{xdefmydist{x1}};
  23. end{tikzpicture}egroupvphantom{cancelto{#2}{#3}}hspace{mydist}}
  24. newcommand{pd}[2]{frac{partial #1}{partial #2}}
  25. begin{document}
  26. textbf{Problem 1 (``narrow" term):}
  27. With zero offset:
  28. begin{equation}
  29. CancelTo[nodeleftoffs=0pt]{ignore}{pd{f}{x}} +
  30. pd{g}{y} = 0
  31. end{equation}
  32. With offset of $-11$pt:
  33. begin{equation}
  34. CancelTo[nodeleftoffs=-11pt]{ignore}{pd{f}{x}} +
  35. pd{g}{y} = 0
  36. end{equation}
  37. What I would like to get (spacing between first fraction and $+$ unaffected):
  38. begin{equation}
  39. CancelTo[nodeleftoffs=-11pt]{ignore}{pd{f}{x}} !!!!!! +
  40. pd{g}{y} = 0
  41. end{equation}
  42. textbf{Problem 2 (``wide" term):}
  43. Equation without arrow:
  44. begin{equation}
  45. (a+b)pd{f}{x} + pd{g}{y} = 0
  46. end{equation}
  47. Equation with arrow and zero offset:
  48. begin{equation}
  49. CancelTo[nodeleftoffs=0pt]{ignore}{(a+b)pd{f}{x}} +
  50. pd{g}{y} = 0
  51. end{equation}
  52. What I would like to get (spacing between first fraction and $+$ unaffected):
  53. begin{equation}
  54. CancelTo[nodeleftoffs=-11pt]{ignore}{(a+b)pd{f}{x}} ;, +
  55. pd{g}{y} = 0
  56. end{equation}
  57. end{document}
Add Comment
Please, Sign In to add comment