% !TeX:pdflatex,pdfTeXify
% 测试大型文档拆分多个源文件进行编译。
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% main.tex
%% 只在 main.tex 当中建立导言区,并include子文件
%% 子文件不需要导言区、begin{document},只需
%% \chapter{}、\section{}等等。
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[UTF8]{ctexbook}
\usepackage{graphicx}
\usepackage[CJKbookmarks=true,colorlinks,linkcolor=black,anchorcolor=blue,citecolor=green]{hyperref}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%% Text body %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\youyuan
\sffamily
\title{源文件拆分编译}
\author{Lin\TeX9527}
\date{2014--09--04}
\maketitle
\tableofcontents
\include{file1}
\include{file2}
\end{document}
\chapter{水果}
\section{葡萄}
葡萄,紫黑紫黑的,甜,真甜。
\section{西瓜}
西瓜,圆又圆。
\section{狗狗和西瓜}
见第\pageref{fig:dog}页的图\ref{fig:dog}。
\chapter{动物}
\section{人}
人,人心隔肚皮。
\section{狗}
狗是人类的好朋友。
\begin{figure}[htbp]
\centering
% Requires \usepackage{graphicx}
\includegraphics[scale=0.5]{dog}\\
\caption{两只很萌的哈士奇}\label{fig:dog}
\end{figure}
大型文档源文件拆分编辑编译\include{filename}
原文:http://www.cnblogs.com/LinTeX9527/p/3994804.html