Skip to content

Commit 684ed2a

Browse files
committed
add latex flag to keep latex source
1 parent 83a5748 commit 684ed2a

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Instructions: Add a subsection under `[Unreleased]` for additions, fixes, change
1111

1212
### Added
1313

14-
- PDF targets built with `-v debug` will include the latex source in the output directory.
14+
- PDF targets built with `--latex` flag will include the latex source in the output directory.
1515

1616
## [2.31.0] - 2025-11-20
1717

pretext/cli.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,12 @@ def init(refresh: bool, files: List[str], system: bool) -> None:
482482
is_flag=True,
483483
help="Only build the theme for the target, without performing any other build or generate steps. (Themes are automatically built when building a target.)",
484484
)
485+
@click.option(
486+
"-l",
487+
"--latex",
488+
is_flag=True,
489+
help="When building a PDF, also place LaTeX source files in the output directory for inspection or manual compilation.",
490+
)
485491
@click.option(
486492
"-x",
487493
"--xmlid",
@@ -514,6 +520,7 @@ def build(
514520
generate: bool,
515521
no_generate: bool,
516522
theme: bool,
523+
latex: bool,
517524
xmlid: Optional[str],
518525
no_knowls: bool,
519526
deploys: bool,
@@ -627,7 +634,11 @@ def build(
627634
if xmlid is not None:
628635
log.info(f"with root of tree below {xmlid}")
629636
t.build(
630-
clean=clean, generate=not no_generate, xmlid=xmlid, no_knowls=no_knowls
637+
clean=clean,
638+
generate=not no_generate,
639+
xmlid=xmlid,
640+
no_knowls=no_knowls,
641+
latex=latex,
631642
)
632643
if t.format == "html" and t.compression is None:
633644
log.info(

pretext/project/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,7 @@ def build(
665665
generate: bool = True,
666666
xmlid: t.Optional[str] = None,
667667
no_knowls: bool = False,
668+
latex: bool = False,
668669
) -> None:
669670
# Add cli.version to stringparams. Use only the major and minor version numbers.
670671
self.stringparams["cli.version"] = VERSION[: VERSION.rfind(".")]
@@ -776,7 +777,7 @@ def build(
776777
out_file=out_file,
777778
dest_dir=self.output_dir_abspath().as_posix(),
778779
method=self.latex_engine,
779-
outputs="all" if log.isEnabledFor(logging.DEBUG) else "pdf",
780+
outputs="all" if latex else "pdf",
780781
)
781782
elif self.format == Format.LATEX:
782783
core.pdf(

0 commit comments

Comments
 (0)