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.

Microtype adds extra space to the start and end of letterspaced text, configured via the \SetTracking command's "outer spacing" option. Unfortunately, xspace breaks this. For example, I define a few macros for acronyms:

\newcommand{\foo}[0]{\textsc{foo}\xspace}

The result of typesetting the text "bar \foo bar" now turns out lopsided: there is more space before "FOO" than after. Anyone know of a good workaround for this?

The following document adds lots of outer spacing to demonstrate the problem more clearly:

\documentclass{report}
\usepackage[tracking]{microtype}
\SetTracking
  [outer spacing={2000*,,}]
  {encoding=*, shape={sc,scit}}
  {100}
\usepackage{xspace}
\newcommand{\foo}[0]{\textsc{foo}\xspace}
\begin{document}

bar \foo bar

bar \textsc{foo} bar

\end{document}

This prints

"bar      foo bar"

in the first paragraph, and

"bar      foo      bar"

in the second.

share|improve this question
1  
Welcome to TeX.SE. While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. –  Peter Grill Jun 13 '12 at 4:56
add comment

2 Answers

This has been fixed in microtype v2.5a (after a mere eleven months...).

share|improve this answer
add comment

Instead of using \xspace, you can use the trick with a terminating slash in the definition:

\documentclass{report}
\usepackage[tracking]{microtype}
\SetTracking
  [outer spacing={2000*,,}]
  {encoding=*, shape={sc,scit}}
  {100}

\newcommand{\newfoo}{}% In case `\newfoo` is defined 
\def\newfoo/{\textsc{newfoo}}

\begin{document}

bar \textsc{foo} bar

bar \newfoo/ bar

\end{document}

See also http://tex.stackexchange.com/a/25825/9632.

share|improve this answer
add 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.