2

At first I would like to thank the community for the work that is done here. Whenever there is a LaTeX problem evolving, this site is the first to check by. However, this time it seems that no one has had my problem before (something truely unimageanable to me):

I am currently writing my thesis with LaTeX and the documentclass apa6. Whenever I try to refrence a section/ subsection/ ... I am not able to reference the section number with \ref or \autoref. However, it works with \nameref.

The Log throws "undefined references" errors for the first two references (i.e. \ref & \autoref) but not for the last.

Here is my minimal example:

\documentclass[man, 12pt, a4paper, floatsintext]{apa6}

%================ Packages =================================
% fontenc Package
\usepackage[T1]{fontenc}

% Lade Unicode 8
\usepackage[utf8]{inputenc}

% Lade Neue Deutsche Rechtschreibung 
\usepackage[ngerman]{babel}

%url Package
\usepackage{url}

%Euro Zeichen
\usepackage{eurosym}

% todo=Package
\usepackage{todonotes}

% TikZ
\usepackage{tikz}

% Figure Packages
\usepackage{graphicx}
\usepackage{subcaption}
\captionsetup{font=footnotesize}

% um \patchcmd ausführen zu können
\usepackage{etoolbox}

% Für gewisse Textzeichen
\usepackage{textcomp}

% Erleichterter Import von Dateien
\usepackage{import}

% Über- und Unterschriften für Bilter/ Tabellen
\usepackage{caption}

%Verbesserte Referenzen
\usepackage{hyperref}
% Hyperlinks weniger awkward
\hypersetup{
    colorlinks=true,
    citecolor=black,
    filecolor=black,
    linkcolor=black,
    urlcolor=black
}
%Standalone
%\usepackage{standalone}

% apacite separat laden
\usepackage{apacite}

\title{Example of a Title}
\shorttitle{Short Example}
\author{Knows not}
\affiliation{XY}
\abstract{}


\begin{document}
    \maketitle

    \section{Foo}
    \label{sec:foo}

    Referencing \ref{sec:foo} or \autoref{sec:foo}, that goes by the name of \nameref{sec:foo}

\end{document}
  • Welcome to TeX.SX! Nice MWE! However, it should be \ref{sec:foo}, not \ref{section}. Apparently the sections are unnumbered. – egreg May 31 '17 at 14:02
  • As "Foo" does not have a number, only \nameref{sec:foo} makes sense. \ref{section} cannot work, as you did not specify a label calledsection. – user36296 May 31 '17 at 14:07
  • Sorry for the typo. Of course it should have been \ref{sec:foo}. I edited that. However, the outcome is the same. – gaspode May 31 '17 at 14:11
  • @gaspode It seems a precise choice of apa6 not to number sections. Since \ref would print the number, it finds nothing. – egreg May 31 '17 at 14:12
  • @samcarter How would I add a number to make this MWE work? In fact, this is the core of the question. – gaspode May 31 '17 at 14:13
3

In the apa6 style sections are not numbered. If you want to submit a paper to a journal that requires apa6, you should stick to the style.

Since the man style is among the worst I know from a typographic point of view, I wouldn't recommend using it for any purpose other than submissions.

Anyway, if you still want to use it and to number sections, add

\setcounter{secnumdepth}{1}

after \maketitle.

  • 1
    Perfect, that did it! I know, the man style is a sheer beauty. But unfortunately, I have to write my thesis in the APA manual style... Thank you, anyway! – gaspode May 31 '17 at 14:22

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.