0

I need to use the command \dimexpr, but in my machine no have an package for it. My specific objective is write this string:

\newcommand{\cancelraizq}\[1]{
    \sbox0{$ \displaystyle \sqrt{\vphantom{#1^{^\cancel{2}}}}$}
    \cancel{\phantom{\usebox0}\hspace{0.5em}}
    \hspace{\dimexpr(-\wd0-0.5em)}
    \sqrt{#1^{\cancel{2}}}}

to generate this expression: For generate this expretion:

I have the usual packages for example \usepackage{amsmath}, \usepackage{tikz, tkz-euclide},etc, but for \dimexpr I don't know which one to use.

6
  • 2
    Welcome to TeX.SX! There is now also the \dimeval command, if needed (see the LaTeX user manual, section 5 Expandable floating point (and other) calculations).
    – jlab
    Commented Jul 24 at 18:52
  • 2
    It's been built-in to LaTeX since 2017. (And available since the 90s if you're using an eTeX engine) Commented Jul 24 at 18:52
  • 6
    \dimexpr is a primitive and available always. Commented Jul 24 at 19:06
  • 1
    By the way, the cancellation is wrong, unless you assume that x is nonnegative.
    – egreg
    Commented Jul 24 at 20:53
  • 1
    No time to check now but the backslash before [1] is clearly wrong, remove it. It should be \newcommand{\cancelraizq}[1]{...
    – Rmano
    Commented Jul 24 at 21:34

0

You must log in to answer this question.

Browse other questions tagged .