15

Assume that I want to add a part of a paper I've wrote into a different document.

Inside the new document, the part of the paper should be only a section, so every section of the paper would become a subsection, and every subsection should become a subsubsection.

For example, assume I have the document:

\documentclass{article}
\begin{document}
   \section{Doc A}
   \input{docA}
   \section{Conclusions}
   Very good.
\end{document}

While docA.tex has:

\section{Hello}
This should actually be a subsection.
\subsection{World}
And that one is a subsubsction.

When compiling the document I get:

enter image description here

How do I make every section/subsection in the input file go one level lower, such that the Hello would become Subsection 1.1, and World will then be Subsubsection 1.1.1 (i.e., there should only be 2 sections in the outer doc)?


Obviously, this can be done by modifying docA, but I prefer not to change it if possible.

4
  • Have a look at package coseuol.
    – Johannes_B
    Feb 8, 2016 at 11:49
  • @Johannes_B - I can't seem to find the package. Do you have a link or something to it? (is it spelled correctly?). Thanks !
    – R B
    Feb 8, 2016 at 11:56
  • No, typo. ctan.org/pkg/coseoul
    – Johannes_B
    Feb 8, 2016 at 12:03
  • Thanks @Johannes_B. Unfortunately, it doesn't seem to work for me, as it requires to modify the way docA works (replace \section and \subsection with level-downs). I want to use the input document without changing it.
    – R B
    Feb 8, 2016 at 12:18

1 Answer 1

22
\documentclass{article}
\begin{document}
   \section{Doc A}
   {
\let\section\subsection
\let\subsection\subsubsection
\input{docA}
}
   \section{Conclusions}
   Very good.
\end{document}
1
  • Took me about 45 min to find this answer after digging through all the standard \input \include noise. Thanks David!
    – FizxMike
    Jul 23, 2017 at 20:06

You must log in to answer this question.

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