1

I have defined a new command to change the footnote symbol to an asterisk to be used on a chapter's title:

% New command for chapter title footnote. This command changes the
% footnote symbol from a number to an asterisk
\newcommand{\chfootnote}[1]{
\let\oldthefootnote=\thefootnote
\setcounter{footnote}{0}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\footnote{#1}
\let\thefootnote=\oldthefootnote
}

But when I use it I end up having a space right before the asterisk (see image below). The space does not appear if I use a regular footnote. What am I doing wrong?

\chapter[test]{Title\chfootnote{This is a footnote.}}

enter image description here

EDIT: Thank you all for the quick response. Here is the new code that does not add whitespace before the symbol.

% New command for chapter title footnote. This command changes the
% footnote symbol from a number to an asterisk
\newcommand{\chfootnote}[1]{%
\let\oldthefootnote=\thefootnote
\setcounter{footnote}{0}%
\renewcommand{\thefootnote}{\fnsymbol{footnote}}%
\footnote{#1}
\let\thefootnote=\oldthefootnote
}
rpa
  • 111
  • 1
    There are three white space characters at last.\newcommand{\chfootnote}[1]{% will remove the first one -- the newline after \newcommand{\chfootnote}{ introduces one spurious white space, the next one appears after \setcounter{footnote}{0} –  Feb 08 '19 at 14:36
  • 1
    As Christian explains, new lines are considered as spaces. See What is the use of percent signs (%) at the end of lines? for details. – campa Feb 08 '19 at 14:37
  • @campa: I see three -- the \let... should not give rise to a spurious space, should it? –  Feb 08 '19 at 14:43
  • Just in case of using this macro without the optional argument of \chapter you need \protect\chfootnote in order to make this compilable –  Feb 08 '19 at 14:44
  • 1
    @ChristianHupfer My bad (that's why I edited the comment). I meant that there is a further one after \footnote{#1}, but that's of course not visible in the MWE. – campa Feb 08 '19 at 14:51
  • Thanks for the quick response. I appreciate it. I have edited the question with the new version of the \chfootnote command. – rpa Feb 08 '19 at 14:54
  • 1
    your new version is still adding space \footnote{#1}SPACE – David Carlisle Feb 08 '19 at 15:02
  • @campa: Well, the space after the footnote marker should be no issue as long as there is no content after the marker -- you're right of course with 4 spaces, I did not take that space into account because of the final spacing being of marginal importance ... in this case I am right. In average, there are 3.5 spaces ;-) –  Feb 08 '19 at 15:05

0 Answers0