Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export TinyTeX bin directory to Lua filter. #11670

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
6 changes: 6 additions & 0 deletions src/resources/lua-types/quarto/paths.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ Returns the path to the `Rscript` file that Quarto itself would use in its knitr
]]
---@return string # Path to `Rscript` file
function quarto.paths.rscript() end

--[[
Returns the path to the `TinyTeX` bin directory that `quarto install tinytex` installed to, or nil if not found.
]]
---@return string|nil # Path to `TinyTeX` bin directory
function quarto.paths.tinytex_bin_dir() end
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
Loading