4

I was considering to use xspace for some common standard terms in my document, like:

\newcommand{\ring}{my secret ring\xspace}

I am now wondering, if hyphenation gets it right, when I do this?

\ring{}s

Notes

That asked, I realize the existance of https://tex.stackexchange.com/a/86620/24158 and I probably should not use xspace at all and just use the normal definition, in which case I hope the hyphenation gets it right always.

I also possibly should really define more terms instead of trickyly appending to them. But german has a bunch of postfixes, so that's not funny either.

Not using a macro IS an option. I am trying to explore my viable options.

Elrond
  • 485

1 Answers1

6

Here's the proof that hyphenation is not influenced by \xspace; \hspace{0pt} allows hyphenation of the first word, the width of 0pt forces LaTeX to hyphenate as much as it can.

\documentclass{article}
\usepackage{xspace}
\newcommand{\super}{supercalifragilistic\xspace}
\newcommand{\superB}{supercalifragilisti\xspace}
\begin{document}
\parbox{0pt}{\hspace{0pt}
\super{}expialidocious
\superB{}cexpialidocious}
\end{document}

enter image description here

However, I don't see how \xspace can be of help in this case; you need to add an empty group if a suffix follow, which seems to be a frequent case. Without \xspace, \super expialidocious or \super{}expialidocious would give the same result. And for the cases where no suffix is present, adding {} at the end doesn't seem a big deal.

egreg
  • 1,121,712