# How to use several sectioning trees (Chapter, Section…) in parallel and in the same document

I am actually writing my thesis and I would like to insert one of my paper inside, but keeping the original numbering. The simplest way to understand what I am trying to do is to give an example:

Chapter 1

1.1 Chapter 1 Section 1
1.2 Chapter 1 Section 2
...


Chapter 2 2.1 Chapter 2 Section 1 (Paper to be inserted) 1 First section of the paper 1.1 First subsection of the first section of the paper 1.2 Second subsection of the first section of the paper ... 2 Second section of the paper ... 2.2 Chapter 2 Section 2 (Comments on the paper) Chapter 3 3.1 Chapter 3 Section 1 3.2 Chapter 3 Section 2

So the question is how to start a new structure tree without stopping the main one. I don’t need the second structure to be in the table of contents so one possibility would be to replace all the \section{blabla} by \section*{blabla} and then manually replace all the \ref by their corresponding reference number manually. This is quit a long process and each time there is a modification in the paper, everything as to be updated manually. If anybody know how to do that automatically

Best

Florian

Edit; With the code

\documentclass[a4paper,11pt,fleqn]{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\begin{document}
\chapter{Chapter 1}
\section{Section 1}
\section{Section 2}
%Here I want to include one of my paper already published, using my template but keeping the same notation as the original paper.
\sectionPaper{Section 1 of the Paper}
\subsectionPaper{Subsection 1 of the Paper}
\subsectionPaper{Subsection 2 of the Paper}
\sectionPaper{Section 2 of the Paper}
\chapter{Chapter 2}
\section{Section 1}
\section{Section 2}
\end{document}


The \sectionPaper of course is not working but it is here only to show what I am trying to do. I would like something similar to the package multibib that that for example creates a new bibliography when the suffix Paper for i.e. is added to \cite (\citePaper). Here I am looking for something that creates a second new and independent sectioning tree when I call for example \sectionPaper. Hoping that it is more clear now, Best.

• Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – LaRiFaRi May 19 '15 at 9:13

This is possible with a 'preliminary' version of xassoccnt (please use the bugfix version from here until the improved version has been uploaded to CTAN etc: xassoccnt v0.5a

The core feature are the \BackupCounterValues and \RestoreAllCounterValues macros that backup and restore the counter values and provide a separate 'structuring' tree. The counter values are restored at the position of the macro usage. Please note that hyperref is not confused by this since the \theH.... macros are changed and restored at well, placing new anchors.

In order to make the new 'tree' consistent, the usage of \counterwithout etc. from chngcntr might be appropiate. This depends on the level of the new tree.

\documentclass[a4paper,11pt,fleqn]{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{chngcntr}
\usepackage{xassoccnt}
\usepackage{hyperref}
\counterwithout{figure}{chapter}
\counterwithout{section}{chapter}

\begin{document}
\tableofcontents
\chapter{Chapter 1}
\section{Section 1}
\section{Section 2}
%Here I want to include one of my paper already published, using my template but keeping the same notation as the original paper.
\hrule
\BackupCounterValues[resetbackup=true]{chapter,section,subsection,figure,table,equation}
\section{Section 1 of the Paper}
\begin{figure}
\caption{Foo figure}
\end{figure}
\subsection{Subsection 1 of the Paper}
$$E=mc^2$$
\subsection{Subsection 2 of the Paper}
\section{Section 2 of the Paper}

\RestoreAllCounterValues
\counterwithin{section}{chapter}
\hrule
\section{Regular section from first chapter}
\chapter{Chapter 2}
\section{Section 1}
\section{Section 2}
\hrule
\BackupCounterValues{chapter,section,subsection,figure,table,equation}
\counterwithout{section}{chapter}
\section{Section 1 of another Paper}
\subsection{Subsection 1 of another  Paper}
\subsection{Subsection 2 of another  Paper}
\section{Section 2 of another Paper}
\section{Section 3 of another Paper}
\subsection{Subsection 1 of another  Paper}
\subsection{Subsection 2 of another  Paper}
\section{Section 4 of another Paper}

\RestoreAllCounterValues
\counterwithin{section}{chapter}
\hrule
\clearpage

\section{Regular section}

\end{document}