I am using the book class and I wrote all the parts, sections, subsections as \section{My Section Is Like This} that I produce something like this

My Section Is Like This

My editor asked to write something like this:

My section is like this

I believe that I have to introduce a command like the one in capitalising-first-letter-of-each-word-in-section-headings-using-book-class:


that does not solve my problem


something like that


that produces

my section is like this

The problem is how to capitalize only the first letter of the sentence for all sections, subsections, subsubsections, but I have not been able to find it.

  • Do You Really Write Like That? Usually, this kind of question is about using latex to replace a common method of writing with a less common, yet demanded by an editor. If you don't usually write like that, I'd suggest you change all your sections by hand or with an external tool, and next time you write normally. Of course, if you need the content of the \section{} (in the source) to be capitalized for one reason or another, you can ignore this comment.
    – T. Verron
    Nov 24, 2014 at 12:46
  • @T.Verron, yes! I wrote like that. I dont need the source but it is a large book to change by hand (I can also provide some typos). I can make a small program in Java for instance to recognize the text inside the sections and change suitably. However, maybe there is a tool in latex to solve this problem. Nov 24, 2014 at 12:57
  • 3
    you do realize that you'll still have to go through the whole book at the end to make sure that no proper names, acronyms, or similar words have been erroneously lowercased. maybe you can simplify this task by generating a toc with all the affected section headings beforehand, and applying a brightly colored editorial pencil. (i think it's easier to spot such bits when they're properly "cased" instead of in a sea of all lowercase; your experience may differ.) Nov 24, 2014 at 13:31

2 Answers 2


Rather than complicate your macros forever I'd just edit the file.

if your sec.tex file is

\section{My Title}

\section{With Title Case}


Then after a command such as

sed -ie "s/\\\\section{\(.\)\([^{}]*\)}/\\\\section{\\1\\L\\2}/"  sec.tex 

then it will be

\section{My title}

\section{With title case}


I used sed on the commandline there but any editor should be able to do similar replacements.


You Shouldn't Be Writing Like This.

If you really want, then be prepared to have problems with these macros. ;-)




\section{My Section is Like This}

\section{But it should be like this}


For instance, accented letters at the start won't work, but you can brace them:


enter image description here

  • thank you! This works very well, but it seems that the "toc"=table of contents file is not affected (To be sure, I removed it and rerun again the file) Nov 24, 2014 at 13:35
  • @DanielTheRocketMan Of course. You have to work harder for that and this is the reason why I'd prefer typing the input as it should output.
    – egreg
    Nov 24, 2014 at 14:28

You must log in to answer this question.

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