2

I have had to add a 'List of Supplementary Materials' to my current document using the tocloft package. I currently have the following code in my preamble:

\usepackage[titles]{tocloft} % Create Table of Supplementary Materials

\newcommand{\listsuppmatname}{Supplementary Materials}
\newlistof{suppmat}{smat}{\listsuppmatname}
\newcommand{\suppmat}[1]{%
   \refstepcounter{suppmat}
   \noindent{Video \thechapter.\thesuppmat\xspace}
   \addcontentsline{smat}{suppmat}
{\protect\numberline{\thechapter.\thesuppmat}#1}
}

In the text I have:

\suppmat{blah blah}\label{vid:blahblah}

This works as intended, but I have a trailing space after the reference. I have tried some of the proposed solutions to the macro trailing space (such as xspace package or \suppmat/ etc) but none appear to remove the space. I have a feeling it's a minor conflict with the tocloft package.

Any ideas? Thanks!

1 Answer 1

5
\newcommand{\listsuppmatname}{Supplementary Materials}
\newlistof{suppmat}{smat}{\listsuppmatname}
\newcommand{\suppmat}[1]{%
   \refstepcounter{suppmat}%%%%%
   \noindent{Video \thechapter.\thesuppmat}%%%%%%%%
   \addcontentsline{smat}{suppmat}%%%%%
{\protect\numberline{\thechapter.\thesuppmat}#1}%%%%%
}

Your macro was adding 4 spaces each time, I commented them out with %%%% (you only need one %) also I removed \xspace if you do use this it has to be the very last token in the definition. At the place you had it it would always just have seen the following space in the definition and so never add a space.

1
  • 3
    Grrrrrrrrrrrrrrr. ;-)
    – egreg
    Jun 6, 2016 at 21:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .