Skip to content

xspace in Scissor LaTeX

Not yet. \usepackage{xspace} is accepted and \xspace causes no error, but it adds no space, so a command such as \tool defined with \xspace runs into the next word; write \tool{} or \tool\ before a space, which works here and in every TeX installation.

What the package does

A command without arguments, such as \tool, swallows the space that follows it: \tool runs prints "toolruns". xspace fixes this for your own commands. Ending the definition with \xspace adds a space after the command unless a punctuation mark follows:

LaTeX
\newcommand{\tool}{Scissor LaTeX\xspace}

What works here

FeatureIn Scissor LaTeXNotes
\usepackage{xspace}WorksLoads without a message.
\xspace at the end of a definitionNot supportedNo error, but no space either: the command still swallows the space after it.
Before punctuation: \tool., \tool,, \tool'sWorksNo space is wanted there, so the result is right.
\tool{} runs, \tool\ runs, \tool~runsWorksThe usual ways to keep the space, with or without xspace.
\xspaceaddexceptions, \xspaceremoveexceptionNot supportedSkipped with a Problems note; the argument is printed.

Examples

With \xspace alone, the space after the command is lost here. With {} it is kept:

\xspace adds no space; {} keeps it

LaTeXPreamble: \usepackage{xspace}Open in editor (opens in a new tab)
\newcommand{\tool}{Scissor LaTeX\xspace}
Without braces: \tool runs in the browser.
With braces: \tool{} runs in the browser.
Before a comma: \tool, as shown, needs nothing.
Rendered by Scissor LaTeX: \xspace adds no space; {} keeps it

Defining the command without \xspace, and writing {} where a space follows, gives the same result in every TeX installation:

The portable way

\newcommand{\name}{Erika Mustermann}
\name{} measured 44 samples. The report by \name\ is ready, and
\name's notes are attached.
Rendered by Scissor LaTeX: The portable way

Compatibility

  • From a TeX installation to here: commands that rely on \xspace run into the following word. Add {} after them where a space follows.
  • From here to a TeX installation: documents compile there unchanged, and \xspace works there. Commands written with {} look the same in both places.

The full manual is on CTAN: ctan.org/pkg/xspace. See also Your own commands with \newcommand and Packages that do not work.

Questions and answers

Why does my command swallow the space after it?

LaTeX reads the space after a command name as the end of the name, not as a space. Write \tool{} or \tool\ to keep it. xspace would add it automatically, but it does not work here yet.

Should I remove \xspace from my commands?

You do not have to: it causes no error. But the space is only kept where you write {} or \ after the command, so writing those is the reliable way.

Every example on this page is typeset by Scissor LaTeX when the site is built. Last updated 2026-11-07.