How can I force text to be displayed in title-case?

whaledawg just a moment. 1 answers, 0 views
apa-style capitalization

I'm trying to update apa.cls for 6th edition (a large task since I'm not a true latex hacker) and I'd like to force the headings for certain levels to conform to title case. That is the first letter of every word is in uppercase. For example:

  • Upper case = DELAYED SOCIAL TRANSITIONS DURING EMERGING ADULTHOOD
  • Lower case = delayed social transitions during emerging adulthood
  • Sentence case = Delayed social transitions during emerging adulthood
  • Title case = Delayed Social Transitions During Emerging Edulthood

So my questions are:

  1. Is there an easy way to do this that I just haven't found? or
  2. Can someone point me in the direction of what I would have to know to implement this myself?

Thanks all.

p.s. I know that this post has nothing to do with the tag 'cases', but I can't create new tags because I don't have enough reputation and nothing else fits :(

1 Answers


Geoffrey Jones 11/02/2010.

This code should get you started. It uses a couple of the stringstrings package's string manipulation routines, including its horrendously time-expensive \addlcwords to identify the words you'd prefer to typeset in lower case. The rest of the code hooks this into APA's sectioning commands (it's tedious but it does the trick).

Note that although this should get you going, it isn't completely ready for prime time, mainly because the work will take some time which, if it weren't something you wanted to proceed with, would divert me from things I'm actually supposed to be doing :). Nevertheless, if this were something you wanted to proceed with, you'll need to let stringstrings know that '-' (as in 'Knock-on') should be treated the same way as a space character (run the code below to see what I mean). That work would probably involve handing '-' to stringstrings's \encodetoken command and involve providing some extra buttressing code -- although I wouldn't be surprised if there were several ways to skin that particular cat.

Anyway, although there's still some work remaining, I hope it takes you in the direction you set out to go. (NB, don't forget: stringstrings's \addlcwords seems to scale time-exponentially. Or worse.)

\documentclass[jou]{apa}
\usepackage{lipsum}

