Skip to content

Commit f366f92

Browse files
authored
Merge pull request #11670 from quarto-dev/lua/expose-tinytex-path
2 parents cb09d52 + 75df5c9 commit f366f92

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

news/changelog-1.7.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ All changes included in 1.7:
3030
This also provides a new public function `quarto.utils.is_empty_node`
3131
that allows to check whether a node is empty, i.e., whether it's an
3232
empty list, has no child nodes, and contains no text.
33+
- 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.
3334

3435
## Other Fixes and Improvements
3536

src/command/render/filters.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ import { isServerShinyPython } from "../../core/render.ts";
9393
import { pythonExec } from "../../core/jupyter/exec.ts";
9494
import { kTocIndent } from "../../config/constants.ts";
9595
import { isWindows } from "../../deno_ral/platform.ts";
96+
import { tinyTexBinDir } from "../../tools/impl/tinytex-info.ts";
9697

9798
const kQuartoParams = "quarto-params";
9899

@@ -205,6 +206,7 @@ async function quartoEnvironmentParams(_options: PandocOptions) {
205206
return {
206207
"paths": {
207208
"Rscript": await rBinaryPath("Rscript"),
209+
"TinyTexBinDir": tinyTexBinDir(), // will be undefined if no tinytex found and quarto will look in PATH
208210
},
209211
};
210212
}

src/resources/lua-types/quarto/paths.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,9 @@ Returns the path to the `Rscript` file that Quarto itself would use in its knitr
77
]]
88
---@return string # Path to `Rscript` file
99
function quarto.paths.rscript() end
10+
11+
--[[
12+
Returns the path to the `TinyTeX` bin directory that `quarto install tinytex` installed to, or nil if not found.
13+
]]
14+
---@return string|nil # Path to `TinyTeX` bin directory
15+
function quarto.paths.tinytex_bin_dir() end

src/resources/pandoc/datadir/init.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2093,10 +2093,13 @@ quarto = {
20932093
add_to_blocks = utils.add_to_blocks,
20942094
},
20952095
paths = {
2096+
-- matches the path from `quartoEnvironmentParams` from src/command/render/filters.ts
20962097
rscript = function()
2097-
-- matches the path from `quartoEnvironmentParams` from src/command/render/filters.ts
20982098
return param('quarto-environment', nil).paths.Rscript
20992099
end,
2100+
tinytex_bin_dir = function()
2101+
return param('quarto-environment', nil).paths.TinyTexBinDir
2102+
end,
21002103
},
21012104
json = json,
21022105
base64 = base64,

0 commit comments

Comments
 (0)