Large file source file split edit compilation \ include {filename}

Source: Internet
Author: User
Large documents, if all the text is input in the same. in the Tex file, the size of the file is immeasurable, the structure of the file is messy, and the positioning of the text is also a headache. Fortunately, latex provides a structured processing command --- include. The command \ include {filename} (filename does not contain the suffix. Tex) can insert the content of the filename file to the current position during compilation. Key points:
  • In the main document (such as main. Tex), write the introduction area, including which macro packages, and define the style, Font, line spacing, and reference of the entire document.
  • In the main document body area, use the command \ include {filename} to include the sub-document.
  • The sub-document starts with \ chapter {} And \ section {}. You do not need the introduction area, title, author, and other information.
  • You can reference tags of other files in any other file.
See the following example:
  • Main. Tex
 
 
  1. % !TeX:pdflatex,pdfTeXify
  2. % Test large files split multiple source files for compilation.
  3. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  4. %% main.tex
  5. % Only create the introduction area in main. Tex and include sub-Files
  6. % The subfile does not need the introduction area or begin {document }.
  7. % \ Chapter {}, \ section {}, and so on.
  8. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. \documentclass[UTF8]{ctexbook}
  10. \usepackage{graphicx}
  11. \usepackage[CJKbookmarks=true,colorlinks,linkcolor=black,anchorcolor=blue,citecolor=green]{hyperref}
  12. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  13. %%%%%%%%%% Text body %%%%%%%%%%
  14. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  15. \begin{document}
  16. \youyuan
  17. \sffamily
  18. \ Title {source file splitting and compilation}
  19. \author{Lin\TeX9527}
  20. \date{2014--09--04}
  21. \maketitle
  22. \tableofcontents
  23. \include{file1}
  24. \include{file2}
  25. \end{document}

  • File1.tex
 
 
  1. \ Chapter {fruit}
  2. \ Section {grape}
  3. Grape, purple black and purple black, sweet, really sweet.
  4. \ Section {watermelon}
  5. Watermelon, round and round.
  6. \ Section {dog and watermelon}
  7. See Figure \ ref {FIG: Dog} on Page \ pageref {FIG: Dog }.

  • File2.tex
 
 
  1. \ Chapter {animal}
  2. \ Section {persons}
  3. People and people.
  4. \ Section {dog}
  5. Dogs are good friends of humans.
  6. \begin{figure}[htbp]
  7. \centering
  8. % Requires \usepackage{graphicx}
  9. \includegraphics[scale=0.5]{dog}\\
  10. \ Caption {two cute husky} \ label {FIG: Dog}
  11. \end{figure}

The structure file of the entire project:

You can click the compile button in any source file.



From Weizhi note (wiz)

Large file source file split edit compilation \ include {filename}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.