# apa6: hyperref fails to recognize \subsubsection

I recently experienced several issues after some packages got updated. The one remaining is that hyperref doesn't recognize \subsubsection{} anymore when using the apa6 class. The bookmarks in the PDF output are displayed as <Untitled>. The same is true for the example provided in the apa6 documentation. I added a minimal example that also produces the erroneous bookmarks. All the other referencing (citations, etc.) seems to work just fine.

\documentclass[jou]{apa6}

\usepackage{hyperref}

\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=apa,sortcites=true,sorting=nyt]{biblatex}
\DeclareLanguageMapping{american}{american-apa}

\title{Sample}
\author{Author}
\affiliation{University}
\abstract{This is a test abstract.}
\keywords{APA6}

\begin{document}
\maketitle
\section{Method}
\subsection{Materials}
Several materials were used for this project. Some of them were
\subsubsection{Paper-and-Pencil Instrument}
We used an instrument that we found to be highly successful.
\printbibliography
\end{document}

-

It seems that the author of apa6 redefined \subsubsection in order to add a period after the subsubsection's name. In doing so, however, he used the LaTeX kernel command \@startsection in a way that likely wasn't envisioned by the LaTeX team, and surely confuses hyperref.

In the following example, I have provided an alternative refinition of \subsubsection that resembles the one of \paragraph in the standard classes. A new command \addperi is used to add a period in a way that is compatible with hyperref. (As I'm not familiar with \@startsection, there's no guarantee that my redefinition doesn't break other things.)

EDIT: In case you are wondering why \addperi works in my redefinition, have a look at the description of \@startsection in section 61.2 of the LaTeX2e sources:

style: Commands to set style. Since June 1996 release the last command in this argument may be a command such as \MakeUppercase or \fbox that takes an argument. The section heading will be supplied as the argument to this command. So setting #6 to, say, \bfseries\MakeUppercase would produce bold, uppercase headings.

\documentclass[jou]{apa6}

\makeatletter
% Redefinition of \subsubsection found in apa6.cls
% \renewcommand{\subsubsection}[1]{\@startsection{subsubsection}{3}{1em}%
%     {0\baselineskip \@plus 0.2ex \@minus 0.2ex}%
%     {-\z@\relax}%
%     {\normalfont\normalsize\bfseries\hspace{\parindent}{#1}\textbf{.}}{\relax}}
% Alternative redefinition
\renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{\parindent}%
{0\baselineskip \@plus 0.2ex \@minus 0.2ex}%
{-1em}%
\makeatother

\usepackage{hyperref}

\title{Sample}
\author{Author}
\affiliation{University}
\abstract{This is a test abstract.}
\keywords{APA6}

\begin{document}
\maketitle
\section{Method}
\subsection{Materials}
Several materials were used for this project. Some of them were
\subsubsection{Paper-and-Pencil Instrument}
We used an instrument that we found to be highly successful.
\end{document}


-
the great advantage of online forums is that you can bypass the author of a package altogether. but i've foiled your plot and mailed the author a link to this... –  wasteofspace Feb 20 '12 at 20:45
Since apa6 is a maintained document class, please e-mail a bug report to the maintainer. –  Axel Sommerfeldt Feb 20 '12 at 21:13
@AxelSommerfeldt I'll wait if the OP does. –  lockstep Feb 20 '12 at 21:14
+1 for pointing out that the definition of the \subsubsection command in the apa6 doc class is, well, suspect. –  Mico Feb 21 '12 at 2:55
I mailed the maintainer of course, but first I thought it might be an issue connected with my LaTeX distribution given the problems I had some days before already. Hence the post of the issue here... –  shkelda Feb 21 '12 at 14:41