0

I want to use cancel to but with just a line instead of an arrowenter image description here

2 Answers 2

2

Welcome to Tex.SE !

One of many solutions:

\documentclass[varwidth,border=30]{standalone}
\usepackage{tikz}

\tikzset{main node/.style={inner sep=0,outer sep=0},
label node/.style={inner sep=0,outer ysep=.2em,outer xsep=.4em,font=\scriptsize,overlay},
strike out/.style={shorten <=-.2em,shorten >=-.5em,overlay}}

\newcommand{\cancelto}[3][]{\tikz[baseline=(N.base)]{
  \node[main node](N){$#2$};
  \node[label node,#1, anchor=south west] at (N.north east){$#3$};
  \draw[-,#1]  (N.south west) -- (N.north east)}}


\begin{document}
  \cancelto[purple]{Text}{no!}
    and math
  $\cancelto[blue]{x^3}{x^2}$
\end{document}

enter image description here

0

If you just want to remove the arrow tip, you can patch \canto@vector to use \line instead of \vector.

\documentclass{article}
\usepackage{xcolor}
\usepackage[Smaller]{cancel}
\usepackage{xpatch}% to patch \cancel

\makeatletter
\xpatchcmd{\canto@vector}{\vector}{\line}{}{}
\makeatother

\renewcommand{\CancelColor}{\color{green!80!red}}

\begin{document}

\[
\cancelto{x^2}{x^3}
\]

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .