7

For my numerical analysis class, we use a certain symbol to represent the floating point square root operation (similar to using \ominus for floating point subtraction, \oplus for floating point addition, etc.). In order to render this in a LaTeX document, I'd need to somehow draw a similarly-sized circle over the "v" part of the square root symbol, but I'm not too familiar with tikz and don't really know how to start working on this.

The most important aspect is making sure the circle has the same size as the one for the \oxxxx symbols. How would I go about making this? (And potentially, is there a better, more standard way to denote this operation?)

Picture

This is the best drawing I could make of what I'm looking for

Edit

Added a picture to make what I'm asking for a tiny bit clearer.

Peiffap
  • 292
  • First, look at the Comprehensive LaTeX Symbol List (https://ctan.org/pkg/comprehensive?lang=en). Could you scan and post an image as part of your question? – John Kormylo Nov 21 '18 at 21:16
  • The symbol is not in the Symbol List sadly, I already checked before posting, hence the softer part of my question asking about the more standard notation for this. – Peiffap Nov 21 '18 at 21:21
  • do you need it to work like \sqrt growing in size and with an extending bar while still having the circle, or simpler case of just needing a fixed – David Carlisle Nov 21 '18 at 21:23
  • @DavidCarlisle Ideally, it would work like \sqrt, while having the circle grow in a way similar to how the circle gets bigger when going from \oplus to bigoplus. The last part, about the circle growing, is purely aesthetic (but would still be greatly appreciated), the bar growing is a requirement. – Peiffap Nov 21 '18 at 21:26
  • I've never seen this notation (nor use of ominus/oplus for that use) here it's probably easy if you find a tikz implementation of sqrt to add a circle, harder to "just" add a circle to a standard sqrt as there the stretching is under the control of the font metrics and tex macro layer doesn't really have a handle on what size sqrt is being used and whether it has a sloping or vertical left bar or where to put the circle... – David Carlisle Nov 21 '18 at 21:28
  • Concerning the symbols' correctness, it's the notation used in Trefethen and Bau's Numerical Linear Algebra, which is the textbook we're using for our introductory numerical analysis class. It makes sense for an introductory book to distinguish between floating point operations and exact operations like this, and the circled square root seems like a reasonable continuation of that notation. As for finding a tikz implementation of sqrt, I can look into that, but I'm fairly (read: very) shaky on these kinds of slightly more advanced macro's, so I don't really know how or where to start... – Peiffap Nov 21 '18 at 21:36
  • 1
    If you really want a “custom” root sign that behaves exactly as the original, that is, that grows automatically with the size of the subformula it covers, I think that, all things considered, the simplest solution is to use a virtual font. I haven’t got time to write an answer now, but I can suggest this example of a similar problem which I solved by means of this technique; that answer contain further links that you might find useful. – GuM Nov 21 '18 at 22:25
  • @GuM that answer is quite amazing in its thoroughness, but I don't think it matters that much; I already have a tendency to focus on notation too much when working with LaTeX, and I don't think it's worth it for a symbol I'll use once or twice maybe. Thanks for the link though, it's great to see the effort some people put into helping others! ;-) – Peiffap Nov 21 '18 at 22:29

2 Answers2

9

I can offer this one, but don't try it with big arguments to the square root such as fractions.

\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}

\newcommand{\fpsqrt}[1]{%
  \sqrt[\leftroot{-5}\uproot{-7}\scalebox{0.7}{$\bigcirc$}]{\mathstrut#1}%
}

\begin{document}

\[
\fpsqrt{120}
\]

\end{document}

enter image description here

egreg
  • 1,121,712
4

This is really just for fun (and because this is tagged TikZ). An attempt to adapt the shape of the circle to the dimensions of the square root. The idea is to use a path picture to find out what the dimensions of the square root are. Luckily tikzmark has the cool feature of detecting the mode we are in, so we do not have to worry about this here.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark,calc}
\newcounter{stuff}
\tikzset{oroot/.style={path picture={\draw
let \p1=($(path picture bounding box.north)-(path picture bounding box.south)$) in (path picture bounding box.west)
arc(180:-180:{0.25em+\y1/10} and \y1/3);}}}
\begin{document}
abc  $\tikzmarknode[oroot]{1}{\sqrt{a+b}}$
\[\tikzmarknode[oroot]{2}{\sqrt{\frac{\frac{1}{12}}{\frac{a}{b}}}}\]
\end{document}

enter image description here