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?

4
  • 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
    Commented Jan 30, 2014 at 20:23
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Commented Jan 30, 2014 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
    Commented Jan 30, 2014 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
    Commented Jan 31, 2014 at 16:19

1 Answer 1

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

3
  • 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
    Commented Jan 31, 2014 at 17:02
  • @jeg Not easily; notice that \MakeSentenceCase has the same problem. Commented Jan 31, 2014 at 17:06
  • @jeg give me some hours; I'll try to provide a version which does what you require. Commented Jan 31, 2014 at 17:10

You must log in to answer this question.

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