6

I use multi-letter identifiers in my thesis, for which I wrote macros, for example:

\newcommand{\spec}{\mathit{Spec}}

In a text, I always refer to these identifiers as:

some words $\spec$ even more words

In some texts however, latex changes the spacing between the letters: The output looks like

"some words S p e c even more words"

instead of the usual

"some words Spec even more words".

How do I prevent latex from adding spaces and always output the latter?

EDIT: Here is a minimal example. The spacing on page one is weird, the spacing on page two is correct. Any ideas?

\documentclass[%
twoside=true,
paper=a4,
BCOR=5mm,
headinclude=true,
footinclude=true,
fontsize=10pt,
titlepage=true,
abstract=off,
parskip=half-,
headsepline,
footsepline,
cleardoublepage=empty,
open=right,
numbers=noenddot,
fleqn,
index=totoc,
listof=totoc,
american
]{scrreprt}

\PassOptionsToPackage{%
drafting,           % timestamp on every page
pdfspacing         % makes use of pdftex’ letter spacing capabilities
}{classicthesis}

\PassOptionsToPackage{american}{babel}
\usepackage{babel}


\usepackage{classicthesis}
\newcommand{\spec}{\mathit{Spec}}
\newcommand{\sd}{\mathit{stopdead}}
\newcommand{\bb}{\mathit{b}}


\begin{document}

\chapter{$\bb$-conformance}

Some words $\spec$ some more words.
This is very weird $\sd$-semantics behavior and $\sd$-semantics looks really ugly.

\newpage

Some words $\spec$ some more words.
This is normal $\sd$-semantics behavior.

\end{document}
  • Minimal example please, ie something we can copy and run on our machines. – daleif Nov 25 '13 at 14:30
  • 1
    are you sure you always include the backslash? if you happen to input $Spec$ instead of $\Spec$, the individual letters would be "spaced out" since they are being treated as individual variables, not as a word. without an actual example to test, it's impossible to be sure. – barbara beeton Nov 25 '13 at 14:30
  • Thanks, but I always use the backslash. I'm going to build a minimal example (which is kinda difficult because I use a lot of packages). – Rich Nov 25 '13 at 15:11
  • If I remove the pdfspacing option, I get what you would like to have (don't ask me why, though) – Federico Nov 25 '13 at 16:11
6

It seems to be a bug with classicthesis; it is triggered by \b in the chapter title, when \mathit is used.

This doesn't seem to happen when you use \textit instead of \mathit.

\documentclass[%
twoside=true,
paper=a4,
BCOR=5mm,
headinclude=true,
footinclude=true,
fontsize=10pt,
titlepage=true,
abstract=off,
%parskip=half-,% <--- PLEASE, DON'T USE THIS
headsepline,
footsepline,
cleardoublepage=empty,
open=right,
numbers=noenddot,
fleqn,
index=totoc,
listof=totoc,
american
]{scrreprt}


\usepackage[american]{babel}
\usepackage[
  drafting,
  pdfspacing,
]{classicthesis}

\newcommand{\spec}{\textit{Spec}}
\newcommand{\sd}{\textit{stopdead}}
\newcommand{\bb}{\textit{b}}


\begin{document}

\chapter{\texorpdfstring{$\bb$}{b}-conformance}

Some words $\spec$ some more words.
This is very weird $\sd$-semantics behavior and
$\sd$-semantics looks really ugly.

Some words $\spec$ some more words.
This is normal $\sd$-semantics behavior.

\end{document}

enter image description here

Note also that b is not uppercased in the title; the \texorpdfstring is used to avoid a spurious warning.

Please, don't use parskip-.

  • Thanks! \textit instead of \mathit seems to work, although I have no idea why. The lowercase b in the title is there on purpose, because it is a mathematical variable. Can you explain why I shouldn't use parskip-? – Rich Nov 25 '13 at 16:31
  • I've no idea, either: I'll try and investigate. You shouldn't use parsnip- because using it is a clear sign of bad typography. – egreg Nov 25 '13 at 16:37
  • @Rich It seems to be the fault of classicthesis and the bug is triggered by the \mathit in the chapter title. – egreg Nov 25 '13 at 16:47
  • 1
    I think it's a bug in microtype, actually. The same happens with \documentclass{article} \usepackage{microtype} \begin{document} \textls[200]{$\mathit{b}$-conformance} Some words $\mathit{spec}$ some more words. \end{document}. The problem is that during math font setup, LaTeX sets \globaldefs1, with the result that the letterspaced font instance will leak out. I'll have to see what I can do about it. – Robert Nov 25 '13 at 17:01
  • 1
    The following should help (after loading classicthesis): \def\MT@set@lsfont{\MT@exp@two@c\let\font@name\MT@lsfont\global\let\glb@currsize\@empty} (which, alas, will slow down microtype, again). – Robert Nov 25 '13 at 17:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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