Skip to content

Commit

Permalink
Export TinyTeX bin directory to Lua filter.
Browse files Browse the repository at this point in the history
This is useful for a filter to call `tlmgr` or other tools while they are not put on PATH by `quarto install tinytex`
  • Loading branch information
cderv committed Dec 12, 2024
1 parent 83a3b5a commit 7550720
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/changelog-1.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ All changes included in 1.7:
This also provides a new public function `quarto.utils.is_empty_node`
that allows to check whether a node is empty, i.e., whether it's an
empty list, has no child nodes, and contains no text.
- Expose new `quarto.paths.tinytex_bin_dir` in Quarto's Lua API. If TinyTeX is found by Quarto, this will be set to the path to the `bin` directory of the TinyTeX installation where command line tool are located (e.g., `pdflatex`, `tlmgr`, etc.). If TinyTeX is not found, this will be `nil`, meaning Quarto will use the system PATH to find the command line tools.

## Other Fixes and Improvements

Expand Down
2 changes: 2 additions & 0 deletions src/command/render/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ import { isServerShinyPython } from "../../core/render.ts";
import { pythonExec } from "../../core/jupyter/exec.ts";
import { kTocIndent } from "../../config/constants.ts";
import { isWindows } from "../../deno_ral/platform.ts";
import { tinyTexBinDir } from "../../tools/impl/tinytex-info.ts";

const kQuartoParams = "quarto-params";

Expand Down Expand Up @@ -205,6 +206,7 @@ async function quartoEnvironmentParams(_options: PandocOptions) {
return {
"paths": {
"Rscript": await rBinaryPath("Rscript"),
"TinyTexBinDir": tinyTexBinDir(), // will be undefined if no tinytex found and quarto will look in PATH
},
};
}
Expand Down
5 changes: 4 additions & 1 deletion src/resources/pandoc/datadir/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2093,10 +2093,13 @@ quarto = {
add_to_blocks = utils.add_to_blocks,
},
paths = {
-- matches the path from `quartoEnvironmentParams` from src/command/render/filters.ts
rscript = function()
-- matches the path from `quartoEnvironmentParams` from src/command/render/filters.ts
return param('quarto-environment', nil).paths.Rscript
end,
tinytex_bin_dir = function()
return param('quarto-environment', nil).paths.TinyTexBinDir
end,
},
json = json,
base64 = base64,
Expand Down

0 comments on commit 7550720

Please sign in to comment.