From ced6dac36188c845d7d06e5768e484b4b774d028 Mon Sep 17 00:00:00 2001 From: Matthew Sotoudeh Date: Sat, 10 Oct 2020 16:45:55 -0700 Subject: Allow the user to specify which LaTeX compiler to use (#8) We were using pdflatex as a default LaTeX compiler. This PR allows the user to specify any of the ones shipped with TeXLive. This is particularly important because some applications require, e.g., Times New Roman font. In PDFLatex, it looks like it's basically impossible to guarantee this. In XeLaTeX and LuaLaTeX it seems to be possible. So having the option to switch between them can be useful. --- latex.bzl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'latex.bzl') diff --git a/latex.bzl b/latex.bzl index d496397..868d7bb 100644 --- a/latex.bzl +++ b/latex.bzl @@ -15,6 +15,7 @@ def _latex_pdf_impl(ctx): ctx.files._run_script[0].path, texlive_path, ctx.files._latexrun[0].path, + ctx.attr.compiler, ctx.label.name, ctx.files.main[0].path, ctx.outputs.out.path, @@ -30,6 +31,7 @@ _latex_pdf = rule( attrs = { "main": attr.label(allow_files = True), "srcs": attr.label_list(allow_files = True), + "compiler": attr.string(default = "pdflatex"), "_latexrun": attr.label( allow_files = True, default = "@bazel_latex_latexrun//:latexrun", @@ -98,7 +100,7 @@ _arxivable = rule( implementation = _arxivable_impl, ) -def latex_document(name, main, srcs = []): +def latex_document(name, main, srcs = [], compiler = "pdflatex"): """Given a TeX file, add rules for compiling and archiving it. """ @@ -107,6 +109,7 @@ def latex_document(name, main, srcs = []): name = name, srcs = srcs, main = main, + compiler = compiler, ) # Convenience rule for viewing PDFs. -- cgit v1.2.3