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

Is there a command that ignores the following character, in the same way that \^ puts a hat over the following character?

share|improve this question
up vote 5 down vote accepted

I don't know if one exists already, but issuing the directive


will do the trick: \?abc gives bc, and so on.

Edit: Here is a discussion of the question Tim N raised in the comments: getting a \caption to drop the final period in a figure number. It does not work, even in the default article class, to just let


which gives a few errors, the first of which is actually "Argument of \? has an extra }" and not "Paragraph ended before \? was complete" (that's the second). A little \tracingmacros-trawling reveals the following phenomenon: when \caption is called, it first increments the figure counter, which calls \refstepcounter so it can be referenced, which sets up (using \edef) the current label \@currentlabel for \ref, which (finally) must contain the value of \thefigure! And guess what: the extra period does not appear after \thefigure in this context, so the \? gobbles the closing brace of the \edef command. Hence the error.

Let's see if we can get what you want. The caption line is constructed in several stages, which in article consist of the following discrete steps:

  • Generate the caption "number" (the text "Figure 1.2.", for example);
  • Attach it to the caption "text" (the argument of \caption) by, for example, inserting a colon and a space between them.

These correspond to the internal macros \fnum@figure and \@makecaption, which are defined by the document class, and obviously vary; it seems that Tim N's packages are putting extra periods in, but who knows whether it's in the first stage or the second? Or even in \thefigure itself? Depending on where it happens, you need a different workaround:

  • If someone erroneously defined \thefigure to contain an extra period, and you know how the rest of the number ought to look, then you can just redefine it. Since there's no way to gobble the previous character, if my solution below doesn't work for you, then you should try this.

  • If \fnum@figure somehow puts a period after the value of \thefigure, then under some circumstances you will be able to remove it using \?. For example, if they modified the default article definition (see below) then putting \? right after \thefigure will do the trick. However, if they produce the period by some clever device, you will have to be equally clever to unravel it.

Here is that definition:

% The default def'n doesn't have the period
  • Finally, suppose that the period is inserted in \@makecaption. Then you may be able to catch it with \?, but only if the command that produces the "number" is dropped in as-is and not fully expanded first. This is the case in the article class and, we hope, also in whatever your situation is.

So it appears the goal is to stick \? right after \thefigure as it appears in \fnum@figure only. You want to patch a command, and there are several ways to go about this, but the etoolbox package is generally useful so I'll go with it. See the following minimal document:

% Cute but not necessary here:
% \def\?#1{}

% BAD:
% \renewcommand\thefigure{\arabic{figure}\?}


  \caption{A figure}

Since we are going with \makeatletter anyway, I figure the internal \@gobble command that Yiannis pointed out is probably the wiser course, though \? is nice if you are putting it in ordinary text.

share|improve this answer
In the LaTeX kernel you find \@gobble. – Yiannis Lazarides Jan 10 '12 at 0:03
@Yiannis: Oops, yes. Though it does need to be swaddled in \makeatletter...\makeatother. – Ryan Reich Jan 10 '12 at 0:08
My goal was an ugly hack, to \renewcommand \thefigure to end with this, because for some interaction between packages, my figure captions started showing up as "Figure 1.2.:" with an extra period. The period can be made invisible by ending with \color{white}, but trying to \? it results in: ! Paragraph ended before \? was complete. – Tim N Jan 10 '12 at 0:12
I should add that ending with \^ does put a hat over the dot. – Tim N Jan 10 '12 at 0:12
You mention "because for some interaction between packages". There could be other ways around this, for which one would need to see a minimal working example (MWE) that illustrates your problem. However, for now, this question is most likely "answered". You could post a follow-up question. See I've just been told I have to post a follow-up question, why and how? – Werner Jan 10 '12 at 0:27

You could try the following:


It simply consumes its argument but doesn't use it.

share|improve this answer
My goal was an ugly hack, to \renewcommand \thefigure to end with this, because for some interaction between packages, my figure captions started showing up as "Figure 1.2.:" with an extra period. The period can be made invisible by ending with \color{white}, but trying to \swallow it results in: ! Argument of \swallow has an extra }. – Tim N Jan 10 '12 at 0:10
@TimN: Then the dot is added outside of the current brace group. You might want to use the caption package instead to change the caption format. – Martin Scharrer Jan 10 '12 at 0:28
@MartinScharrer: I see. Still, \^ does what it does, so I suppose it's not impossible to solve? – Tim N Jan 10 '12 at 0:33

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.