# Nice-looking p-th roots

When I take the pth root, the bottom of the p comes very close to the \sqrt symbol. In the New Century Schoolbook font (which I am using), the p actually intersects the \sqrt symbol, which looks even more terrible. Is there a clean way to fix this?

\documentclass{article}
\usepackage{fouriernc} % use the New Century Schoolbook font
\begin{document}
When I write $a^{(1/p)}$ as $\sqrt[p]{a}$, the bottom of the $p$
touches the top of the root symbol, which looks ugly.
Even when the root symbol is larger, such as with
$\sqrt[p]{\frac{1}{n}}$, it still looks bad
(since the tail of the p almost hits that line).
\end{document}


-

The amsmath package provides commands to tweak the position of the p, this example is from the amsmath documentation:

\sqrt[\leftroot{-2}\uproot{2}\beta]{k}

-
Thanks! Is it wise to / how can I (re-)define the \sqrt command to use these preferences automatically? – jamaicanworm Mar 22 '12 at 23:55
@jamaicanworm you can redfine \sqrt using the method illustrated in best-practices-for-spacing-regarding-fractions-and-roots/ and the linked question within – cmhughes Mar 22 '12 at 23:59
This seems a bit simpler: \let\oldsqrt\sqrt \def\sqrt[#1]{\oldsqrt[\leftroot{-3}\uproot{3}#1]} Are there any disadvantages of this solution compared to the LetLtxMacro one you linked to? Also, in this solution, there is a slight problem: now, if I write sqrt{a} (without the optional [] argument), it gives an error. – jamaicanworm Mar 23 '12 at 0:05
don't use \def to define commands with optional arguments, use \renewcommand\sqrt[2][2]{... so the optional argument defaults to 2. – David Carlisle Mar 23 '12 at 7:13
@DavidCarlisle: As I told jamaicanworm already, it's always nice to have a picture of the result in an answer so that users can evaluate and compare answers without having to compile each one of them. Of course, you, too, will get more upvotes, which are the sole reason we're all here :) – doncherry Mar 23 '12 at 10:07

In line with @DavidCarlisle's suggestion, I also recommend you load the amsmath package and experiment a bit with the \leftroot and \uproot options to the \sqrt macro. Since your root-symbol, p, has a longer lower-right spur and as well as a lower overall height than the \beta symbol does in the example code given in amsmath package's user guide, you may want to use a value of 3 rather than 2 to get a decently balanced formula:

\documentclass{article}
\usepackage{fouriernc,amsmath}
\begin{document}
$\sqrt[p]{a}$ vs.\ $\sqrt[\leftroot{-3}\uproot{3}p]{a}$

$\sqrt[p]{\tfrac{1}{n}}$ vs.\ $\sqrt[\leftroot{-3}\uproot{3}p]{\tfrac{1}{n}}$
\end{document}


Of course, what looks "right" to you will depend importantly on your preferences. Just experiment around to find out what looks best to you.

-

This should be more of a comment (in reply to the OP's comment for David's answer) than answer (I can not break lines in comment).

You can define a new command \mysqrt instead of trying to meddle with the original \sqrt command.

\newcommand*{\mysqrt}[4]{\sqrt[\leftroot{#1}\uproot{#2}#3]{#4}}
$\mysqrt{-2}{2}{\beta}{k}$
$\mysqrt{-3}{3}{\beta}{k}$
$\mysqrt{-2}{6}{\beta}{\frac{k}{h}}$


Advantage: You can change the first two values values on the go and your old \sqrt works without the option [].

-
In this case I would make the first two parameters to \mysqrt optional and default to something that works for most cases, but can be tweaked if so desired. – Peter Grill Mar 23 '12 at 0:29
@jamaicanworm If you do not give values TeX will complain of a missing number that will be treated as zero. Hence you can put zero yourself to avoid that complain. and yes it works except that complaint. – Harish Kumar Mar 23 '12 at 0:32
@jamaicanworm: Since there is more than one parameter that should be optional, I would use the xparse package and the solutions described at LaTeX command with optional arguments – Peter Grill Mar 23 '12 at 0:39
@jamaicanworm: That is not how to use xparse. Using \NewDocumentCommand{\mysqrt}{O{-2} O{2} O{} m}{...} will make #1 default to -2, #2 default to 2, and #3 default to {}. Hope that helps -- if not, this should really be a separate question as it might be useful to others as well. – Peter Grill Mar 23 '12 at 0:56
Version discussed in the comments here is provided at Optional arguments in \def. – Peter Grill Mar 23 '12 at 1:36