diff options
| author | John MacFarlane <[email protected]> | 2022-10-17 21:55:25 -0700 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2022-10-17 21:59:44 -0700 |
| commit | 4de3a9c2cabfd0921751219a1ef9fea201943656 (patch) | |
| tree | ce1440dfd1bec5cfcb3e1c6321c761579807c2c3 /tools/latex-package-dependencies.lua | |
| parent | 1a61eec29325978c3bcbfa10e06e0f921b916efb (diff) | |
Add tools/latex-package-dependencies.lua.
Diffstat (limited to 'tools/latex-package-dependencies.lua')
| -rw-r--r-- | tools/latex-package-dependencies.lua | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/latex-package-dependencies.lua b/tools/latex-package-dependencies.lua new file mode 100644 index 000000000..aaa8689f8 --- /dev/null +++ b/tools/latex-package-dependencies.lua @@ -0,0 +1,26 @@ +-- Print latex packages needed by pandoc's default latex template. +-- Usage: pandoc lua tools/latex-package-dependencies.lua + +local templ = pandoc.template.default("latex") + +local packages = {} + +templ:gsub("\\usepackage *%b[] *%{([^}]*)%}", function(capt) + capt:gsub("([^,]+)", function (pkg) + if not pkg:find("%$") then + packages[pkg] = true + end + end) +end) + +templ:gsub("\\usepackage *%{([^}]*)%}", function(capt) + capt:gsub("([^,]+)", function (pkg) + if not pkg:find("%$") then + packages[pkg] = true + end + end) +end) + +for pkg,_ in pairs(packages) do + print(pkg) +end |
