用于生成 Latex 文档的 makefile 选项

发布于 2024-09-09 00:02:53 字数 715 浏览 0 评论 0原文

我有一个可以通过 makefile 构建的项目,我想添加基本目录中的人员的功能,不仅能够通过 make 构建可执行文件,而且还能够构建文档通过键入 make docs 或类似内容,将 LaTeX 中的 pdf 文件放在单独的目录中。
我只需要一次生成文档,并且 .tex 文件中没有依赖项。
我没有任何递归 makefile 的经验,因此任何通用资源也将不胜感激。

附言。我没有使用 noweb 或类似的系统,我只是有一些源文件和一些单独的 .tex 文件。

期望的行为:
$ls
文档/
Makefile
source1.cpp
source1.h
source2.cpp
source2.h
$ ls 文档
Makefile
doc1.tex
$ make
=我的程序被编译=
$ 制作文档
$ ls 文档
Makefile
doc1.tex
doc1.pdf

I have a project that can be built via makefile, and I would like to add the ability for someone in the base directory to not only be able to build the executable via make, but also to build the documentation pdfs from LaTeX in a separate directory by typing make docs or something similar.
I only need one pass to generate the documentation, and there are no dependencies in the .tex files.
I don't have any experience with recursive makefiles, so any general resources would also be appreciated.

PS. I am not using noweb or similar systems, I simply have some source files and some separate .tex files.

Desired behavior:
$ ls
docs/
Makefile
source1.cpp
source1.h
source2.cpp
source2.h
$ ls docs
Makefile
doc1.tex
$ make
=my program gets compiled=
$ make docs
$ ls docs
Makefile
doc1.tex
doc1.pdf

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

是你 2024-09-16 00:02:53

我认为您可以轻松地指定一个命令来执行文档目录中的 Makefile 并运行 pdflatex -output-directory=DIR 。所以它最终会看起来像这样:

在你的顶级 Makefile 添加规则

  docs:  
      $(MAKE) -C doc all

然后在 doc 目录中你可以添加一个带有如下规则的 Makefile

%.pdf: %.tex 
      $(PDFLATEX PATH) --output-dir=$(DIR) 
lt; 

I think you could easily just specify a command to execute the Makefile in the docs dir and run pdflatex -output-directory=DIR. So it would end up looking something like this:

In your toplevel Makefile add the rule

  docs:  
      $(MAKE) -C doc all

Then inside the doc dir you can add a Makefile with a rule like

%.pdf: %.tex 
      $(PDFLATEX PATH) --output-dir=$(DIR) 
lt; 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文