I've created a command, \importchapter{<title>}{<folder>}{<file>}{<minitables>}, to import the main <file> of a chapter from a <folder> and automatically generate a \chapter{<title>}.

biblatex is used to manage bibliography. A refsegment is created for each chapter, and \printbibliography[segment=\therefsegment] is done at the end of \importchapter.

titletoc is used to place local tables of contents and/or lists of figures and/or tables in some of the chapters of a report. startcontents/startlists are placed before importing the chapter file and stopcontents/stopslists at the end of \importchapter.

Since \printbibliography is not shown if no citations are done, I don't have to worry about it. However, the titles of the partial tables and lists are shown even if there are no elements to show in that chapter. I decide when to show then manually putting \DOmc, \DOmf and/or \DOmt in the <minitables> parameter of \importchapter. But I'd like them to automatically check if there is something to show, just like \printbibliography.

I suppose I should look into *.ptc, *.plf and *.plt and check if there is any \contentsline between chapter@k and chapter@k+1 for the kth chapter. But I have no idea about how to do it. Is it possible?

In the following example, the List of Figures should be shown only in the first chapter.


\usepackage[backend=biber,style=ieee-alphabetic,natbib=true,sorting=ynt]{biblatex} %added
\addbibresource{IEEEfull.bib} %added

  \begin{figure}[!h]\caption{First figure}\end{figure}
  \begin{figure}[!h]\caption{Second figure}\end{figure}
 \section{First back}
 \subsection{First sub back}


\newcommand\DOminitoc[2]{ \section*{#1} #2 }

\newcommand\DOmc{ \DOminitoc{ \contentsname }{ \printcontents[chapter]{}{1}{} } }
\newcommand\DOmf{ \DOminitoc{ \listfigurename }{ \printlist[chapter]{lof}{1}{} } }
\newcommand\DOmt{ \DOminitoc{ \listtablename }{ \printlist[chapter]{lot}{1}{} } }





  • I believe, this could be done much easier with minitoc, with some additional features, however.
    – user31729
    Sep 20, 2014 at 8:05
  • I changed to titletoc because I 'm using titlesec and it is not compatible with minitoc. I asked about it here. Do you think it would be better to hook minitoc?
    – umarcor
    Sep 20, 2014 at 14:57


You must log in to answer this question.

Browse other questions tagged .