I'm tired to always add a period at the end of the \footnote command. Is there the possibility that LaTeX automatically does this at the end of every footnote?


2 Answers 2


You could redefine the way \@makefntext works and add this in the definition. \@makefntext is the final macro that is executed in the standard document classes for constructing the footnote. In the below MWE, I've added . after #1, where #1 is the argument supplied to \footnote{...}:

enter image description here

  \parindent 1em\noindent \hb@xt@ 1.8em{\hss\@makefnmark}#1.}
Here is some text\footnote{This is a footnote}.

As per your request, this will be added to every footnote. And therefore, even if you have an entire (punctuated) paragraph as a footnote, the last sentence should be period-less.

  • 4
    But what happens if the user sometimes puts the final dot, and sometimes not? It is possible to make a smart macro that checks for the final dot - just more complicated. Hint: the model is xspace.sty :)
    – Boris
    Oct 31, 2011 at 21:31
  • Then they'll get 2 periods and sometimes 1. Okay, seriously... The OP's request included the words "automatically does this at the end of every footnote." I guess it would be possible to check whether the argument ends in . by using an xstring \IfEndWith command. xspace reads a character that follows, not something contained within.
    – Werner
    Oct 31, 2011 at 21:35
  • Exactly. Actually the rule should be "add period unless the footnote ends with ., !, ?, ' or ''". It is easy to implement with xstring, of course...
    – Boris
    Oct 31, 2011 at 21:42
  • @Boris: Interesting idea. You could ask that as a follow-up question referring to this one, and see what kinds of answers come up.
    – doncherry
    Nov 1, 2011 at 0:46
  • 2
    You might also be able to query the spaceskip at the end of a footnote to test whether it ends in punctuation. Nov 1, 2011 at 0:59

The solution by Werner solves the the original poster's problem, but just for the fun of it let us solve a more general one. Suppose the user sometimes puts the periods, and sometimes does not. We want our macro to insert a period only if the footnote does not end with a period, a question mark or a bang.

The following solution is based on the idea by Will Robertson in the comments. It needs nonfrenchspacing to work (it is possible to make a more general one, but this will suffice for now). Basically we check the \spacefactor of the last letter in the footnote and add period if it is too small (3000 is the plain and latex default for the end of a sentence)

  \parindent 1em\noindent \hb@xt@ 1.8em{\hss\@makefnmark}#1%
Here is some text\footnote{This is a footnote}.  More
text\footnote{This footnote ends by a full stop.}.  Even more
text\footnote{End with a bang!}.
  • 1
    Very good solution but try \usepackage[spanish]{babel}.
    – yannisl
    Nov 1, 2011 at 9:45
  • @yiannis-lazarides: well, spanish.ldf sets \frenchspacing, so this trick is not supposed to work. In a production version I'd examine \sfcodes at the beginning of the footnote, and make them odd for sentence end and even otherwise (adding 1 would not change them much). Then I could use \ifodd to check.
    – Boris
    Nov 1, 2011 at 15:15

You must log in to answer this question.

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