Skip to content

Commit

Permalink
LaTeX: Allow to pass imports
Browse files Browse the repository at this point in the history
  • Loading branch information
LecrisUT committed Mar 13, 2024
1 parent 974dde1 commit b78add4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/myst-cli/src/build/tex/single.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export async function localArticleToTexTemplated(
templateOptions: ExportWithOutput,
opts?: ExportFnOptions,
): Promise<ExportResults> {
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);
Expand Down Expand Up @@ -242,6 +242,12 @@ export async function localArticleToTexTemplated(
const partDefinitions = templateYml?.parts || [];
const parts: Record<string, string | string[]> = {};
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,
Expand Down
1 change: 1 addition & 0 deletions packages/myst-frontmatter/src/exports/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type Export = {
output?: string;
toc?: string;
articles?: ExportArticle[];
imports?: string[];
/** sub_articles are only for jats xml export */
sub_articles?: string[];
/** MECA: to, from later */
Expand Down
1 change: 1 addition & 0 deletions packages/myst-to-tex/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export type LatexResult = {
export type MathPlugins = Required<PageFrontmatter>['math'];

export type Options = MystToTexSettings & {
imports?: string[];
handlers?: Record<string, Handler>;
math?: MathPlugins;
bibliography?: 'natbib' | 'biblatex';
Expand Down

0 comments on commit b78add4

Please sign in to comment.