LaTeX Reference Manager provides a small, Makefile-driven helper for creating and managing cross-document references in LaTeX projects. It makes it easy to reference PDFs produced by other projects and to manage external links (web pages, externally hosted PDFs, etc.).
Prerequisites:
- A TeX distribution with PDFLaTeX (for Debian/Ubuntu a convenient option is
texlive-full). - GNU Make.
Install system packages (Debian/Ubuntu):
sudo apt-get install texlive-full makeAdd the manager to your project (recommended as a git submodule):
git submodule add git@github.com:bringauto/latex-references-manager.gitInitialize the manager from the repository root:
make -C latex-references-manager initFor more initialization options, see the Initialization options and example section below.
Reuse the Makefile in example/ by including Makefile.common from the repository root. A minimal project Makefile looks like this:
PROJECT_NAME := example
REPO_ROOT_DIR := ../
include $(REPO_ROOT_DIR)/Makefile.common
$(eval $(call COMMON_LOGIC, $(PROJECT_NAME), $(REPO_ROOT_DIR)))Set PROJECT_NAME to your main .tex filename (without .tex) and REPO_ROOT_DIR to the path to the repository root.
When using the manager, you can customize:
- where you put the submodule in the first place,
- where you want to create files or symlinks for the manager in your project (via the
INIT_DIRvariable). - whether you want to create symlink to the
references.texfile in the repository.
Assume the following:
- The submodule directory is
another_dir/subdir/latex-references-managerinside your repository. - You want to create the manager files/symlinks inside
another_dir/(so theanother_dirwill containMakefile.common,references_lib/etc.). - You want to create a symlink to the
references.texfile in the repository root.
Then initialize the manager by running:
make -C another_dir/subdir/latex-references-manager init INIT_DIR=../../This creates symlinks from the project root so Makefile.common and the LaTeX library files are accessible.
See, that the INIT_DIR is relative to the submodule (latex-references-manager) itself.
- Add a record for each external document in the root
references.texfile. For a local PDF built by another project use:
\createref{document1}{path/to/output}path/to/output is relative to the repository root and should point to the PDF output path without the .pdf extension.
- Include the helper macros in your document:
\input{references_lib/references_lib.tex}- Use a registered reference in your document:
\href{\getref{document1}}{Link to document1.pdf}You can register and use external URLs (web pages, externally hosted PDFs) using \createextref and \getextref.
Register an external reference in references.tex:
\createextref{bringauto}{https://bringauto.com}Use it in your document:
\href{\getextref{bringauto}}{Bringauto homepage}
% or
\url{\getextref{bringauto}}Notes and tips:
- Always include the URL scheme (
http://orhttps://) when registering an external reference. \getextref{<name>}returns the registered URL and can be used with\href,\urlor other link macros.- URLs are not validated at build time; if a link is broken, update
references.texaccordingly. - If a URL contains LaTeX-sensitive characters, prefer
\url{\getextref{...}}or escape as needed.
- Use only alphanumeric characters and underscores
- Names are case-sensitive
- Must be relative to project root
- Cannot contain spaces or special characters
- Forward slashes must be used as path separators
Edit references_config.tex at the repository root to change behavior:
- Toggle output mode (pdf/html):
\def\pdfhtmlmode{pdf} % or \def\pdfhtmlmode{html}- Set HTML prefix (used when HTML support is implemented):
\def\htmlprefix{https://bringauto.com/en/}Note: HTML output is currently not supported; implementing it requires tools such as latexml.
To build the example project in example/:
make -C exampleUse make -C example clean to remove temporary files, or make -C example cleanall to also remove the generated PDF.
- If your references do not resolve, check that
references.texentries use correct names and paths. - For external links, verify the URL scheme and encoding.
- If LaTeX cannot find
references_lib/references_lib.texensure you raninitor thatTEXINPUTSis configured by your top-level Makefile.
This project is provided under the terms of the LICENSE file in the repository root.