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.

The following MWE compiles with pdftex but produces a mysterious warning.

\documentclass{article}
\usepackage{libertine}
\usepackage{mathastext}
\usepackage{microtype}
\begin{document}
Here is some text
\end{document}

The warning is:

Package microtype Warning: Unknown slot number of character
(microtype)                `\%'
(microtype)                in font encoding `OT1' in protrusion list
(microtype)                `default'.

There doesn't seem to be anything wrong with the compiled document, but I get dozens of this error in the full doc and I was wondering what it meant...

Adding \usepackage[T1]{fontenc} doesn't help (except the error is now about T1 encoding instead. Permuting the order of the packages doesn't seem to help either.

A \listfiles:

 *File List*
 article.cls    2007/10/19 v1.4h Standard LaTeX document class
  size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
 fontenc.sty
   t1enc.def    2005/09/27 v1.99g Standard LaTeX file
libertine.sty    2009/05/22a - 4.5.1a -LaTeX: Font libertine - (License GPL) Michael Niedermair
  keyval.sty    1999/03/16 v1.13 key=value parser (DPC)
    calc.sty    2007/08/22 v4.3 Infix arithmetic (KKT,FJ)
  ifthen.sty    2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)
  xcolor.sty    2007/01/21 v2.11 LaTeX color extensions (UK)
   color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive
  pdftex.def    2010/03/12 v0.04p Graphics/color for pdfTeX
  xspace.sty    2006/05/08 v1.12 Space after command names (DPC,MH)
     fxl.inc
     fxb.inc
microtype.sty    2009/03/27 v2.3d Micro-typography with pdfTeX (RS)
microtype.cfg    2009/03/27 v2.3d microtype main configuration file (RS)
mathastext.sty    2011/02/07 1.12 Use the text font in simple mathematics
   t1fxl.fd    2009/05/22 scaled font definitions for libertine T1/fxl (Nm).
supp-pdf.mkii
 ***********

Like I said, this error doesn't seem to translate into anything wrong with the output PDF, but I'd like to know what's going on. (I'm trying to get rid of the clutter from my log file...

I've learned that the silence package can hide these errors, but I'd like to know what's causing it. It seems that it's not a conflict with that particular font, since it also works if you substitute other fonts for libertine.

Can anyone confirm that they get this error?

share|improve this question
    
the current (1.15g) version of mathastext on CTAN has corrected this issue of compatibility with microtype. –  jfbu Oct 27 '12 at 9:02

1 Answer 1

up vote 4 down vote accepted

For (to me) mysterious reasons, mathastext redefines \% to respect \mathbf or \mathit in math mode:

\renewcommand{\%}{\ifmmode\mt@mmode@percent\else\char37\relax\fi}

where \mt@mmode@percent means \mathchar"7425. It does the same for \#, \$ and \&, but it seems that only \% is considered by microtype for its protrusion tables and this definition confuses it. Doing

\chardef\%=37

after loading mathastext (so as to restore the original definition) avoids the warning. Of course

\let\originalpercent\%
\usepackage{mathastext}
\let\%\originalpercent

is exactly the same.

\mathchar"7425 means:

  • normally use character 0x25 (hexadecimal, decimal 37) from math family 4, which is the normal math font, ad defined by mathastext (the number may actually change, but it always refers to the basic font);
  • however, if \mathgroup is greater than -1 (that is we are in \mathbf or \mathit or another of such kind of commands), use character 0x25 from family \mathgroup.

With the restored definition, \% in math mode will use the font from math family 0, which is always the text font, so it may be different from the basic math font.

share|improve this answer
    
This interaction with microtype can be avoided through loading mathastext with option nospecials: this turns off the mathastextification of the \%, \#, \$, and \& characters. But Enrico's proposed workarounds suffice as apparently only \% initiated a problem. –  jfbu Oct 18 '12 at 13:55
    
the redefinitions of \% and the like were a bit strange, but actually modeled on \$. The 1.15g version of mathastext has corrected this problem of incompatibility with microtype. Regarding the mathcode's, it is primarily to change the math font family. Additionally the 7 will as you explain make the characters sensitive to math alphabet commands, which may or may not be a useful thing. The problem is that to be consistent mathastext should do that also for things such as ! or ; but it can't because these characters have an assigned type (\mathclose, \mathpunct). –  jfbu Oct 27 '12 at 9:09

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.