TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
Also see the subsequent discussion at: tex.stackexchange.com/q/33626/5764 – Werner Nov 4 '11 at 19:31
up vote 12 down vote accepted

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.

share|improve this answer
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 '11 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 '11 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 '11 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 '11 at 0:46
You might also be able to query the spaceskip at the end of a footnote to test whether it ends in punctuation. – Will Robertson Nov 1 '11 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!}.
share|improve this answer
Very good solution but try \usepackage[spanish]{babel}. – Yiannis Lazarides Nov 1 '11 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 '11 at 15:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.