2

I tried to define (my first! - I'm a LateX newbie) command to insert notes in the margins of my text, but it introduces gaps wherever I insert the command :-( The code for my command is:

\newcommand{\mnote}[1]
{
  \mbox{}\marginnote{\color{red}\footnotesize#1}
}

And I use it for example like this:

\subsection{Differentiable Manifold}
\mnote{This is the central object in differential geometry.}A differentiable manifold is

but lo and behold, this has the unpleasant effect of adding white space before the letter of the paragraph:

The initial "A" is no longer properly aligned

How can I restore proper alignment for the initial letter of the paragraph?

lockstep
  • 250,273
Frank
  • 177
  • Hmm - it looks like I might have found the answer: starting \mbox on a new line after { seems to be the culprit in the definition of the command... Is that correct? – Frank Jan 05 '15 at 03:05
  • Yep. Try {% - newline and #1}% - newline. That is, use comment signs at the ends of newlines where you don't want spaces. A newline is a space to TeX. Like a blank line is a new paragraph. – cfr Jan 05 '15 at 03:41
  • @egreg As a "duplicate" we denominate a question, which has been asked before. You are expanding the term to questions, which have the same answer. – Keks Dose Jan 05 '15 at 11:40

1 Answers1

4

Try

\newcommand{\mnote}[1]
{%
  \mbox{}\marginnote{\color{red}\footnotesize#1}%
}

TeX reads a newline as a space, just as it reads a blank line as a paragraph break. Using a comment sign (%) removes the newline/space, as far as TeX is concerned, while still allowing you to format the source code in a way which is easy to read.

cfr
  • 198,882