Bibliography¶
LaTeX documents that use \cite{} need a bibliography processor.
Modern documents almost always want
biblatex + biber, which handle
Unicode, sophisticated styles, and multi-bibliography workflows
correctly.
rules_latex ships a vendored biber binary alongside the tectonic
toolchain. To use it, set biber = True on your document.
Minimal example¶
% paper.tex
\documentclass{article}
\usepackage[backend=biber,style=numeric]{biblatex}
\addbibresource{references.bib}
\begin{document}
This sentence cites Knuth~\cite{knuth1984}.
\printbibliography
\end{document}
% references.bib
@book{knuth1984,
author = {Donald E. Knuth},
title = {The {{\TeX}}book},
publisher = {Addison-Wesley},
year = {1984},
}
# BUILD.bazel
load("@rules_latex//latex:defs.bzl", "latex_document")
latex_document(
name = "paper",
main = "paper.tex",
srcs = ["paper.tex", "references.bib"],
biber = True,
)
The build runs tectonic, biber, tectonic again โ all sandboxed, all hermetic. The resulting PDF has resolved citations.
How it works¶
When biber = True:
- The platform-specific
biberbinary from the toolchain is staged into a per-action scratch directory. - That directory is prepended to PATH inside the sandbox.
- Tectonic's biblatex subprocess resolves
biberby basename and shells out to it as usual.
The biber binary is vendored from a GitHub release
mirror on the
rules_latex repo, content-addressed by SHA-256. See
DESIGN.md ยง4.9
for the full implementation details.
Version coupling¶
Biber is tightly coupled to biblatex's "control file format" version.
rules_latex pins biber 2.17 to match the biblatex 3.17 shipped in
the upstream Tectonic bundle. You can't use a newer biber with the
default bundle. If you specifically need biblatex 3.18+ features,
self-host a newer bundle (see the bundle staleness
discussion).
Platform support¶
| Platform | Toolchain biber? | Note |
|---|---|---|
| Linux x86_64 | Upstream prebuilt | |
| Linux aarch64 | Use biber_strategy = "system" |
|
| macOS x86_64 | Universal binary | |
| macOS aarch64 | Universal binary | |
| Windows x86_64 |
Linux arm64 workaround¶
The upstream biber project doesn't ship a Linux arm64 binary, so the
toolchain has a gap there. Install biber via your distro
(apt-get install biber) and set:
latex_document(
name = "thesis",
main = "thesis.tex",
srcs = [...],
biber = True,
biber_strategy = "system", # use system biber on PATH
)
This is less hermetic โ your build depends on whatever biber is installed โ but it's the only option until v0.3 ships a built-from- source biber for that platform.