Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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):

Crop of the compiled page

enter image description here

share|improve this question
1  
Have you tried providing the protrusion=allmath option to microtype? –  Mico Jul 16 '12 at 23:27
    
I was not aware of that. I tried it (just now), but unfortunately it did not help. It only rendered several warning about microtype not finding protrusion list for font ... –  hjb981 Jul 17 '12 at 0:06
4  
Aaah, now we're starting to get somewhere: Which (math) fonts do you use? According to the 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. –  Mico Jul 17 '12 at 0:09
1  
Ah, protrusion=allmath does solve the problem for your MWE. It still doesn't make sense that + and - are treated differently without the allmath option. (Ping, @Mico.) –  Hendrik Vogt Jul 17 '12 at 13:51
1  
@hjb981: Please try and remove anything from the preamble that does not contribute to the problem. You could do that by removing things piece by piece (and recompiling of course), or by removing 1. the first half of the preamble (+recompile), 2. the 2nd half of the preamble (+recompile), hoping that with either 1. or 2. the problem persists. Then repeat until you get some MWE. –  Hendrik Vogt Jul 17 '12 at 14:36
show 7 more comments

1 Answer

up vote 11 down vote accepted

After loading microtype:

\DeclareMicrotypeAlias{lmsy}{cmsy}

This seems to be an oversight in the microtype package since there is already a line

\DeclareMicrotypeAlias{lmr} {cmr}

so maybe report this to microtype author...

share|improve this answer
    
That worked. I still get several errors of the kind: I cannot not find a protrusion list for font 'OML/lmm/m/it/10.95' Switching of protrusion for this font on line ... The numbers can also be exchanged for 6, 7, 8, 10, 12 and a few more---I guess that it refers to different sizes. Is there a way to enable microtype for those fonts also? –  hjb981 Jul 17 '12 at 15:18
2  
I guess \DeclareMicrotypeAlias{lmm}{cmm} should do it. –  Lev Bishop Jul 17 '12 at 15:36
    
Yes, it worked. What does that line mean? Does one always write {l abc}{c abc}, where abc is the name of the font? –  hjb981 Jul 17 '12 at 15:53
1  
@hjb981 it means "use the settings from this font for that one". Since lmodern mostly the same as computer modern, and the fonts are (mostly?) named the same just with interchange of c and l, it should work ok. However computer modern and lmodern are not identical. Microtype already knows to treat the \textquotedblleft et al slightly differently for example, so this quick fix may not be good enough (perhaps this is why it is currently missing from microtype). –  Lev Bishop Jul 17 '12 at 23:17
4  
indeed, these two alias declarations were missing in microtype.cfg. I'll add them for the next version (coming "soon"). Thanks for bringing this to my attention. –  Robert Jul 18 '12 at 1:59
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.