diff --git a/packages/myst-cli/src/build/tex/single.ts b/packages/myst-cli/src/build/tex/single.ts index 28f2117f2..f8862cdc4 100644 --- a/packages/myst-cli/src/build/tex/single.ts +++ b/packages/myst-cli/src/build/tex/single.ts @@ -191,7 +191,7 @@ export async function localArticleToTexTemplated( templateOptions: ExportWithOutput, opts?: ExportFnOptions, ): Promise { - const { output, articles, template } = templateOptions; + const { output, articles, template, imports } = templateOptions; const { projectPath, extraLinkTransformers, clean, ci } = opts ?? {}; const filesPath = path.join(path.dirname(output), 'files'); const fileArticles = articlesWithFile(articles); @@ -236,6 +236,12 @@ export async function localArticleToTexTemplated( const partDefinitions = templateYml?.parts || []; const parts: Record = {}; let collectedImports: TexTemplateImports = { imports: [], commands: {} }; + // First get the imports from the options + if (imports) { + imports.forEach((item) => { + collectedImports.imports.push(item); + }); + } let preambleData: PreambleData = { hasProofs: false, printGlossaries: false, diff --git a/packages/myst-frontmatter/src/exports/types.ts b/packages/myst-frontmatter/src/exports/types.ts index d7d66e8fd..7c22d862b 100644 --- a/packages/myst-frontmatter/src/exports/types.ts +++ b/packages/myst-frontmatter/src/exports/types.ts @@ -24,6 +24,7 @@ export type Export = { zip?: boolean; toc?: string; articles?: ExportArticle[]; + imports?: string[]; /** sub_articles are only for jats xml export */ sub_articles?: string[]; /** MECA: to, from later */ diff --git a/packages/myst-to-tex/src/types.ts b/packages/myst-to-tex/src/types.ts index f3bf7f862..a69065f38 100644 --- a/packages/myst-to-tex/src/types.ts +++ b/packages/myst-to-tex/src/types.ts @@ -25,6 +25,7 @@ export type LatexResult = { export type MathPlugins = Required['math']; export type Options = MystToTexSettings & { + imports?: string[]; handlers?: Record; math?: MathPlugins; bibliography?: 'natbib' | 'biblatex';