Best practices for spacing regarding fractions and roots?
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
In the MWE below, you'll see that I have \renewcommand
ed 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'.
The issue of inserting a bit of space every time the "differential operator" d
is used is best addressed by defining a new operator, say \dee
, that leaves the required amount of whitespace before the operator and typesets the operator in upright ("roman") font. For instance, you could define
\newcommand{\dee}{\operatorname{d}\!}
in the preamble, and then use it from now on every time you are referring to a d
that's a differential.
If you have no need for the Icelandic-d that's generated by LaTeX with the command \d
, you could alternatively define, i.e., if you'd like to type \d
to generate the differential operator "d", you could use the following definition:
\renewcommand{\d}{\operatorname{d}\!}
As @JimHefferon has pointed out in a comment, a slight spacing adjustment is required for typesetting inline math expressions such as dy/dx
(with both d
s set in upright mode). For this particular term, one would write (using the second definition above):
$\d y/\!\d x$
where the instruction \!
instructs TeX to insert a "negative thin space," thereby undoing the "positive thin space" that's inserted by the operator \d
.