2
%********a.tex
\documentclass{book}
\usepackage[final]{pdfpages}
\begin{document}
Hello
\includepdf[pages=-]{b.pdf}

\end{document}

Now b.tex

%%%%%%%%%%
%********b.tex
\documentclass{book}
\begin{document}
World!
\end{document}
%%%%%%%%%%%
user50054
  • 251
  • 1
  • 6
  • 1
    You can have a look at our starter guide to familiarize yourself further with our format. Please ask your question in the body and not only at the title line. –  Apr 22 '14 at 08:01
  • 2
    It's not clear to me what you want, since it seems to me that what you have written is a solution. – pst Apr 22 '14 at 08:04
  • I want to write a book with 400 pages and my book have 4 part,i want to type the second part at first.at the end i want to unified 4 part. – user50054 Apr 22 '14 at 08:13
  • This would lead to inconsistencies, most probably. Why do you not use the \part{Book 1} ... \part{Book 4} command? You can split your TeX code however to several .tex files and include them afterwards in any order you desire. –  Apr 22 '14 at 08:16

2 Answers2

2

Perhaps, this works as a 'kickstart' for the OP...

Change the title, styles at will ...

\documentclass{book}



\renewcommand{\partname}{Book}

% If chapters should be reset when a new part ('book') starts then
% use this code
\makeatletter
\@addtoreset{chapter}{part}
\makeatother


\begin{document}

\tableofcontents

\part{This is the 1st book}
\chapter{The first chapter of the first part}


\part{This is the 2nd book}

\chapter{The first chapter of the 2nd part}

\chapter{The second chapter of the 2nd part}


\part{Book 3}

\chapter{The first chapter of the 3rd part}

\chapter{The second chapter of the 3rd part}


\part{Book 4}

\end{document}

Table of contents of the book with subbooks

2

I never used the syntax \includepdf[<option>]{file.pdf} so I probably ignore its advantages.

I specify the following because you mentioned in the title that you own tex sources of your files a.pdf and b.pdf.

Just editing the template from the previous answer by @Christian, I would suggest you use the command \include{}:

\begin{document}

\part{This is the 1st book}
\chapter{The first chapter of the first part}
\include{a}%% INCLUDE filename

\part{This is the 2nd book}

\chapter{The first chapter of the 2nd part}
\include{b1}%% INCLUDE filename

\chapter{The second chapter of the 2nd part}
\include{b2}%% INCLUDE filename

\end{document}

or the command \input{}:

\begin{document}

\tableofcontents

\part{This is the 1st book}
\chapter{The first chapter of the first part}
\input{a.tex}%% INPUT filename.tex

\part{This is the 2nd book}

\chapter{The first chapter of the 2nd part}
\input{b1.tex}%% INPUT filename.tex

\chapter{The second chapter of the 2nd part}
\input{b2.tex}%% INPUT filename.tex

\end{document}

to do the task. Differences between input and include here.

MattAllegro
  • 1,546