将乳胶文档合并为单个pdf

latexpages的Python项目详细描述


Latest PyPI VersionLicenseSupported Python VersionsFormat

这个工具自动编译乳胶文档集(对于工作文件, 使用pdfpages包将过程等)转换为单个组合的pdf文件。

创建一个ini文件给出集合和生成的名称和部分 它使用latexpages命令行实用程序。

latexpages将为每个核心启动一个并行排版过程 加速。

由于每个部分都是独立排版的,因此可以合并 无法合并到单个主控文档中(使用不兼容的 包装/选件、Latex-DVIPS-PS2PDF与PDFlatex等)。

安装

这个包在python 2.7和3.5+下运行,使用pip安装:

$ pip install latexpages

编译需要tex分布(例如TeX LiveMikTeX),并且 系统上提供了latexmk或miktex的texify实用程序。

可选的自动页码(见下文)要求 pdfinfo命令行实用程序(包含在poppler-utils中, miktex-poppler-binxpdf)或pdftk命令行实用程序(两者 可跨平台使用)

用法

创建一个工作目录,保存带有最新expages的纯文本ini文件 配置。将所有文档放入与 相应的.tex文件:

collection/
    latexpages.ini
    article1/
        article1.tex
        references.bib
    article2/
        article2.tex
        ...

注意:目录名不能包含空格

编辑ini文件以配置部件、它们的顺序和各种其他 选项:

[make]name=MY_COLLdirectory=_output[parts]mainmatter=
  article1
  article2

下面将对所有部分进行排版,将它们的PDF复制到输出目录, 把它们合并成一个pdf文件。默认情况下,这也会创建一个2-up 版本:

$ latexpages latexpages.ini

检查源发行版中的example directory是否有工作 完整的例子。

调用

检查latexpages命令的用法:

$ latexpages --help
usage: latexpages [-h][--version][-c {latexmk,texify}][--keep][--only <part>][--processes <n>][filename]

Compiles and combines LaTeX docs into a single PDF file

positional arguments:
  filename             INI file configuring the parts and output options
                       (default: latexpages.ini in the current directory)

optional arguments:
  -h, --help           show this help message and exit
  --version            show program's version number and exit
  -c {latexmk,texify}  use latexmk.pl or texify (default: guess from platform)
  --keep               keep combination document(s) and their auxiliary files
  --only <part>        compile the given part without combining
  --processes <n>      number of parallel processes (default: one per core)

高级选项

下面是带注释的ini文件部分,其中显示了默认选项 可用的配置设置。

make部分为 结果:

[make]name=COLL              # name of the resulting PDF filedirectory=_output      # directory to copy/put the resultstwo_up=__%(name)s_2up  # name of the 2-up version PDF filemake_two_up=true       # create a 2-up version (yes/no)# templates for the name of the copied part PDF files for each# of the three possible groups (frontmatter, mainmatter, extras)# available substitutions:#   (note that the percent-sign must be doubled here)#   %%(name)s    name of the result file (see above)#   %%(part)s    name of the part directory/filename#   %%(index0)d  zero-based index inside group#   %%(index1)d  one-based index inside groupfrontmatter=_%%(name)s_%%(part)smainmatter=%%(name)s_%%(index1)02d_%%(part)sextras=%(frontmatter)s

parts节给出了空格分隔的要编译的部件列表 和/或包括:

[parts]frontmatter=# include at the beginning, roman page numberingmainmatter=# include after frontmatter, arabic page numberingextras=# compile and copy only (e.g. a separate cover page)use_dvips=# use latex -> dvips -> ps2pdf for these parts
               # instead of pdflatex (e.g. pstricks usage)# pull the first mainmatter part into the roman page numbering areafirst_to_front=false

substitute部分填充用于创建 组合文档。对于默认模板,这允许设置pdf 元数据

[substitute]# options for \usepackage{hyperref}author=# pdfauthortitle=# pdftitlesubject=# pdfsubjectkeywords=# pdfkeywords

template部分允许自定义组合的详细信息 文档

[template]filename=# use a custom templatefilename_two_up=# different template for 2-up versionclass=scrartcl   # use this documentclass# documentclass options for combination and 2-up versionoptions=paper=a5options_two_up=paper=a4,landscape# includepdfmerge options for combination and 2-up versioninclude=fitpaperinclude_two_up=nup=2x1,openright

compile部分允许更改 使用的编译命令。

[compile]latexmk=-silent                   # less verbosetexify=--batch --verbose --quiet  # halt on error, less verbose# only used with texify (latexmk calls these automatically)dvips=-qps2pdf=

最后,paginate部分控制latexpages-paginate(见上文)。

[paginate]update=\\setcounter\{page\}\{(\d+)\}  # search/update regexcontents=# part with table of contentsreplace=\\startpage\{(\d+)\}          # toc line search/update regex

许可证

latexpages分布在MIT license下。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
来自控制器的java集合引用应用程序?   java无法插入到swagger 2.0文档中常见错误代码的html链接   循环中的java输入不匹配异常   java Spring批处理集成运行并行作业的远程分区   在Android中使用Gson在自定义类的ArrayList中读取java   C++规范化图像描述符OpenCV-java   java Andmore的Android软件包生成器失败,错误与sun/misc/BASE64Encoder相关   如何用java从多部分数据格式创建接收代码   java用文件填充数组   分页如何在Java代码中实现下一步按钮单击?   我们能用泛型参数动态调用Java接口方法吗?   java从另一个项目中定义的类调用静态方法需要为这两个项目添加库   反射:运行时类型信息是否存储在java中?   编写一个Java程序,允许用户输入自己的公式并进行计算   java Tomcat多个webapps文件夹   java比较两个xml文件并向第一个xml文件添加新标记   反射我能用正则表达式在java中找到类的方法吗?