zoukankan      html  css  js  c++  java
  • Latex文件如何拆分进行独立编译?

    Latex文件如何拆分并进行独立编译?

    --latex源文件分批独立编译


     
     
    最近使用Latex编写长文档,对于文件的组织有些困扰。
     
    如果LaTeX文档比较大,可以考虑拆分为几个部分。比如编辑一本书的时候可以将各章独立为chap1.tex,chap2.tex,chap3.tex,然后在主文件main.tex中包含进来:
    documentclass{book}
    egin{document}
    itle{A LaTeX Book}
    author{cohomo@blogbus}
    date{}
    maketitle
    input{chap1}
    input{chap2}
    input{chap3}
    end{document}
    上面的input命令可以改为include,区别在于,input可以放在导言区和正文区,包含的内容不另起一页;而include只能放在正文区,包含的内容另起一页。另外CJK中还有CJKinput和CJKinclude命令。
     
    还有个问题就是,如何使得各章既可以被包含在另一个文件中也可以独立编译呢?方法是将main.tex和chap1.tex作如下修改:
     
    % main.tex
     documentclass{book}
    defallfiles{}
    egin{document}
    itle{A LaTeX Book}
    author{cohomo@blogbus}
    date{}maketitle
    input{chap1}
    input{chap2}
    input{chap3}
    end{document}
     
    % chap1.tex 
    ifxallfilesundefined
    documentclass{article}
    egin{document}
    itle{Something in Title}
    author{cohomo@blogbus}
    date{}
    maketitle
    else
    chapter{Chap1's Title}
    fi
    section{First Section}
    section{Second Section}
    ifxallfilesundefined
    end{document}
    fi
    这样编写长文档就很方便和灵活了。
  • 相关阅读:
    JSON
    FBV & CBV
    django Tips
    Django2.2
    cookie & session
    ajax请求
    视图函数
    模板语法
    模板继承、组件
    python之路-----多线程与多进程
  • 原文地址:https://www.cnblogs.com/tsingke/p/6390390.html
Copyright © 2011-2022 走看看