Using the package microtype by including the line
\usepackage{microtype}
in the preamble subtly alters the appearance of a typeset document by, amongst other things, letting optically less dense characters, like dashes or punctuations, protrude slightly in the margins. When I use a mathematical minus sign in a document written in the class article, I write it like this:
$-$
If I include \usepackage{lmodern} in the preamble, the minus sign does not get moved out a little bit if it happens to become the first character of a line, but stays at the same horizontal position as for example an "m" letter. Microtype does work for the plus sign and dashes, including when the plus sign is written in math mode:
$+$
Does anyone know how to enable microtype also for the mathematical minus sign when using lmodern?
When not using lmodern, the problem can be fixed as suggested by Mico by using \usepackage[protrusion=allmath]{microtype}.
edit: MWE, for which the fix to use \usepackage[protrusion=allmath]{microtype} does not work.
Here is some example code that generates the incorrectly placed mathematical minus sign:
\documentclass{article}
\usepackage{lmodern}
\usepackage[protrusion=allmath]{microtype}
\begin{document}
\section{Test Section}
\label{Test Label}
Test text to reproduce the microtype mathematical minus sign problem that I experienced. I am putting in a few more words to get some text to demonstrate the effect. This is just some text with mathematical minusaaaaaaaaaaaa signs $-$inserted (that was a mathematical minus sign in front of ``inserted'')aaaaa. A +plus sign looks like that. In a longer text that I had, the plus sign looked fine, but the minus sign clearly looked like it was to far in. I am now putting in some more text, just to get one more line to show the look of the left margin.
\end{document}
Compiled result (first an enlargement to show the left margin, and then the entire page):
protrusion=allmath
option tomicrotype
?microtype
manual, protrusion should be enabled for all of the "main" math font packages (Computer Modern (obviously), mathptmx, mathpazo, eulervm, and probably a few more). Please consider editing your question to include a standalone MWE (minimum working example) that generates the problem behavior you're trying to correct.protrusion=allmath
does solve the problem for your MWE. It still doesn't make sense that+
and-
are treated differently without theallmath
option. (Ping, @Mico.)