1

I want to extract only the body of a tex file (say, mwe.tex), and reuse that body as a child file of another tex file by \input. To do so, I have to remove the preamble and \begin{document} and \end{document}.

I tried to extract the contents of text in \begin{document}...\end{document} and produce a child tex file (say mwe-child.tex), using extract package following this answer. However, mwe-child.tex does not contain any portion of mew.tex.

What am I missing when I use extract package? Or is there another way to programmatically extract the contents of the body (inside between \begin{document}...\end{document}) in general?

mwe.tex

\documentclass[
]{article}

\usepackage[active, generate=test-extract, extract-env={document}, copydocumentclass=false, handles=false]{extract}

\begin{document}

This is a body that I want to extract.

\end{document}

mwe-child.tex

%% 
%% This is file, `test-extract.tex',
%% generated with the extract package.
%% 
%% Generated on :  2022/12/01,2:19
%% From source  :  test2.tex
%% Using options:  active,generate=test-extract,extract-env={document},copydocumentclass=false,handles=false
%%

0 Answers0