Statically scans .tex sources for the packages, classes and fonts they pull in,
following local \input / \include / \subfile chains and local .sty/.cls files.
Constants
BABEL = /\\usepackage\s*\[([^\]]*)\]\s*\{babel\}/
BABEL_FLAGS = {"activeacute", "activegrave", "base", "bidi", "config", "hyphenmap", "keepshorthandsactive", "layout", "math", "noconfigs", "nocase", "provide", "safe", "shorthands", "showlanguages", "silent", "strings", "headfoot"}
BARE_INPUT = /\\input\s+([A-Za-z0-9_\-.\/]+)/
BIB_RESOURCE =
Regex.new(("\\\\addbibresource" +
OPT) + "\\{([^}]*)\\}")
BIB_STYLE = /\\bibliographystyle\s*\{([^}]*)\}/
BIBLIOGRAPHY = /\\bibliography\s*\{([^}]*)\}/
CLASSES =
Regex.new(("\\\\(?:documentclass|
LoadClass|
LoadClassWithOptions)" +
OPT) + "\\{([^}]*)\\}")
FONT_SETTERS =
Regex.new(("\\\\(?:setmainfont|setsansfont|setmonofont|setmathfont|fontspec|newfontfamily\\s*\\\\[
A-
Za-z@]+|newfontface\\s*\\\\[
A-
Za-z@]+)" +
OPT) + "\\{([^}]*)\\}")
GRAPHIC_EXTENSIONS = {".pdf", ".png", ".jpg", ".jpeg", ".eps", ".jbig2", ".jb2"}
GRAPHICS =
Regex.new(("\\\\includegraphics\\*?" +
OPT) + "\\{([^}]*)\\}")
GRAPHICS_PATH = /\\graphicspath\s*\{((?:\s*\{[^}]*\})+)\s*\}/
IMPORTS = /\\(?:sub)?import\*?\s*\{([^}]*)\}\s*\{([^}]*)\}/
INPUTS = /\\(?:input|include|subfile)\s*\{([^}]*)\}/
LISTING_INPUT =
Regex.new(("\\\\(?:lstinputlisting|verbatiminput|
VerbatimInput)" +
OPT) + "\\{([^}]*)\\}")
LUA_MARKERS = /\\directlua|\\begin\{luacode\*?\}|\\luaexec/
MAGIC_PROGRAM = /%\s*!\s*TEX\s+(?:TS-)?program\s*=\s*([A-Za-z]+)/i
MINTED_INPUT =
Regex.new(("\\\\inputminted" +
OPT) + "\\{[^}]*\\}\\s*\\{([^}]*)\\}")
OPT = "(?:\\s*\\[[^\\]]*\\])*\\s*"
OPTIONAL = /\\InputIfFileExists\s*\{([^}]*)\}/
PACKAGES =
Regex.new(("\\\\(?:usepackage|
RequirePackage|
RequirePackageWithOptions)" +
OPT) + "\\{([^}]*)\\}")
PGF_LIBS = /\\usepgflibrary\s*\{([^}]*)\}/
PGFPLOTS_LIBS = /\\usepgfplotslibrary\s*\{([^}]*)\}/
TCB_LIBS = /\\tcbuselibrary\s*\{([^}]*)\}/
TCB_PACKAGE = /\\(?:usepackage|RequirePackage)\s*\[([^\]]*)\]\s*\{tcolorbox\}/
TCB_STYLE = /\\tcb@add@library@style\s*\{([^}]*)\}\s*\{([^}]*)\}/
TCB_STYLE_NAMES = {"most", "many", "all"}
babel package options that are not language names.
tcolorbox library styles; their expansion is read from tcolorbox.sty.
THEMES =
Regex.new(("\\\\use(|color|font|inner|outer)theme" +
OPT) + "\\{([^}]*)\\}")
TIKZ_LIBS = /\\usetikzlibrary\s*\{([^}]*)\}/