Spacing – Best Practices for Fractions and Roots

best practicesspacing

My problem is that I am about to write a longer mathematical text, and it will be filled with integrals. Integrals tend to be filled with pesky fractions, square roots and what not.

Personally I feel like LaTeX is spacing things "wrongly" I prefer to have more space in my fractions, and a tad more space after the square roots. Look at the comparison below. The difference is small, but noticable.

How it normally looks

enter image description here

How I prefer it to look

enter image description here

My question is that, I think doing these small fixes manually is bad. So my question is

Should I avoid doing it? I mean is it "wrong"?

And if not, is there a more automatic solution to this?

(Right now I am merely putting in some space after the roots. like \, )

Here is a smaller MWE, I think the right side looks better than the left.

\documentclass[10pt,a4paper]{minimal}
\usepackage{mathtools}

\begin{document}

\begin{align*}
\int \frac{1+x^2}{1+x^4} \mathrm{d}x \qquad & \text{versus} \qquad \int \frac{\,1+x^2\,}{\,1+x^4\,}\, \mathrm{d}x\\
\int_1^\infty \frac{\mathrm{d}x}{x\sqrt{-1+\sqrt[n]{x}}} \qquad  & \text{versus} \qquad \int_1^\infty \frac{\mathrm{d}x}{\,x\sqrt{-1+\sqrt[n]{x}\,}\,} 
\end{align*}

\end{document}

Best Answer

You could renew the \sqrt command to put the space in automatically.

Renewing the \sqrt command is a little tricky because it takes an optional argument. Luckily it has been demonstrated in

"Closed" (square) root symbol

Here's a screenshot of the result

enter image description here

In the MWE below, you'll see that I have \renewcommanded the \sqrt command to be itself, but with a space immediately following it using \, The subtleties involved are described in detail in the linked post.

\documentclass{article}

\usepackage{letltxmacro}
\LetLtxMacro{\oldsqrt}{\sqrt}
\renewcommand{\sqrt}[2][]{\oldsqrt[#1]{#2}\,}


\begin{document}
OLD
\[
   \int\oldsqrt{x}\mathrm{d}x
\]  

NEW
\[
   \int\sqrt{x}\mathrm{d}x
\]  
\end{document}

I think that in the context of your particular document, you might want the option to define a separate 'spaced square root symbol' so that you don't affect all of the \sqrt. You could achieve this using

\newcommand{\ssqrt}[2][]{\oldsqrt[#1]{#2}\,}

and, of course, you can name it anything you like- I used \ssqrt to stand for 'spaced square root'.