16

I have arranged 700 individual files in 18 different folders, as shown in the attached image. This was open source project to get it typed page by page. The number of pages varies for each folder.

Now my trouble is how to integrate into one file in book layout.

When I was creating document in this fashion, I thought I would manually put all in one folder and run it, which I can still do but just wanted to know if there is any easier way to do it.

Thanks for your help.

enter image description here

2
  • 1
    It's not much clear what you are asking, for me. Can you explain it better? (I'm sure you are not asking for \include-like commands) – karlkoeller Jul 5 '13 at 18:50
  • 1
    You may have a look at the answers provided in the following link tex.stackexchange.com/a/7657/31058 – Ludovic C. Jul 5 '13 at 18:55
13

I am not sure of want you have in this files and what you want obtain, but supposing that you have a main file book.tex in the directory "Bellankonda", and files as chap_page_015 are only chunks of body text (no fully compilable LaTeX documents) and you want obtain a unique PDF merging all these chunk, then the book file could be somethig as this:

\documentclass{book}
\begin{document}
\input{Chapter_02/chap_page_015}
\input{Chapter_02/chap_page_016}
\input{Chapter_02/chap_page_017} 
% etcetera
\end{document}

If the subfiles are something as whole chapters, that must start-end newpages, may be you want use \include instead of \input. Please see When should I use \input vs. \include?

If the child documents are complete LaTeX files with preamble (starting with \documentclass and ended with \end{document} you can use the same file put including in the preample the packages standalone, or docmute, or subfiles (in this case use \subfiles instead of \input). The child documents must be all of the same class, in other case, you can try the combine class, but usually this usually this means asking for troubles. Another option in this case could be produce PDF files of individual pages and merge all with pdfpages package.

Edit

As the comment of Aku ask for a loop to write automatically the \input commands, a solution could be the \foreach command. The code below is a simple example where the main document include from page1.tex to page5.tex using this command:

% Main file  
\documentclass{article}
\usepackage{tikz}
\begin{document}
 \foreach \c in {1,...,5}{\input{page\c.tex} }
\end{document}

With the subdocuments made from the commandline in this way:

echo " page {\em number 1}\par " > page1.tex  
echo " page {\em number 2}\par " > page2.tex  
echo " page {\em number 3}\par " > page3.tex  
echo " page {\em number 4}\par " > page4.tex  
echo " page {\em number 5}\par " > page5.tex

The results must be the following:

MWE

6
  • This is exactly want I am doing right now, I created file names in excel and pasted them like you have shown in the example, I used include instead of input. But I was wondering if there is any easy way to include all the files, may be some sort of for loop to do it rather than pasting all file names. They are not fully compilable latex documents, they are just text files. for ease I created a text file for each page. – Aku Jul 9 '13 at 13:44
  • @Aku See the updated answer. – Fran Jul 9 '13 at 20:55
  • I'm including files from a directory which is not a subfolder, and I get this error message: I can't write on file '\Users[...]\CommonFiles\filename.aux' – Paolo Polesana Jan 24 '16 at 10:02
  • @Fran, I'm including files from a directory which is not a subfolder, and I get this error message: I can't write on file '\Users[...]\CommonFiles\filename.aux' – Paolo Polesana Jan 24 '16 at 12:55
  • @PaoloPolesana This seem a different problem but you not provide enough information. Please post as a new question with a minimal working example (a code that should work but produce that error). – Fran Jan 24 '16 at 21:20

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.