
tocloft 패키지를 사용하여 현재 문서에 '보충 자료 목록'을 추가해야 했습니다. 현재 내 서문에 다음 코드가 있습니다.
\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}
}
내가 가진 텍스트에는 다음이 있습니다.
\suppmat{blah blah}\label{vid:blahblah}
이는 의도한 대로 작동하지만 참조 뒤에 공백이 있습니다. 매크로 후행 공백(예: xspace 패키지 또는 \suppmat/ 등)에 대해 제안된 솔루션 중 일부를 시도했지만 공백을 제거하는 솔루션은 없습니다. tocloft 패키지와 사소한 충돌이 있는 것 같습니다.
어떤 아이디어가 있나요? 감사해요!
답변1
\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}%%%%%
}
%%%%
매크로는 매번 4개의 공백을 추가하고 있었고 (한 개만 필요함 ) 로 주석 처리했으며 이를 사용하는 경우 %
제거하여 \xspace
정의의 가장 마지막 토큰이어야 합니다. 당신이 그것을 가지고 있던 곳에서는 항상 정의에서 다음 공백을 보았을 것이므로 공백을 추가하지 마십시오.