通过从Git获取更改的tex文件来在Bash中自动化LaTeX编译?

问题描述 投票:0回答:1

我想将已更改的Tex文件从Git转换为Bash变量,以便可以自动执行已更改的tex文件的编译过程。

示例

$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   Article/main.tex

从git获取路径后,我想在其中使用命令pdflatex Article/main.tex运行脚本的地方。

如何将更改后的Tex文件从Git转换为Bash变量,以便使用pdflatex进行编译?

建议

  1. latexdiff here
  2. latexmk here
  3. 由deadObed发表评论
  4. [Lea Gris评论中的git diff --name-only
bash git latex pdflatex
1个回答
0
投票

有很多选择。我感谢Lea Gris在这里致力于解决方案。

替代项

1。对于单个更改的Tex文件,将执行此操作

pdflatex `git diff --name-only | grep *.tex`

2。对于更改的Tex文件的许多目录,它们必须具有不同的名称,其中已编译的PDF文件将出现在当前目录中。

git diff --name-only '*.tex' | xargs -l1 pdflatex

3。对于同名的,已更改的Tex文件,Lea评论(尚未运行,试图理解它,我选择解释here)]]

git diff --name-only '*.tex' | xargs -l1 -I{} sh -c 'cd "${1%/*}"; pdflatex "$1"' _ {}

固体溶液

尝试Latexmk,make的特殊版本,仅针对LaTeX进行所有重新编译和重建的事情

  1. 乳胶项目here的Makefile

  2. Latexmk更多here

© www.soinside.com 2019 - 2024. All rights reserved.