LaTeX tips on how to split source files and compile _latex separately

Source: Internet
Author: User

When processing a large document, the file is often divided into sections to compile separately, when we can use the command provided by Latex \input \include \includeonly \input{texfile}

The file name simply needs to specify the base name, without the extension. Tex, which is equivalent to entering the contents of the file "file name. Tex" directly into the location of the command \input.

This command can be placed anywhere in the document (introduction or body area) and can be nested with each other.

You can place a frequently used introduction in a separate file and use it at the top of the source file.

Add more than one \input command between \begin{document}....\end{document}. The introduction area to add \listfiles can be read into the list of documents. \include{texfile}

The disadvantage of using the \input command is that all files will be reread and processed every time the article (regardless of that part) is merged through the \input command. If you use the \input command to load only that particular file, the automatic numbering of all page numbers, chapters, illustrations, and formulas starts at 1, which causes cross-references to become confusing. A better approach would be to use the \include command.

It can only be placed in the body area of the document, not nested, and used in conjunction with the command \includeonly{file list.

The file manifest lists the files that are currently being processed (the file name does not need to be appended. Tex, each filename is separated by commas). If the filename after the \input command is in the file manifest, this command is equivalent to

\clearpage\input{filename}\clearpage,

Otherwise the equivalent of a page change. The document should therefore be split at the beginning of the new page, such as between chapters and chapters. The \include command can help save us a lot of valuable compilation time. Its main advantage is that additional information about pages, chapters, and formula numbers can be provided by the \includeonly command, so cross-references to such commands as \ref and PAGEREF commands can generate the correct results. This command can be used multiple times, with only one required introduction area.

Example: Edit a book consisting of 8 chapters

\documentclass{book}
Introduction area
\includeonly{...}
\begin{document}
\frontmatter
\INCLUDE{TOC}
\mainmatter

\INCLUDE{CHAPT1}
...
\INCLUDE{CHAPT8}

\backmatter \printindex
\end{document}

Where the Toc.tex file consists of the following text

\SETCOUNTER{PAGE}{7}
\tableofcontents
\listofcontents
\listoffigures

You can selectively process each chapter by adding the appropriate entry in the \includeonly command, such as \includeonly{toc,chapt8} (this is chapter 8th).

\includeonly


Broad and generalized:
\input Insert does not open new page
\include Insert Open new page
\includeonly Insert multiple files, you can compile a file, improve efficiency, search Mytex post, he sent a template.



From:http://blog.sina.com.cn/s/blog_5e16f1770100gef0.html

http://blog.163.com/heyanqiner@126/blog/static/17342355820115174147153/

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.