Text FormattingTitlecase formatting

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
rhino7890
Posts: 10
Joined: Fri Sep 24, 2010 7:27 pm

Titlecase formatting

Post by rhino7890 »

I was wondering if there is a LaTeX command that results in titlecase formatting of text. What I mean by titlecase formatting is capitalization of the first character of every word in a phrase except for small words such as to, the, on, etc (see http://www.editage.com/resources/pdf/case.pdf for a full definition). I know LaTeX has commands such as \MakeUppercase and \MakeLowercase which make the corresponding text all uppercase or lowercase, respectively; however I have not found an equivalent for titlecase formatting. I believe BibTex has a way of causing titlecase formatting (\printfield[titlecase]{text}), but I haven't been able to figure out how to bring its usage into normal LaTeX documents.

So, is there something that I'm missing, or is there no built-in titlecase formatting command in LaTeX? If not, does anyone have any ideas on solutions to this problem? This is important as some journals want titles and section headings in titlecase whereas some want them in all uppercase. It seems in the spirit of LaTeX that there should be a command to do this so that you as the author don't have to go through and manually change the casing.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

rhino7890
Posts: 10
Joined: Fri Sep 24, 2010 7:27 pm

Titlecase formatting

Post by rhino7890 »

The package "stringstrings" can be used to accomplish this task. See the post http://tex.stackexchange.com/a/4829. This implementation is not the most elegant, nor does it cover all possible cases; however, it is a good first cut for those that want a quick solution. For a more robust solution, you would probably need to start delving into the work of TeX macros or LaTeX3's expl3 package.
Post Reply