0

I am writing a paper in an APA6 class document. I would like to number the sections which I did with \setcounter{3}. However, I would not like to have my abstract numbered but could of course not use the * option here.

Any suggestions very welcome!

\documentclass[a4paper,man,natbib,donotrepeattitle]{apa6}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath,siunitx,booktabs,caption}
\usepackage{graphicx}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage{hyperref}
\usepackage[T1]{fontenc}
\usepackage{multicol}
\usepackage{multirow}
\usepackage[titles]{tocloft}
\usepackage[usestackEOL]{stackengine}
\usepackage{textcomp}
\usepackage{minipage-marginpar}
\usepackage{float}
\restylefloat{table}
\restylefloat{figure}
\floatstyle{plaintop}
\usepackage[export]{adjustbox}

The Abstract:

\abstract{\textit{Background:} text.\\ 
\textit{Methods:} text.\\ 
\textit{Results:} text.\\ \textit{Conclusion:} text. 
\keywords{Linalool, Anti-Oxidant, Oxidative Stress, Glutamate.}}

\setcounter{secnumdepth}{3}
  • Aren't you using \abstract{write abstract here} for the abstract? That isn't numbered. – Torbjørn T. Jun 20 '18 at 7:34
  • Call me stupid, but \section*{Lorem} works for me – moewe Jun 20 '18 at 7:37
  • 1
    @CesiumNotch Why don't you give one mwe? – David Jun 20 '18 at 7:41
  • 1
    OK, I understand what you did know, but it would have a bit clearer if you made a complete example. While you do mention it (sort of) in the text, in the code you have not included the crucial \setcounter{secnumdepth}{3}. – Torbjørn T. Jun 20 '18 at 7:43
  • 1
    Have you tried placing the \setcounter after \maketitle? And by "complete example" I mean a minimal working example, that is the smallest complete document from \documentclass to \end{document} that demonstrates the problem. Not all questions require one (some do), but it usually makes it a lot easier to understand what is going on, which makes it a lot easier for us to give you a proper answer. – Torbjørn T. Jun 20 '18 at 7:49
1

Issue

\usepackage{etoolbox}
\patchcmd{\maketitle}
  {\section{\normalfont\normalsize\abstractname}}
  {\section*{\normalfont\normalsize\abstractname}}
  {}{\typeout{Failed to patch abstract.}}

before you load hyperref. This makes the abstract use \section* instead of \section.

\documentclass[a4paper,man,natbib,donotrepeattitle]{apa6}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{duckuments}
\setcounter{secnumdepth}{3}

\usepackage{etoolbox}
\patchcmd{\maketitle}
  {\section{\normalfont\normalsize\abstractname}}
  {\section*{\normalfont\normalsize\abstractname}}
  {}{\typeout{Failed to patch abstract.}}

\usepackage{hyperref}

\author{Anne Elk}
\title{On the Theory of Brontosauruses}
\shorttitle{Brontosauruses}

\abstract{\blindduck}

\begin{document}
\maketitle
\section*{Lorem}
\blindduck
\duckument
\end{document}

enter image description here


If you must patch \abstract after loading hyperref you need to patch \HyOrg@maketitle instead. Don't forget the \makeatletter...\makeatother in that case.


Another solution would be to only set \setcounter{secnumdepth}{3} after \maketitle

\documentclass[a4paper,man,natbib,donotrepeattitle]{apa6}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{duckuments}

\usepackage{hyperref}

\author{Anne Elk}
\title{On the Theory of Brontosauruses}
\shorttitle{Brontosauruses}

\abstract{\blindduck}

\begin{document}
\maketitle
\setcounter{secnumdepth}{3}
\section*{Lorem}
\blindduck
\duckument
\end{document}

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.