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.

When using the \pmod command as a subscript to a sum, I often encounter some extra unwanted space. For example, writing

\[ \sum_{n \equiv 1 \pmod{k}} ... \]

produces the following image:

enter image description here

Does anyone have any ideas to delete the extra white space between the 1 and the open parenthesis?

share|improve this question

1 Answer 1

up vote 12 down vote accepted

I'd define a variant of \pmod:

\makeatletter
\let\@@pmod\pmod
\DeclareRobustCommand{\pmod}{\@ifstar\@pmods\@@pmod}
\def\@pmods#1{\mkern4mu({\operator@font mod}\mkern 6mu#1)}
\makeatother

You can use \pmod as before in all other situations and write

\[ \sum_{n \equiv 1 \pmod*{k}} ... \]

when you need it as a subscript to a sum.

enter image description here

Another way might be to load amsmath and redefine \pod (\pmod is defined in terms of it):

\usepackage{amsmath}
\makeatletter
\renewcommand{\pod}[1]{\mathchoice
  {\allowbreak \if@display \mkern 18mu\else \mkern 8mu\fi (#1)}
  {\allowbreak \if@display \mkern 18mu\else \mkern 8mu\fi (#1)}
  {\mkern4mu(#1)}
  {\mkern4mu(#1)}
}

This will avoid having to say \pmod* and the result will be the same as shown.

share|improve this answer
    
This works great. Thanks for your help! –  JavaMan Dec 24 '11 at 3:10

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.