File tree Expand file tree Collapse file tree 4 files changed +61
-2
lines changed
src/command/render/latexmk
tests/docs/smoke-all/2022/11/17 Expand file tree Collapse file tree 4 files changed +61
-2
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,15 @@ export async function hasLatexDistribution() {
4141 }
4242}
4343
44+ const kLatexMkEngineFlags = [
45+ "-pdf" ,
46+ "-pdfdvi" ,
47+ "-pdfps" ,
48+ "-pdflua" ,
49+ "-pdfxe" ,
50+ "-pdf-" ,
51+ ] ;
52+
4453// Runs the Pdf engine
4554export async function runPdfEngine (
4655 input : string ,
@@ -65,7 +74,26 @@ export async function runPdfEngine(
6574 } ) ;
6675
6776 // build pdf engine command line
68- const args = [ "-interaction=batchmode" , "-halt-on-error" ] ;
77+ // ensure that we provide latexmk with its require custom options
78+ // Note that users may control the latexmk engine options, but
79+ // if not specified, we should provide a default
80+ const computeEngineArgs = ( ) => {
81+ if ( engine . pdfEngine === "latexmk" ) {
82+ const engineArgs = [ "-interaction=batchmode" , "-halt-on-error" ] ;
83+ if (
84+ ! engine . pdfEngineOpts || engine . pdfEngineOpts . find ( ( opt ) => {
85+ return kLatexMkEngineFlags . includes ( opt ) ;
86+ } ) === undefined
87+ ) {
88+ engineArgs . push ( "-pdf" ) ;
89+ }
90+ engineArgs . push ( "-quiet" ) ;
91+ return engineArgs ;
92+ } else {
93+ return [ "-interaction=batchmode" , "-halt-on-error" ] ;
94+ }
95+ } ;
96+ const args = computeEngineArgs ( ) ;
6997
7098 // output directory
7199 if ( outputDir !== undefined ) {
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ export function useQuartoLatexmk(
4141 // if we are creating pdf output
4242 if ( [ "beamer" , "pdf" ] . includes ( to || "" ) && ext === "pdf" ) {
4343 const engine = pdfEngine ( format . pandoc , format . render , flags ) ;
44- return isLatexPdfEngine ( engine ) && engine . pdfEngine !== "latexmk" ;
44+ return isLatexPdfEngine ( engine ) ;
4545 }
4646
4747 // default to false
Original file line number Diff line number Diff line change 1+ ---
2+ title : " MEW"
3+ format :
4+ pdf :
5+ pdf-engine : latexmk
6+ ---
7+
8+ ## Quarto
9+
10+ Quarto enables you to weave together content and executable code into a finished document.
11+ To learn more about Quarto see < https://quarto.org > .
12+
13+ ``` {r}
14+ 1 + 1
15+ ```
Original file line number Diff line number Diff line change 1+ ---
2+ title : " MEW"
3+ format :
4+ pdf :
5+ pdf-engine : latexmk
6+ pdf-engine-opts : ["-pdflua"]
7+ ---
8+
9+ ## Quarto
10+
11+ Quarto enables you to weave together content and executable code into a finished document.
12+ To learn more about Quarto see < https://quarto.org > .
13+
14+ ``` {r}
15+ 1 + 1
16+ ```
You can’t perform that action at this time.
0 commit comments