ProdriveTechnologies / bazel-latex

Bazel build system rules for LaTeX

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

amsfonts not loading correctly

beneisner opened this issue · comments

I am trying to use the \mathbb command, but for some reason lualatex doesn't seem to be able to load the fonts correctly even when I include amsmath correctly.

Repro:

WORKSPACE

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "bazel_latex",
    sha256 = "f81604ec9318364c05a702798c5507c6e5257e851d58237d5f171eeca4d6e2db",
    strip_prefix = "bazel-latex-1.0",
    url = "https://github.com/ProdriveTechnologies/bazel-latex/archive/v1.0.tar.gz",
)

load("@bazel_latex//:repositories.bzl", "latex_repositories")

latex_repositories()

BUILD.bazel

latex_document(
    name = "repro",
    srcs = [
        "@bazel_latex//packages:amsmath",
    ],
    main = "repro.tex",
)

repro.tex

\documentclass{article}
\usepackage{amsfonts}
\begin{document}
$\mathbb{P}$
\end{document}

The resulting error, when running bazel build //:repro:

INFO: Analyzed target //:repro (0 packages loaded, 2 targets configured).
INFO: Found 1 target...
ERROR: <WORKSPACE_ROOT>/BUILD.bazel:13:15: LuaLatex repro.pdf failed (Exit 1) run_lualatex failed: error executing command bazel-out/host/bin/external/bazel_latex/run_lualatex external/texlive_bin__x86_64-darwin/kpsewhich external/texlive_bin__x86_64-darwin/luatex external/texlive_bin__x86_64-darwin/bibtex ... (remaining 5 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
----------------
Note: The failure of target @bazel_latex//:run_lualatex (with exit code 1) may have been caused by the fact that it is running under Python 3 instead of Python 2. Examine the error to determine if that appears to be the problem. Since this target is built in the host configuration, the only way to change its version is to set --host_force_python=PY2, which affects the entire build.

If this error started occurring in Bazel 0.27 and later, it may be because the Python toolchain now enforces that targets analyzed as PY2 and PY3 run under a Python 2 and Python 3 interpreter, respectively. See https://github.com/bazelbuild/bazel/issues/7899 for more information.
----------------
repro.tex:4: error: Font \U/msa/m/n/10=msam10 at 10pt not loadable: metric data not found or bad.<to be read again>
      at $\mathbb
repro.tex:4: error: Font \U/msa/m/n/7=msam7 at 7pt not loadable: metric data not found or bad
      at <to be read again>
    from $\mathbb
repro.tex:4: error: Font \U/msa/m/n/5=msam5 at 5pt not loadable: metric data not found or bad
      at <to be read again>
    from $\mathbb
repro.tex:4: error: Font \U/msb/m/n/10=msbm10 at 10pt not loadable: metric data not found or bad.<to be read again>
      at $\mathbb
repro.tex:4: error: Font \U/msb/m/n/7=msbm7 at 7pt not loadable: metric data not found or bad
      at <to be read again>
    from $\mathbb
repro.tex:4: error: Font \U/msb/m/n/5=msbm5 at 5pt not loadable: metric data not found or bad
      at <to be read again>
    from $\mathbb
repro.tex:4: error: \textfont5 is undefined (character 80)
      at $\mathbb{P}$
There were errors; repro.pdf not updated
Target //:repro failed to build
Use --verbose_failures to see the command lines of failed build steps.

INFO: Elapsed time: 7.304s, Critical Path: 7.15s
INFO: 0 processes.
FAILED: Build did NOT complete successfully

Seems similar to #34

I was able to reproduce with the steps above.

I was able to resolve it by also including the amssymb package,

➜  42 git:(master) ✗ cat BUILD.bazel 
load("@bazel_latex//:latex.bzl", "latex_document")

latex_document(
    name = "repro",
    srcs = [
        "@bazel_latex//packages:amssymb",
        "@bazel_latex//packages:amsmath",
    ],
    main = "repro.tex",
)
➜  42 git:(master) ✗ bazel build //:repro                
INFO: Analyzed target //:repro (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //:repro up-to-date:
  bazel-bin/repro.pdf
INFO: Elapsed time: 0.079s, Critical Path: 0.00s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action

This resolves the issue. Closing, thanks @jmelahman !