Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import specific section from another tex file

Tags:

latex

I'm trying to import a very specific section or subsection from another latex document.
I basically have an export tool that creates a nice tex document and makes the sections for the headers. It's nice to call the whole file but at some point in my combined document I have to just call a subsection over and over again.

How do I call a specific subsection from a whole document?

I have a file call aa.tex and I'm able to use \subimport{}{aa} and it brings in the whole file.

In the file it look similar to

\section{Test Descriptions}
\subsection{Setup}
Hardware and Software... CPU, GPU, RAM etc
\subsection{test1}
\subsubsection{Steps1}
a,b,c,
\subsubsection{Steps2}
a,b,c

I want to be able to call \subsection{setup} over and over again because of what I have to reference.

So, logically how do I only call \subsection{Setup} from aa.tex?

like image 987
Micheal Zrax Avatar asked Sep 12 '25 00:09

Micheal Zrax


1 Answers

With the catchfilebetweentags package one can selectivity input parts of a file

Main file:

\documentclass{article}

\usepackage{catchfilebetweentags}

\begin{document}

zzz

\ExecuteMetaData[subdocument]{setup}

zzz

\ExecuteMetaData[subdocument]{setup}

\end{document}

subdocument.tex:

xxx

%<*setup>

\subsection{Setup}

%</setup>

xxx
like image 90
samcarter_is_at_topanswers.xyz Avatar answered Sep 15 '25 05:09

samcarter_is_at_topanswers.xyz