1

How to combine tex files in different folder into single. I would like to combine all the chapters which I saved in separate folder. Each folder contains \documentclass[10pt,a4paper,final]{report}... file along with all the picture files. Thanks for your assistance.

3

Have a look at the combine class. The following example creates two separate files, import1.texand import2.tex. Starting with \pagestyle{combine} the actual file begins. It combines the two separate files by importing them. This way you can compile each document separately but also together.

combine example

\documentclass{combine}

\begin{filecontents}{import1.tex}
\documentclass{article}

\author{Leonardo da Vinci}
\title{Inventions}

\begin{document}
\maketitle

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. 
\end{document}
\end{filecontents}

\begin{filecontents}{import2.tex}
\documentclass{article}

\author{Albert Einstein}
\title{Relativity}

\begin{document}
\maketitle

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. 
\end{document}
\end{filecontents}


\pagestyle{combine}

\begin{document}

\tableofcontents
\begin{papers}

\coltoctitle{Inventions} % first article title into main ToC
\coltocauthor{Leonardo da Vinci} % first authors into main ToC
\label{import1}
\import{import1}

\coltoctitle{Realtivity} % first article title into main ToC
\coltocauthor{Albert Einstein} % first authors into main ToC
\label{import2}
\import{import2}
\end{papers}


\end{document}
  • Dear Uwe,Thanks for you quick response. I found one problem while running the code. It tried to instal the package for combine but it give error. How can I solve this problem. Your help is appreciated. Thank you. – Sanjeev Prajapati Dec 6 '14 at 16:42
  • 1
    You didn't tell which error occured. I always recommend to use the complete installation of TeX Live as it has "all batteries included". I did not install the combine package on my machine, it was part of TeX Live. – Uwe Ziegenhagen Dec 6 '14 at 16:59
  • ! LaTeX Error: File 'combine.cls' not found – Sanjeev Prajapati Dec 6 '14 at 17:31
  • 1
    @SanjeevPrajapati combine.cls is in tex live (2013 at the very latest) and in miktex. presumably therefore you're using an “old” tex live bundling into a linux system (or alike). you'll have to install your own copy to some address like `$HOMETEXMF/tex/latex/combine/.. – wasteofspace Dec 8 '14 at 0:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.