5

I would like to change my section titles into sentence case just like the solution here: How to make sections into sentence case

The titlesec package is already included in my document to modify section title formatting, so this seems like a good solution. The problem is that I am using a book class and require the chapterbib package. When I include the biblatex package to use the \MakeSentenceCase macro, it tells me that it's incompatible with chapterbib and fails to compile.

Is there an alternative method I can use to access \MakeSentenceCase or create a similar macro for use in the \titleformat command?

  • It seems like I could modify this solution, but for sentence case: tex.stackexchange.com/questions/103838/… I don't know enough about the basic LaTeX commands to implement it, though. – jeg Jan 30 '14 at 20:23
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – karlkoeller Jan 30 '14 at 20:28
  • 1
    \MakeSentenceCase is for uniformizing titles in a bibliography. For your section titles, just type them as you want them to appear. – egreg Jan 30 '14 at 22:40
  • @egreg I agree this is usually the easiest solution. But, for my dissertation I have consistently used title case on almost 100 headings and subheadings. LaTeX should be able to switch all section titles to sentence case to satisfy a new formatting requirement -- in my opinion, one of the major strengths of LaTeX is its programmability. – jeg Jan 31 '14 at 16:19
3

Using stringstrings:

\documentclass{article}
\usepackage{stringstrings}
\usepackage[explicit]{titlesec}

\newcommand\SentenceCase[1]{%
  \caselower[e]{#1}%
  \capitalize[q]{\thestring}%
}
\titleformat{\section}
  {\normalfont\Large\bfseries}{\thesection}{1em}{\SentenceCase{#1}\thestring}

\begin{document}

\section{test section one}
\section{TesT SectION Two}

\end{document}

enter image description here

  • This works very nicely. Is there a way to have stringstrings reproduce acronyms or maths in titles? For example, \section{A Title Including $\mu$} or \section{Another Title with {ACRONYMS}}. – jeg Jan 31 '14 at 17:02
  • @jeg Not easily; notice that \MakeSentenceCase has the same problem. – Gonzalo Medina Jan 31 '14 at 17:06
  • @jeg give me some hours; I'll try to provide a version which does what you require. – Gonzalo Medina Jan 31 '14 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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