\usepackage{stringstrings}
\addlcwords{all of the and a an is before on}
\DeclareRobustCommand*\MakeTitlecase[1]{%
  \caselower[e]{#1}%
  \capitalizetitle{\thestring}%
}

\makeatletter
% Four Levels with Sections in Title Case
\def\FourLevelHeadingTitleCase{%
    \def\section{\@ifnextchar*{\@sections}%
                {\@ifnextchar[{\@sectionb}{\@section}}}%
    \def\@sections*##1{\leveltwo{\MakeTitlecase{##1}}}%
    \def\@sectionb[##1]##2{\leveltwo{\MakeTitlecase{##2}}%
        \@mkboth{\MakeUppercase{##1}}{\MakeUppercase{##1}}%
        \addcontentsline{toc}{section}{\MakeTitlecase{##1}}}%
    \def\@section##1{\leveltwo{\MakeTitlecase{##1}}%
        \@mkboth{\MakeUppercase{##1}}{\MakeUppercase{##1}}%
        \addcontentsline{toc}{section}{\MakeTitlecase{##1}}}%
%
    \def\subsection{\@ifnextchar*{\@subsections}%
                   {\@ifnextchar[{\@subsectionb}{\@subsection}}}%
    \def\@subsections*##1{\levelthree{\MakeTitlecase{##1}}}%
    \def\@subsectionb[##1]##2{\levelthree{\MakeTitlecase{##2}}%
        \addcontentsline{toc}{subsection}{\MakeTitlecase{##1}}}%
    \def\@subsection##1{\levelthree{\MakeTitlecase{##1}}%
        \addcontentsline{toc}{subsection}{\MakeTitlecase{##1}}}%
%
    \def\subsubsection{\@ifnextchar*{\@subsubsections}%
                      {\@ifnextchar[{\@subsubsectionb}{\@subsubsection}}}%
    \def\@subsubsections*##1{\levelfour{\MakeTitlecase{##1}}}%
    \def\@subsubsectionb[##1]##2{\levelfour{\MakeTitlecase{##2}}%
        \addcontentsline{toc}{subsubsection}{\MakeTitlecase{##1}}}%
    \def\@subsubsection##1{\levelfour{\MakeTitlecase{##1}}%
        \addcontentsline{toc}{subsubsection}{\MakeTitlecase{##1}}}%
%
    \let\paragraph=\levelfive%
}
\makeatother
\FourLevelHeadingTitleCase

\title{On the Bodleianisation of L-Space Interior Topologies}
\author{The Librarian}
\affiliation{Unseen University}
\shorttitle{Ook}
\rightheader{Oook}
\leftheader{Capitalised Headers}
\abstract{\lipsum[1]}
\begin{document}
\maketitle
\section{Library-Space is NOT countable}
\lipsum[1]
\subsection{Turtles ALL the way down}
\lipsum[2]
\subsubsection{On THE Knock-ON Effect oN wood}
\lipsum[3]
\subsubsection{an orang And a utan}
\lipsum[3]
\end{document}

HighResolutionMusic.com - Download Hi-Res Songs

1 The Chainsmokers

Beach House flac

The Chainsmokers. 2018. Writer: Andrew Taggart.
2 (G)I-DLE

POP/STARS flac

(G)I-DLE. 2018. Writer: Riot Music Team;Harloe.
3 Anne-Marie

Rewrite The Stars flac

Anne-Marie. 2018. Writer: Benj Pasek;Justin Paul.
4 Ariana Grande

​Thank U, Next flac

Ariana Grande. 2018. Writer: Crazy Mike;Scootie;Victoria Monét;Tayla Parx;TBHits;Ariana Grande.
5 Clean Bandit

Baby flac

Clean Bandit. 2018. Writer: Jack Patterson;Kamille;Jason Evigan;Matthew Knott;Marina;Luis Fonsi.
6 BTS

Waste It On Me flac

BTS. 2018. Writer: Steve Aoki;Jeff Halavacs;Ryan Ogren;Michael Gazzo;Nate Cyphert;Sean Foreman;RM.
7 Imagine Dragons

Bad Liar flac

Imagine Dragons. 2018. Writer: Jorgen Odegard;Daniel Platzman;Ben McKee;Wayne Sermon;Aja Volkman;Dan Reynolds.
8 Nicki Minaj

No Candle No Light flac

Nicki Minaj. 2018. Writer: Denisia “Blu June” Andrews;Kathryn Ostenberg;Brittany "Chi" Coney;Brian Lee;TJ Routon;Tushar Apte;ZAYN;Nicki Minaj.
9 Brooks

Limbo flac

Brooks. 2018.
10 BlackPink

Kiss And Make Up flac

BlackPink. 2018. Writer: Soke;Kny Factory;Billboard;Chelcee Grimes;Teddy Park;Marc Vincent;Dua Lipa.
11 Diplo

Close To Me flac

Diplo. 2018. Writer: Ellie Goulding;Savan Kotecha;Peter Svensson;Ilya;Swae Lee;Diplo.
12 Rita Ora

Velvet Rope flac

Rita Ora. 2018.
13 Fitz And The Tantrums

HandClap flac

Fitz And The Tantrums. 2017. Writer: Fitz And The Tantrums;Eric Frederic;Sam Hollander.
14 Little Mix

Woman Like Me flac

Little Mix. 2018. Writer: Nicki Minaj;Steve Mac;Ed Sheeran;Jess Glynne.
15 Billie Eilish

When The Party's Over flac

Billie Eilish. 2018. Writer: Billie Eilish;FINNEAS.
16 K-391

Mystery flac

K-391. 2018.
17 Cher Lloyd

None Of My Business flac

Cher Lloyd. 2018. Writer: ​iamBADDLUCK;Alexsej Vlasenko;Kate Morgan;Henrik Meinke;Jonas Kalisch;Jeremy Chacon.
18 Backstreet Boys

Chances flac

Backstreet Boys. 2018.
19 Lil Pump

Arms Around You flac

Lil Pump. 2018. Writer: Rio Santana;Lil Pump;Edgar Barrera;Mally Mall;Jon Fx;Skrillex;Maluma;Swae Lee;XXXTENTACION.
20 Kelly Clarkson

Never Enough flac

Kelly Clarkson. 2018. Writer: Benj Pasek;Justin Paul.

Language

Popular Tags