ProdriveTechnologies / bazel-latex

Bazel build system rules for LaTeX

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to depend on local packages?

Kernald opened this issue · comments

Importing local (in-repository) modules by providing paths to \usepackage is not supported, and breaks entirely if the package is relative. I tried to use latex_package, which basically acts as a filegroup, and as such keeps the file hierarchy. The work-around that I found was to use a local_repository, but given that it's a workspace rule, it's quite convoluted to use.

It would be great to have native support for local packages, maybe through the help of run_lualatex.py which seems to be doing something similar already to copy files around when it's needed.

Your BUILD.bazel file can just use any package included in the tarball, even though they are not provided as a package by bazel-latex. For example:

load("@bazel_latex//:latex.bzl", "latex_document")

latex_document(
    name = "my_report",
    srcs = glob([
        "chapters/*.tex",
    ]) + [
        "@texlive_texmf__texmf-dist__tex__latex__<packageName>",
    ],
    main = "my_report.tex",
)

Including a local package that was downloaded separately - thus not included in the Oberdiek bundle for example - could be added the same way but this is of course less trivial than the example above. Hope this helps.