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.

I have a document where the main font is Gotham Narrow Book but the numbers are set in Gotham Narrow Light, and this is set with commands provided by the mathspec package. I'd like to typeset a table where the digits come from a monospace font so that they'll line up better. But my invocation of \setmathtt has no effect.

Here is my sample document:

\documentclass{article}
\usepackage{mathspec}
\setmainfont[BoldFont=Gotham Narrow Medium]{Gotham Narrow Book}
\setmathrm{Gotham Book}
\setmathfont(Latin){Gotham Narrow Book}
\setmathfont(Digits){Gotham Narrow Light}
%:FIXME seems to have no effect
\setmathtt{Courier} 
\begin{document}
\begin{tabular}{cc}
 Normal         & TT \\
 $123456789$ & $\mathtt{123456789}$ \\
 $111111111$ & $\mathtt{111111111}$
\end{tabular}
\end{document}

Does \setmathfont(Digits){Gotham Narrow Light} preclude \setmathtt{Courier}?

share|improve this question

2 Answers 2

up vote 5 down vote accepted

There seems to be a bug in mathspec; if I ask for

\showthe\mathcode`1

I get 1841, i.e., "0731. It seems that 7 is the math group for Gotham Narrow Light, so the mathcode should be "7731. Indeed, if I say

\mathcode`\0=\numexpr\mathcode`0+"7000\relax
\mathcode`\1=\numexpr\mathcode`1+"7000\relax
\mathcode`\2=\numexpr\mathcode`2+"7000\relax
\mathcode`\3=\numexpr\mathcode`3+"7000\relax
\mathcode`\4=\numexpr\mathcode`4+"7000\relax
\mathcode`\5=\numexpr\mathcode`5+"7000\relax
\mathcode`\6=\numexpr\mathcode`6+"7000\relax
\mathcode`\7=\numexpr\mathcode`7+"7000\relax
\mathcode`\8=\numexpr\mathcode`8+"7000\relax
\mathcode`\9=\numexpr\mathcode`9+"7000\relax

I get the desired behavior.

share|improve this answer
    
Thanks, it works fine now! –  Matthew Leingang Jun 14 '11 at 23:56
    
Good work tracking this down. You saved my afternoon. +1 –  ptomato Oct 26 '12 at 12:17

It works with \setmathtt{Courier New} and something like \mathtt{f(x)} because the digits are set with Gotham.

share|improve this answer
    
But that's the problem Matthew is describing. It seems like when you specify a math font for digits, using \setmathsfont that gets used no matter how you specify the mathtt font. –  Alan Munn Jun 10 '11 at 19:41
    
I know, what's the problem ... –  Herbert Jun 10 '11 at 19:44
    
Matthew wants his mathtt digits to be in the mathtt font. That's the problem. –  Alan Munn Jun 10 '11 at 19:47
    
@Alan: I wrote that I know the problem ... –  Herbert Jun 11 '11 at 6:35
2  
Sorry, a little German/English linguistic mix-up there. Your comma after 'know' and the verb second in 'what's the problem' made me think that 'what's the problem' was a question. (But now I definitely don't understand your posted answer.) –  Alan Munn Jun 11 '11 at 12:16

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.