# Minitoc Package: Secttoc works just after changing section to part and back to section

I have no idea why, but if I use \secttoc it works only for the section if I change the section to "part", compile it, and change it back to "section"

\documentclass[12pt,a4paper,titlepage]{article}
\usepackage{pdflscape}
\usepackage[ngerman]{babel}
\usepackage[ansinew]{inputenc}
\usepackage[usenames]{color}
\usepackage{hyperref}
\usepackage{minitoc}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{mathptmx}
\usepackage{fancyhdr}
\usepackage{a4}
\usepackage{epic}
\usepackage{eepic}
\usepackage{parskip}
\usepackage{eurosym}
\usepackage{amssymb}
\usepackage{wrapfig,lipsum,booktabs}
\usepackage{url}
\usepackage{appendix}

\usepackage{enumerate}
\usepackage[authoryear,round]{natbib}
\usepackage{etoolbox}
\makeatletter
\usepackage[flushmargin, hang]{footmisc}

\begin{document}
\dosecttoc
\begin{titlepage}
\end{titlepage}
\setcounter{tocdepth}{3}
\tableofcontents

\begin{appendices}
section{Anhang}
\mtcsetrules{secttoc}{off}
\renewcommand{\stctitle}{Anhangsverzeichnis}
\secttoc
\subsection{Exampletext}
\end{appendices}

\end{document}

• \section{Anhang} is better than section{Anhang}, I suppose ;-) But your question is quite unclear to me
– user31729
Apr 13, 2015 at 20:07
• Tables of Contents usually require two latex runs for the change to propagate to the output: the first writes it to an auxiliary file; the second reads the auxiliary file and produces the updated information. Are you sure you aren't keeping one step out of sync with the requirements?
– jon
Apr 13, 2015 at 20:22

The fix is to delete the \adjuststc command. You also need to fix the typo \section{Anhang} not section{Anhang} as @Christian Hupfer said.
In your MWE there is nothing that needs to be adjusted, so I guess \adjuststc is causing a problem, not fixing a problem that doesn't exist.
You need to run LaTeX more than once to get the right output. If your LaTeX editor doesn't do that automatically, an easy way is use a program like latexmk or texify (depending on what TeX distribution you are using).
Note, Minitoc can be a bit fragile if you make a "low level" mistake like this. If you still get a crash, delete all the temporary files like *.maf, *.mtc*, *,stc* and try again.