4

I'm trying to type up my homework, and I can't seem to figure out how to insert a blank horizontal space in this integral like my professor did...

His:

enter image description here

Mine:

enter image description here

I'm using

 $$\iint_S \left(\nabla \times \vec{F}\right) \cdot \vec{n} d\sigma,$$

Thanks for your help.

AboAmmar
  • 46,352
  • 4
  • 58
  • 127
jbrow35
  • 373

2 Answers2

5

You have a good eye for the details! So let's look at them more carefully.

\documentclass{article}
\usepackage{amsmath}

\renewcommand{\vec}[1]{\mathbf{#1}}
\newcommand{\diff}{\mathop{}\!d}

\begin{document}

\begin{align}
\text{Attempt 1}\qquad&
%
  \iint_S \left(\nabla \times \vec{F}\right) \cdot \vec{n} d\sigma
%
\\
\text{Attempt 2}\qquad&
%
  \iint_S \left(\nabla \times \vec{F}\right) \cdot \vec{n}\,d\sigma
%
\\
\text{Attempt 3}\qquad&
%
  \iint_S (\nabla \times \vec{F}) \cdot \vec{n}\,d\sigma
%
\\
\text{Attempt 4}\qquad&
%
  \iint_S (\nabla \times \vec{F}) \cdot \vec{n}\diff\sigma
%
\\
\text{Check}\qquad& \frac{d\vec{F}}{dt}\\
\text{Check}\qquad& \frac{\diff\vec{F}}{\diff t}
\end{align}

\end{document}

enter image description here

Attempt 1 is your original code; attempt 2 has the suggested \,.

Can you spot the difference with attempt 3? Look at the centered dot: in attempt 2 it is not midway from the operands. Why is that? Note I removed \left and \right, which should not generally be used.

Attempt 4 uses \diff\sigma instead of \,d\sigma. This is better not only because you won't forget \,, but also because it allows to change all of your italic “d” for the differential into an upright one, should the need arise, by just modifying the definition.


Added notes

The last two lines are just for ensuring \diff doesn't add unwanted spaces in other situations: the two fractions are exactly the same.

Using \renewcommand{\vec}[1]{\mathbf{#1}} falls under the same category and is correct. However, one has always to be careful when doing \renewcommand.

Don't use $$ in LaTeX under any circumstances, see Why is \[ ... \] preferable to $$ ... $$?

egreg
  • 1,121,712
3

You can use this code, borrowed from an answer on this site (I don't remember which one):

\documentclass[12pt,a4paper]{article}
\usepackage{mathtools}
\newcommand*{\dd}{\mathop{\kern0pt\mathrm{d}}\!{}}

\begin{document}

\[ \iint_S (\nabla \times \mathbf{F}) \cdot \mathbf{n} \dd\sigma \]%

\end{document} 

Note: Don't use $$ … $$ for displayed equations. It's plain TeX syntax, and it can give bad spacings. Use \[ … \] instead. enter image description here

Bernard
  • 271,350
  • 1
    \mathop{}\!d seems easier; with \mathrm or not, according to one's preferences. As you see, the OP has an italic d. – egreg May 05 '17 at 07:03
  • @Bernard Very compliments for your reputations of 100k. Hi. – Sebastiano May 05 '17 at 07:30
  • @Sebastiano: Thanks a lot! This is a very warm site (which is not the case of all Stack Exchange sites!) – Bernard May 05 '17 at 10:26
  • @Bernard I think this TEX.SE site is a big family and we have to help one another without envy. And +1 for your answer. – Sebastiano May 05 '17 at 20:59