dan-weiss / apa7-latex-cls-source

Source code for apa7 class
LaTeX Project Public License v1.3c
49 stars 13 forks source link

Title case in headings #15

Open junoslukan opened 3 years ago

junoslukan commented 3 years ago

APA 7th edition requires all levels of headings to use title case. Would it be possible to do this automatically when using \section etc.?

At least in English, some words to keep lower-case could be predefined and a command could be provided for user-defined words.

There are some ready-made solutions available, such as this one or the package titlecaps. I am not sure, however, whether this is possible to make general enough and if you wanted to use the expl3 solution or something else.

I can prepare a pull request if it's something as simple as in the link above.

dan-weiss commented 3 years ago

@junoslukan Thanks for the suggestion. I spent some time trying to make this work and I haven't gotten it working yet. There is something causing the first word in the heading to always be lowercase.

I would love your help if you have time to take a look at it. My work in progress in on the branch called add_titlecase.

junoslukan commented 3 years ago

Thanks for looking into it!

It worked to some degree for me, when I compiled the short sample with jou option: the subsubsection title "Face Validity" was spelled with both words capitalized. All of the words were in title case, however, even the ones in \Addlcwords. I might have not used the config files properly, I suspect.

I had trouble with the man mode, however, where I couldn't get the long sample to compile. I used LuaLaTeX and got:

! Illegal parameter number in definition of \@gtempa.

and many other errors, including:

! Use of \\titlecap doesn't match its definition.
\update@series@target@value #1->\def \reserved@a {
                                                  #1}\ifx \target@meta@famil...
l.61 \maketitle

If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.

I will try to look into this further, but I need to first read on .dtx and .cls files as I am only ever using LaTeX from a final user perspective, i.e. defining commands in my .tex files if at all.