<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\levelstay{\fixedwidth{modular} to the rescue}

The \fixedwidth{modular} package provides the \fixedwidth{subimportlevel} macro to solve our problem:

\lstinputlisting[title=\textbf{article.tex}]{example/article.tex}
When you build \fixedwidth{article.tex} you'll see that the habitat and lifecycle bits are subsections under the octopus section, just as we wanted!

The \fixedwidth{subimportlevel} macro takes three arguments:
\begin{itemize}
  \item The relative path of the directory containing the file to import.
  \item The file to import
  \item The number of levels to go down when importing. Usually, this will be 0 or 1.
\end{itemize}

</pre></body></html>