I've defined a macro for an initialism (abbreviation) with periods, making sure that an end-of-sentence period is not printed twice: \gp prints "G.P." and \gp. prints "G.P." Here's an M.W.E.:

\gp{} (bad) \par \gp. (bad) \par G.P. (O.K.)

enter image description here

However, this breaks the kerning between the final letter and the final period — see the attached screenshot. This is a pretty minor issue of course, but I find it kind of interesting. The lack of kerning is more pronounced with some other fonts, including Palatino (\usepackage{mathpazo}). Am I abusing \@ifnextchar or is there some other issue? (The same happens with ligatures, although I can't think of a useful application for the following: \makeatletter\def\doublef{f\@ifnextchar f{}{f}}\makeatother and ff --- \doublef f --- \doublef i --- ffi.) enter image description here

  • 4
    Any assignment between two characters breaks kerning.
    – egreg
    Dec 15, 2015 at 18:19
  • 2
    @egreg Not true in LuaTeX!
    – Joseph Wright
    Dec 15, 2015 at 18:29
  • 5
    – cgnieder
    Dec 15, 2015 at 18:32
  • 5
    – user2478
    Dec 15, 2015 at 18:52
  • 1
    @tanh you can load \usepackage{ltxcmds} and then use \newcommand*{\fixdot}[1]{#1\ltx@ifnextchar@nospace.{\@gobble}{}}
    – cgnieder
    Dec 16, 2015 at 9:50

1 Answer 1


\@gobble is defined in the latex kernel as \def\@gobble#1{}

  • Thank you! Reading the definition of \@gobble also makes it clear wow it works. This can be generalized to take an argument using \ltx@ifnextchar@nospace from the ltxcmds package, as suggested by @clemens in their comment to my question.
    – Tor
    Dec 16, 2015 at 15:51
  • 1
    not relevant here but \@gobble is declared as \long\def\@gobble#1{}, thus with LaTeX syntax as \newcommand{\@gobble}[1]{}.
    – user4686
    Dec 16, 2015 at 16:56
  • yes, because #1 can include paragraphs
    – user2478
    Dec 17, 2015 at 8:27

You must log in to answer this question.

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