# Minitoc and import: how to specify location of mtc file?

In the project im working in, the structure is as follows

.
├── a
│   └── main.tex
├── b
│   └── main.tex
├── main.tex


The root main file is

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{import}
\usepackage{tocbibind}
\usepackage{minitoc}

\begin{document}
%
\dominitoc
\faketableofcontents

\import*{a/}{main}
\import*{b/}{main}
\end{document}


and the a/main.tex and b/main.tex files would ideally be

\chapter{Chapter}
\minitoc
\section{Section}
\subsection{Subsection}


Unfortunately, the minitoc doesn't appear. After compiling, I have in the root directory various mtc files (for readability, most files are hidden out)

.
├── [4.0K]  a
│   └── [  69]  main.tex
├── [4.0K]  b
│   └── [  69]  main.tex
├── [   0]  main.mtc
├── [   0]  main.mtc0
├── [ 266]  main.mtc1
├── [ 266]  main.mtc2
├── [ 19K]  main.pdf
├── [ 284]  main.tex
└── [ 192]  main.toc


But main.log complains

(./a/main.tex¶                                                                                             |
Chapter 1.¶                                                                                                |
Package minitoc Info: I0006¶                                                                               |
(minitoc)             main.mtc1 is empty on input line 3.¶


The way I found to get the minitoc is to copy/paste main.mtc1 in a/. and main.mtc2 in b/. So, obviously, because of the command import{a/}{main}, minitoc looks for the mtc files in the a/ and b/ directories (which is obviously the role of import...).

Another solution I found is to add a minitoc.tex file in the root directory

.
├── a
│   └── main.tex
├── b
│   └── main.tex
├── main.tex
├── minitoc.tex


Which contains just

\minitoc


and to change a/main.tex and b/main.tex as follows

\chapter{Chapter}
\setcounter{mtc}{1}%Or 2, according to the chapter number
\import{../}{minitoc}
\section{Section}
\subsection{Subsection}


The trouble of this solution is that I have to set the counter manually. It's not that bad, but is there any better automatic solution ?

• I suggest to use \input{a/main} instead, and write \faketableofcontents to main.tex. – user31729 Oct 8 '14 at 20:04
• Hi Christian. Thanks for the answer. The problem is that I'd like to use import and note input/include since my real folder setup has more steps down (I mean, 3 or 4 nested folders and inputs). Using import helps me to move folders across the hierarchy without changing the paths in the various inputs. – Vser Oct 9 '14 at 9:09
• And btw, what's the point of moving the faketableofcontents ? – Vser Oct 9 '14 at 9:13