I am currently writing a LaTeX document using a template I got sent from someone. The problem with this template is that the section numbers are not showing. Since I am not super familiar with LaTeX I haven't been able so far to find what is causing this. Therefore I was wondering whether you guys would be able to find what is causing it. Here is my preamble:

        %layout,        % Allow visualisation of all the margins
        subfiles,       % For seperate main and sub documents
        graphicx,       % For image modifications and the figure enviroment
        amsmath,        % For the AMS math styles
        amssymb,        % The extended AMS math symbol list
        amsthm,         % For use of theorems (works together with thmtools)
        fancyhdr,       % For fancy headers and footers on pages
        %gensymb,       % For easy generic symbols (uniform use in math and text mode)
        %sidecap,       % For use of captions next to a float (figure, table, etc)
        %subcaption,    % For easy subfigures in a plot (with nice captions)
        tikz,           % Difficult drawing of awesome vector plots
        %listings,      % For listing pieces of code in a nice and neat way
        multicol,       % For easy local multicolumn use
        color,          % For handy color deafinitions (used cause of styling)
        %calc,          % To calculate stuff for the back-end
        %mdwlist,       % For customizing lists
        thmtools,       % Lets you define your own theorem style (used for all the fancy theorems, definitions etc.)
        etoolbox,       % Allows adjustment of commands (used to reset the claim counter at the end of a proof).
        xspace,         % Makes latex not eat spaces after commands
        hyperref,       % Makes links, references, the Table of Contents, etc. clickable.


        %\sepackage[margin=2.5cm]{geometry}     % Change the shape of a page (custom margins etc.)
        %paper=a4paper slightly changes the style through the whole document.
             %%%% We set the margins for whole document here, except the titlepage. The titlepage uses special margins; see titlepage.tex.


%%% This is about changing the headers and footers (i.e. Top and bottom of the page)

\pagestyle{fancy}% use fancyheaders with the bar on the top
\fancyhf{} % Clear the normal style
\fancyhead[L]{\bfseries\leftmark} %this places the section number and name in the top left
\fancyhead[R]{\bfseries\thepage}% this places the pagenumber in the top right

%%%%        Theorem style

% The set-up is as follows, first you give the 'style' of your theorem. This determines whether it for instance is plain, or italic. Secondly you can give an option for the symbol on the end, normally it is nothing. But you could add some to increase the readability of your text. Finally you can use numberwithin to add the number of your section/theorem before your equations. This is useful if you want to keep the numbers of your equation in check (In this thesis there where over a 100) and keeps in order where the equations are.
%Finally you can use sibling to let different 'theorems' count together. Hence you will get Theorem 1 Definition 2 Claim 3, instead of Theorem 1 Definition 1 Claim 1. This is a matter of taste.

% Theorem definitions
\declaretheorem[style=definition,numberwithin=subsection]{definition} %If you want your theorems to be counted per section instead of subsection, then just remove the sub from the numberwithin
\declaretheorem[style=definition,qed=$\triangle$,sibling=definition]{example}% sibling says with what type of theorems you wan the numbering to count with.


\AtEndEnvironment{proof}{\setcounter{claim}{0}} % Sets the claim number to 0 after ending a proof

% these environments are very nice and all, but it is a bit much to type every time, so for normal theorem-proof cases you can make your own commands like these. 

\newcommand{\thm}[2]{\begin{theorem} #1 \begin{proof} #2 \end{proof} \end{theorem}}
\newcommand{\lm}[2]{\begin{lemma} #1 \begin{proof} #2 \end{proof} \end{lemma}}
\newcommand{\df}[1]{\begin{definition} #1 \end{definition}}
\newcommand{\clm}[1]{\begin{claim} #1 \end{claim}}


% Comment/uncomment the following to disable/enable parindents:

%%%% Add the bibliography with some settings:
% package:
% choose brackets:  default: round (), square [], curly {}, angle <>
% choose separation between multiple citations (\cite{a,b}):
%% default: colon ;, comma ,
% choose citation style:
%% default: authoryear Johnson (2017), numbers (25) or super ^[25]
% option: choose sort (\cite{13,5} gives [5,13]) or sort&compress
%% in authoryear mode, sort&compress changes Johnson[2016] Johnson[2017] to
%% Johnson[2016,2017].
% option: longnamesfirst (author names will be shortened (et al.) after the first time
% option: nonamebreak (can solve hyperref bugs, but will instead cause hbox problems)
% https://en.wikibooks.org/wiki/LaTeX/Bibliography_Management#Natbib

% bibliography sort style:
\bibliographystyle{apacite} %references in order of call
%more options: default: plainnat, apsrev, unsrtnat, abbrvnat, rmpaps (different sortings and abbreviation settings, no idea which is which)


%%%%% frontmatter/mainmatter/backmatter:
    \pagenumbering{roman}} %small Roman numbers

    \pagenumbering{arabic}} %normal numbers

    \cleardoublepage %% double page style
    %\clearpage %% single page style
    \pagenumbering{Roman}} %capital Roman numbers

\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\else % if luatex or xelatex
% use upquote if available, for straight quotes in verbatim environments
% use microtype if available
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
\urlstyle{same}  % don't use monospace font for urls
% Add ',fontsize=\small' for more characters per line
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
}{% else
\setlength{\parskip}{6pt plus 2pt minus 1pt}
\setlength{\emergencystretch}{3em}  % prevent overfull lines
% Redefines (sub)paragraphs to behave more like sections

%%% Use protect on footnotes to avoid problems with footnotes in titles

%%% Change title format to be more compact

I hope you guys can find what is causing the section numbers to dissappear since i do need them.

  • change the counter value to 3, i.e. \setcounter{secnumdepth}{3} to get the section numbers...
    – MadyYuvi
    Commented May 10, 2019 at 11:01
  • % Redefines (sub)paragraphs to behave more like sections those definitions are not good really, you would be better without them (unrelated to the numbering though), also do not load fixltx2e package (it does nothing other than make a warning saying it should not be used) Commented May 10, 2019 at 11:09
  • you are loading multiple packages twice (latex ignores the second one so it does nothing other than make your preamble look complicated. graphcs (loaded by graphicx , amssymb, amsmath, color, also do you really want lipsum loaded in your real document? Commented May 10, 2019 at 11:13

1 Answer 1


You have


which says to avoid numbering, increase that number (the default is 4 which means to number headings from subsection and higher, but not number paragraphs and subparagraphs)

  • Thank you! This indeed fixed it.
    – Micha
    Commented May 10, 2019 at 11:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .