2

I use the macros for i.e. and e.g. from the tufte-book example. They look great, but sometimes a linebreak occurs in between like in the following example:

\documentclass[nobib]{tufte-book}

\usepackage{xspace}

% Macros for typesetting the documentation
\newcommand{\hairsp}{\hspace{1pt}}% hair space
\newcommand{\ie}{\textit{i.\hairsp{}e.}\xspace}
\newcommand{\eg}{\textit{e.\hairsp{}g.}\xspace}

\begin{document}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoquedd \ie  penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet 

\end{document}

What is the best way to avoid this?

6

This ought to be a kern, rather than a skip; no line break can happen at a kern, unless it is followed by a discardable item (such as a skip).

\documentclass[nobib]{tufte-book}

% Macros for typesetting the documentation
\newcommand{\hairsp}{\leavevmode\kern1pt }% hair space
\newcommand{\ie}{\textit{i.\hairsp e.\@}}
\newcommand{\eg}{\textit{e.\hairsp g.\@}}

\begin{document}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Aenean commodo ligula eget dolor. Aenean massa. Cum sociis
natoquedd \ie\ penatibus et magnis dis parturient montes,
nascetur ridiculus mus. Donec quam felis, ultricies nec,
pellentesque eu, pretium quis, sem. Nulla consequat massa
quis enim. Donec pede justo, fringilla vel, aliquet

\end{document}

I don't recommend using \xspace, but you should be able to reinsert it if you really want it.

Note also \@ after the period, in order to mark it as not a sentence ending period. It is not really important if you use

\ie\ penatibus

but it becomes important if you opt for

\ie{} penatibus

or for \xspace.

5

there are probably better ways to do this, but if you put \nolinebreak before the \hspace in the definition of \hairsp that will prevent a break any time the macro is used.

\newcommand{\hairsp}{\nolinebreak\hspace{1pt}}% hair space

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.