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.

  • Well, it's difficult for TeX to hyphenate "rings". But \xspace has no influence in hyphenation. – egreg Mar 11 '13 at 22:59
  • 3
    Why does no one ever believe me when I tell them not to use my packages:-) – David Carlisle Mar 11 '13 at 23:10
  • @egreg - ring was bad chosen, accepted. I just couldn't think, of something simpler today. – Elrond Mar 11 '13 at 23:27
  • @David Carlisle - G I actually linked your posting, where you basicly recommend against your package. :-) – Elrond Mar 11 '13 at 23:28
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.

  • If I have to use the version with suffix only rarely, xspace might make things easier. – Elrond Mar 13 '13 at 9:08

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.