is there a way to automatically format a text in title-case? Something like typing:

\somemagiccommand{the table, the ass and the stick}

which would yield:

The Table, the Ass and the Stick

I have searched the internet but have found nothing that would make this more efficient than doing the casing manually...

  • Welcome to TeX.sx! Mar 22, 2013 at 20:06
  • 1
    even a plain uppercase conversion is highly non-trivial in TeX. What you're looking for is going to be even more complex, as, in addition to those fundamental problems, TeX would have to have a way of knowing the difference between a »the« and an »Ass«, which as far as I know it doesn't. There's no such thing as an integrated word list (as hyphenation works without one). A poor man's solution would be to use an editor that, at least, can turn every first letter into uppercase. <alt> + <up> in WinEdt, for example.
    – Nils L
    Mar 22, 2013 at 20:15
  • 1
    Did you look at Capitalizing strings ignoring closed class words
    – egreg
    Mar 22, 2013 at 22:13

5 Answers 5


enter image description here





\ifcat a\noexpand\tmp\expandafter\tc@ab


\csname tc@@\tc@w\endcsname\expandafter\tc@uc\tc@w

\def\tc@sp#1{ \tc@a#1}





\somemagiccommand{the table, the ass and the stick}

  • 8
    What kind of voodoo magic is going here? You have to be hiding the words that are not to be upper cased somewhere, but I don't see it?? Mar 22, 2013 at 20:50
  • 3
    @PeterGrill \somemagiccommand was what was asked for. (The list of non uc-words is at the end of the code just before \makeatother) Mar 22, 2013 at 21:06
  • Oh so obvious now..., Well at least where to add additional words that are not to be upper cased. So then you somehow check for the existence of tc@@<xxx> to keep <xxx> lower case. Good thing I didn't see this question earlier as I would have come up with a much more complicated solution... :-) Mar 22, 2013 at 21:13
  • 2
    @PeterGrill You would have drawn the uppercase letters illuminated manuscript form, in TikZ. Mar 22, 2013 at 21:17
  • 1
    @Rafal \lowercase{\somemagiccommand{THE TABLE}} probably works Sep 30, 2015 at 13:03

You might want mfirstuc and its command \capitalisewords{}. In order to keep words like “the” small we must hide it from the mechanism by hiding the space before it. This is done by using \space instead of an actual space. Alternatively you can tell the parser with \MFUnocap which words to omit:



\capitalisewords{the table,\space the ass\space and\space the stick}


\capitalisewords{the table, the ass and the stick}


enter image description here


The stringstrings package has a \capitalizetitle macro that does what you want. You need to define words that are not capitalized.


See Headings in uppercase for information about the introduction of the titlecaps package, designed for this task.


for the sake of completeness, here's semi-automatic solution #3:


Well {I} Have Searched the {ENTIRE} {I}nternet but Have Found Nothing\par
\MakeSentenceCase{Well {I} Have Searched the {ENTIRE} {I}nternet but Have Found Nothing}

enter image description here

  • I don't think this is what the OP asked for.
    – StrongBad
    Mar 22, 2013 at 21:01
  • that's why I pointed out it's semi-automatic. Like the one suggested by cgnieder -- which is structurally the same thing -- there's manual work to be done to indicate where to change or not to change case. Defining word lists containing exceptions is, of course, one of the better semi-automatic solutions -- but as I understand it, the OP is looking for something that just »knows« what to capitalize, thus sparing them manual work. InDesign can do that (IIRC), as can, apparently, this thing here
    – Nils L
    Mar 22, 2013 at 21:31

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