推荐的乳胶构建系统?

发布于 2024-08-02 00:12:22 字数 447 浏览 6 评论 0 原文

我正在尝试找出最好的乳胶构建系统。

目前,我使用 latex-makefile,在 vim 中编辑,并在 Okular 或 gv 中查看更改。 主要问题是它有时会隐藏错误,我必须手动运行乳胶。 主要优点是它可以完成我需要的所有迭代,并且简单地提供 pdf 和 ps。

如果您有使用

  • Latex-mk
  • vim-latex
  • kile
  • lyx
  • miktex
  • Latex-makefile 的
  • 经验终极乳胶 makefile
  • 橡胶
  • 其他我没有遇到过

您会推荐它们吗?为什么/为什么不呢?

I'm trying to figure out the best build system for latex.

Currently, I use latex-makefile, editing in vim, and viewing changes in Okular or gv. The major problem is that it sometimes gets hides errors on me, and I have to run latex manually. The major advantages are that it does all the iteration I need, and offers both pdf and ps simply.

If you have experience with

  • latex-mk
  • vim-latex
  • kile
  • lyx
  • miktex
  • latex-makefile
  • the ultimate latex makefile
  • rubber
  • any others I havent come across

Would you recommend them, and why/why not?

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

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

发布评论

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

评论(15

贪了杯 2024-08-09 00:12:22

我刚刚尝试了latexmk。 如果您

latexmk -pvc file.tex 

这样做,它将自动预览(默认为 DVI)。

  • 处理依赖关系
  • DVI、ps 或 pdf
  • 迭代良好。
  • 非常可配置,请参阅 man Latexmk

缺点:

  • 它不会压缩错误,这不是很有用(解决方法:单独使用rubber-info)
  • man 文件中的错误:“有时查看器(gv)尝试读取在开始创建后但在文件完成之前更新了 .ps 或 .pdf 文件。解决方法:手动刷新(或重新打开)显示。”。 如果通过临时 .pdf 文件构建它会更好,以避免这种情况。
  • 用户不太友好。

I've just tried out latexmk. If you do

latexmk -pvc file.tex 

Then it will auto preview (DVI by default).

  • Handles dependencies
  • DVI, ps or pdf
  • Iterates fine.
  • Very configurable, see man latexmk

Downsides:

  • It doesnt condense errors, which isnt hugely useful (workaround: use rubber-info separately)
  • Bug in the man file: "Sometimes a viewer (gv) tries to read an updated .ps or .pdf file after its creation is started but before the file is complete. Work around: manually refresh (or reopen) display.". It would be better if it built it via a temporary .pdf file to avoid this.
  • Not hugely user friendly.
潜移默化 2024-08-09 00:12:22

在考虑所有这些选项一段时间后,我决定采用以下解决方案。

  • 设置 vim 在我键入时连续写入
  • 在后台运行脚本以持续构建,并在运行过程中刷新 pdf。 Latexmk 几乎已经足够好了,除了它是就地构建的,它会在 okular(我的查看器)中的错误时间重新加载。

该脚本位于 https://github.com/pbiggar/texbuild

使用rubber-info 从日志文件中获取错误和警告。 上面的脚本将日志文件保存在 t.log 中。 在维姆中:

autocmd FileType tex set makeprg=rubber-info\ t.log
autocmd FileType tex set errorformat=%f:%l:\ %m

After considering all these options for some time, I have settled with the following solution.

  • Set vim to write continuously as I type.
  • Run a script in the background to build continuously, refreshing the pdf as it goes. latexmk is nearly good enough, except that it builds in place, which gets reloaded at a bad time in okular (my viewer).

The script is available at https://github.com/pbiggar/texbuild.

Use rubber-info to get the errors and warnings from the log file. The script above saves the log file in t.log. In vim:

autocmd FileType tex set makeprg=rubber-info\ t.log
autocmd FileType tex set errorformat=%f:%l:\ %m
℉絮湮 2024-08-09 00:12:22

我自己没有使用过它,但我听说 Rubber 是一个不错的选择。

从他们的网站:

Rubber 是一个程序,其目的是
处理与该相关的所有任务
LaTeX 文档的编译。 这
包括编译文档
当然,它本身已经足够多次了
所有引用均已定义,并且
运行 BibTeX 来管理书目
参考。 自动执行
dvips 生成 PostScript 文档
也包括在内,以及使用
pdfLaTeX 生成 PDF 文档。

I haven't used it myself, but I've heard of Rubber as a good alternative.

From their website:

Rubber is a program whose purpose is
to handle all tasks related to the
compilation of LaTeX documents. This
includes compiling the document
itself, of course, enough times so
that all references are defined, and
running BibTeX to manage bibliographic
references. Automatic execution of
dvips to produce PostScript documents
is also included, as well as usage of
pdfLaTeX to produce PDF documents.

早乙女 2024-08-09 00:12:22

好吧,这个问题有点老了,但是当我在谷歌上搜索“乳胶构建系统”时就出现了,所以我想我应该加两分钱。 我尝试了基于 Makefile 的解决方案,但发现输出有点冗长且难以处理。 我认为有人可能已经为 Latex 构建了 scons 扩展,但惊喜地发现 scons 已经原生支持 Latex! 您所需要做的就是创建一个 SConsctruct 文件,如下所示:

env = Environment()  
env.PDF(target="report.pdf", source="report.tex")

要构建,只需运行 scons report.pdf。 Scons 将自动构建 report.tex 包含的 .tex 文件、处理参考书目并执行重复构建以解析所有引用 - 简单!

您可以用相同的方式创建 DVI 和 PS 文件。 有关这些构建器的更多信息,请查看 http://www .scons.org/doc/2.0.1/HTML/scons-user/a8524.html

有关 scons(make 替换)的更多信息,请参阅 http://www.scons.org/

Ok, so this question is a bit old, but it came up when I googled "latex build system" so I thought I'd add my two cents. I tried the Makefile based solutions, but found the output a bit verbose and unwieldy. I figured someone might have built a scons extension for latex, but was pleasantly surprised to find that scons already natively supports latex! All you need to do is create a SConsctruct file like this:

env = Environment()  
env.PDF(target="report.pdf", source="report.tex")

To build just run scons report.pdf. Scons will automatically build .tex files included by report.tex, handle bibliographies and perform repeated builds in order to resolve all references - simple!

You can create DVI and PS files in the same way. For more info on these builders check out http://www.scons.org/doc/2.0.1/HTML/scons-user/a8524.html .

For more info on scons (a make replacement), see http://www.scons.org/

关于从前 2024-08-09 00:12:22

我在 Scons 发布了详细答案questions/64/tools-for-automating-document-compilation/26573#26573">tex.stackexchange。

基本上,您将其放入名为 SConstruct 的文件中:

# make sure scons finds tex executables:
import os
env = Environment(ENV=os.environ)
# target and source:
pdf_output = env.PDF(target='main.pdf', source='main.tex')
# make sure that the pdf is reloaded properly (e.g., in Skim)
env.Precious(pdf_output)

您只需运行 Amazingly 即可构建 pdf

scons

,scons 将检测 中包含的文件的更改main.tex 文件以及参考书目文件!

I posted a detailed answer using Scons on tex.stackexchange.

Basically, you put this in a file called SConstruct:

# make sure scons finds tex executables:
import os
env = Environment(ENV=os.environ)
# target and source:
pdf_output = env.PDF(target='main.pdf', source='main.tex')
# make sure that the pdf is reloaded properly (e.g., in Skim)
env.Precious(pdf_output)

You can build the pdf simply by running

scons

Amazingly, scons will detect the changes in the files \included in the main.tex file and also the bibliography file!

つ低調成傷 2024-08-09 00:12:22

我使用 Eclipse 和 TexEcplise 插件来编辑 TeX 文件。 它有 LaTeX 的语法高亮。 当您要求预览未更改且已编译的 tex 文件时,它会在查看器中打开该文件。 当 tex 文件被更改时,它会在查看 tex 文件之前对其进行编译。 它会进行必要的迭代,但仅在需要时进行。

另一个优点是所有错误和警告都汇总在一个框中,并在 tex 文件中突出显示! 这是来自 屏幕截图。 sourceforge.net/" rel="noreferrer">TexEclipse 主页。

I use Eclipse with the TexEcplise add-on for editing my TeX-files. It has syntax highlight for LaTeX. When you ask a preview of a non-altered and already compiled tex file, it open the file in the viewer. When the tex file was altered, then it compiles the tex file prior to viewing it. It does the necessary iterations, but only if needed.

Another advantage is that all errors and warnings are summarised in a box and they are highlighted in the tex file! This is a screenshot from the TexEclipse homepage.

情徒 2024-08-09 00:12:22

我正在尝试橡胶一段时间。 我将在这里浓缩结果:

  • Rubber 会自动将 .eps 文件转换为 pfdlatex 的 .pdf。 然而,它似乎只对 includegraphics 宏执行此操作。 如果你有自己的宏,那就不会了。
  • rubber-info 很棒,这很神奇。 在获取错误消息和行方面,它肯定比我见过的任何其他东西都要好。 实际上,您并不需要使用橡胶来构建即可使用它。
  • 它似乎不知道何时停止迭代,经常提前停止。
  • 它在构建时会覆盖你的 PDF,这很烦人(它缺乏 Latex-makefile 的一个很好的功能,它在临时文件中构建它)。

I'm trying rubber for a while. I'll condense the results here:

  • Rubber will automatically convert .eps files into .pdfs for pfdlatex. However, it seems to only do this for includegraphics macros. If you have your own macro, it wont.
  • rubber-info is great, which is magic. It is certainly better than anything else I've seen at getting error message and lines. And you don't actually need to use rubber to build to use it.
  • It doesn't seem to know when to stop iterating, often stopping early.
  • It overwrites your PDF as it builds, which is irritating (it lacks a nice feature from latex-makefile where it builds it in a temp file).
枯寂 2024-08-09 00:12:22

我想使用您在最终答案中发布的脚本。

不幸的是,它不适合我的设置(MacVim 与 vim-latexsuite、Skim 作为查看器和 XeTeX)。 我还使用向前搜索(即我使用在 Vim 中按 \ls 会跳转到打开的查看器中 PDF 文档中相应点的功能)。

此外,我的文档不名为thesis.tex(很惊讶;它不是论文)。 因此,我做了一些我想分享的配置工作。 注意,我的 bash 技能很糟糕。

#!/bin/bash

set -x
ulimit -t 10 # sometimes pdflatex gets stuck

if [ "$1" = "" ]; then
    echo "No target name specified"
    exit 1
fi

TARGET=$1
SOURCE=$1.tex
TMPSOURCE=_$TARGET.tex
TMPTARGET=_$TARGET

while [ 1 ]; do
    # Compile a different file ($TMPSOURCE.pdf) so that it doesn't reload mid-compile
    cp $SOURCE $TMPSOURCE
    # better than running pdflatex manually, as this wont rebuild if there's nothing there.
    latexmk -pdf -silent $TMPTARGET > /dev/null

    # For rubber-info
    cp $TMPTARGET.log $TARGET.log

    if [ -e $TMPTARGET.pdf ]; then # Check the compile succeeded first
        # No output file yet.
        [ ! -e $TARGET.pdf ]
        HASNOPDF=$?
        # ignore if it's unchanged.
        # OS X diff doesn't consider binary files. Single-line output, return value 2
        diff $TARGET.pdf $TMPTARGET.pdf
        OUTPUTDIFFERS=$?
        if [ $HASNOPDF -eq 0 -o $OUTPUTDIFFERS -ne 0 ]; then
            # Do NOT RM since Skim cannot deal with this.
            cp $TMPTARGET.pdf $TARGET.pdf
        fi
    fi

    sleep 1 # give it time to be killed by a CTRL-C
done

这会编译一个临时文件并将其复制回给定的任何名称(而不是像脚本那样相反); 脚本的用法:

./scriptname project

其中 project 是 TeX 文件的名称,不带文件扩展名。

我还更改了 rubber-info 行:

autocmd FileType tex exe "set makeprg=rubber-info\\ _" . expand("%:t:r") . ".log"

并且我需要修补我的 latexmk 以使用 XeTeX,因为可执行文件的名称是硬编码的。

不幸的是,当我在完成语句之前保存文档时,这仍然会破坏输出 PDF 文件,因为 latexmk 似乎总是生成 PDF 文件,即使出现错误 - 并且它的返回码总是 0,这很糟糕。

(为了澄清这一点,假设我刚刚在文档中输入了 emph{ 并保存了它。后台脚本将立即编译文档,然后失败。但它仍然会生成一个(大部分是空的)输出文件)。

此外,向前搜索不再正常工作; 它基本上跳转到文档中的错误点。 我怀疑这和我编译前复制文档有关系。

所以,这仍然是一个完全不能令人满意的解决方案,尽管我什至还没有在 MacVim 中启用连续保存输入功能。

I wanted to use the script you posted in your final answer.

Unfortunately, it didn’t work with my setting (MacVim with vim-latexsuite, Skim as the viewer and XeTeX). I also use forward search (i.e. I use the feature that pressing \ls in Vim will jump to the corresponding point in the PDF document in the open viewer).

Furthermore, my document isn’t called thesis.tex (big surprise; it’s not a thesis). I’ve therefore done some more configuration work that I’d like to share. Attention, my bash skills are horrible.

#!/bin/bash

set -x
ulimit -t 10 # sometimes pdflatex gets stuck

if [ "$1" = "" ]; then
    echo "No target name specified"
    exit 1
fi

TARGET=$1
SOURCE=$1.tex
TMPSOURCE=_$TARGET.tex
TMPTARGET=_$TARGET

while [ 1 ]; do
    # Compile a different file ($TMPSOURCE.pdf) so that it doesn't reload mid-compile
    cp $SOURCE $TMPSOURCE
    # better than running pdflatex manually, as this wont rebuild if there's nothing there.
    latexmk -pdf -silent $TMPTARGET > /dev/null

    # For rubber-info
    cp $TMPTARGET.log $TARGET.log

    if [ -e $TMPTARGET.pdf ]; then # Check the compile succeeded first
        # No output file yet.
        [ ! -e $TARGET.pdf ]
        HASNOPDF=$?
        # ignore if it's unchanged.
        # OS X diff doesn't consider binary files. Single-line output, return value 2
        diff $TARGET.pdf $TMPTARGET.pdf
        OUTPUTDIFFERS=$?
        if [ $HASNOPDF -eq 0 -o $OUTPUTDIFFERS -ne 0 ]; then
            # Do NOT RM since Skim cannot deal with this.
            cp $TMPTARGET.pdf $TARGET.pdf
        fi
    fi

    sleep 1 # give it time to be killed by a CTRL-C
done

This compiles a temporary file and copies it back to whatever name was given (instead of the other way round as your script does); usage of the script:

./scriptname project

Where project is the name of the TeX file, without file extension.

I’ve also changed the rubber-info line:

autocmd FileType tex exe "set makeprg=rubber-info\\ _" . expand("%:t:r") . ".log"

And I needed to patch my latexmk to use XeTeX since the name of the executable was hard-coded.

Unfortunately, this still destroys the output PDF file when I’ve saved my document before completing a statement, since latexmk seems to always produce a PDF file, even on error – and its return code is always 0, which sucks.

(To clarify this, say that I’ve just typed emph{ into my document and save it. The background script will promptly compile the document, and fail. But it will still produce a (largely empty) output file).

Additionally, forward search no longer works properly; it basically jumps to a wrong point in the document. I suspect that this has something to do with my copying the document before compilation.

So, this is still a completely unsatisfactory solution, even though I didn’t even enable continuous saving on typing in MacVim yet.

分分钟 2024-08-09 00:12:22

(这是一项正在进行的工作)

我现在正在尝试 vim-latexsuite。 它基本上将 vim 变成了 Latex 的 IDE。

学习曲线:

  • 非常不直观,但在教程之后,似乎还可以。
  • 它重新定义了一些我喜欢的键,但我似乎无法修复它们。

自动完成:

  • 使使用一些内置宏
  • 变得 更简单 对于用户宏来说是非常烦人的。
  • 将“替换为``之类的东西很好,直到你出于某种原因想要“”,然后这是一种挫败感的练习。
  • 它的自动完成功能也很烦人。 我必须重新编程自己才能在乳胶中工作。

构建系统:

  • 糟糕的
  • 快速修复不起作用 - 它经常将我放入错误的文件中
  • 当 Latex 报告结果分为两行的错误时,它不会检测到它。

(This is a work in progress)

I'm trying vim-latexsuite at the moment. It basically turns vim into an IDE for latex.

Learning curve:

  • Very unintuitive, but after the tutorial, it seems OK.
  • It redefines some keys I like, and I can't seem to fix them.

Autocomplete:

  • Makes using some built-in macros simpler
  • Adding <<+>> to for user macros is very annoying.
  • Replacing " with `` and the like is nice until you want " for some reason, then its an exercise in frustration.
  • Its autocomplete can be annoying too. I have to reprogram myself for working in latex.

Build system:

  • Awful
  • quickfix doesn't work - it often puts me in the wrong file
  • When latex reports errors with the result split over 2 lines, it doesn't detect it.
樱桃奶球 2024-08-09 00:12:22

奥克泰克斯 Preview-latex 是 Emacs 的另一个选择。

您还可以让 emacs 打开生成的 dvi 或 pdf 文件,如果您为该缓冲区打开自动恢复模式,则每次重新编译文档时都会呈现更改。

AUCTEX & preview-latex with Emacs another option.

You can also have emacs open up the resultant dvi, or pdf file, and if you turn auto-revert-mode on for that buffer, the changes will be rendered everytime you recompile the document.

聽兲甴掵 2024-08-09 00:12:22

“更好”是一个非常相对的术语...您还想做什么? 看起来这个 makefile 处理了相当多的事情,这让我希望我在工作中运行 *nix 而不是 Windows...如果您需要使用 makefile 处理更多事情,为什么不添加它们呢?

为了使其“更好”,您需要提供有关您正在做什么的更多详细信息。

例如,您可以让它使用 grep 解析 .log 文件,搜索错误或警告,将它们转储到另一个文件中,然后打开新文件,以便您可以阅读错误。

这完全取决于你想做什么......

"Better" is a very relative term... what else do you want to do? It seems like this makefile handles quite a bit, and it makes me wish I was running a *nix at work instead of windows... if there are more things you need to handle with the makefile, why not add them in?

To make it "better" you would need to provide more details on what exactly you're doing.

For instance, you could have it parse the .log file with grep, search for errors or warnings, dump them into another file, then open the new file so you can read through the errors.

It all depends on what you want to do...

梦幻的味道 2024-08-09 00:12:22

我将 MikTeX 与 TeXnicCenter 结合使用。 对于我的目的来说它工作得很好。 我从来没有让系统隐藏错误或警告。 自定义构建脚本很容易创建和配置。

I'm using MikTeX in combination with TeXnicCenter. It works fine for my purposes. I've never ever had the system hiding errors or warnings. Custom build scripts are easy to create and configure.

感悟人生的甜 2024-08-09 00:12:22

ltx 声称是 Latex 的包装器,用于加速 Latex 文档的编译。 但我无法让它工作(initex 的一些问题)。

ltx claims to be a wrapper to latex to speed up the compilation of latex documents. I couldn't make it work though (some problems with initex).

苦行僧 2024-08-09 00:12:22

我使用 latex-makefile 一段时间了。 如果您尝试使用编辑-编译-预览循环,那么它非常好:

  • 几乎采用零配置。
  • 构建 .ps 或 .pdf。
  • 处理所有必要的迭代。 我真的不需要再写任何东西了。
  • 相当强大,但偶尔错误和警告会被破坏。
  • 在新的 pdf 构建完成之前,它不会杀死旧的 pdf。
  • 它构建其他文件,例如从 gnuplot 生成 eps。 但我还没有发现这非常有用。
  • 作者对功能请求的响应非常快。
  • 我可以很容易地复制 Latexmk 的优点:

    <前> <代码> while [ 1 ]; 执行/usr/bin/make; 完毕

一些缺点:

  • 它只允许通过 dvi -> 生成 pdf。 ps-> pdf,而不是直接通过 pdftex。
  • 它的错误输出与标准 Latex 不同,因此 vim 没有移动到正确的行。
  • 它并不总是根据 bibtex 和其他非 tex 源的更改重新编译。
  • 如果我删除一个文件,如果没有 make clean,它不会删除依赖项。

I've been using the latex-makefile for a while. Its pretty good if you're trying to use an edit-compile-preview cycle:

  • Takes almost zero configuration.
  • Builds .ps or .pdf.
  • Handles all the necessary iteration. I literally have to write nothing else.
  • Quite robust, but occasionally the errors and warnings get mangled.
  • It doesn't kill the old pdf until the new one is built.
  • It builds other files, like generating eps from gnuplot. I havent found this hugely useful though.
  • The author is very quick to respond to feature requests.
  • I can replicate the advantages of latexmk fairly easily with:

    while [ 1 ]; do /usr/bin/make; done
    

Some downsides:

  • It only allows pdf generation via dvi -> ps -> pdf, instead of directly via pdftex.
  • Its error output isnt the same as the standard latex one, so vim isnt moving to the correct line.
  • It doesnt always recompile on changes in bibtex and other non-tex sources.
  • If I remove a file, it doesn't remove the dependency without a make clean.
路弥 2024-08-09 00:12:22

看看 TeXMaker。 :-)

特点(来自维基):

  • 内嵌拼写检查。
  • 一个用于编写 LaTeX 源文件的 unicode 编辑器(语法突出显示、
    撤消重做、搜索替换、拼写
    检查员...)
  • 可以用鼠标输入 LaTeX 标签和数学符号
  • 文档和部分模板
  • 可以启动LaTeX相关程序
  • BibTeX 数据库管理
  • 大纲或“结构视图”
  • LaTeX 编译期间的日志文件以及“单步执行”的能力
    发现的源错误
    编译器
  • 集成的 LaTeX 到 HTML 转换工具

功能(来自我):

  • 用于插入表格、引文、参考文献的有用向导
  • 双向支持
  • 有用的键盘快捷键
  • 自动完成单词(特别适用于引用)
  • 定义您自己的指令

Have a look at TeXMaker. :-)

features (from wiki):

  • In-line spell check.
  • A unicode editor to write LaTeX source files (syntax highlighting,
    undo-redo, search-replace, spell
    checker...)
  • LaTeX tags and mathematical symbols can be entered with a mouse
  • Document and section templates
  • LaTeX-related programs can be launched
  • BibTeX database management
  • An outline or "structure view"
  • Logfiles during LaTeX compilation and the ability to "step through"
    source errors that are discovered by
    the compiler
  • An integrated LaTeX to HTML conversion tool

features (from me):

  • useful wizards for inserting tables, citation, referencing
  • bidirectional support
  • useful keyboard shortcuts
  • Auto Complete words (specially is useful with referencing)
  • define your own instructions
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文