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

fix: LaTeX: Allow to pass imports #979

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
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 @@ -191,7 +191,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 @@ -236,6 +236,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 @@ -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 */
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
Loading