Skip to content
Merged
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ Instructions: Add a subsection under `[Unreleased]` for additions, fixes, change

## [Unreleased]

### Added

- The `latex-source` attribute, set to anything except "no", on a target with format `pdf` will copy latex source files to output directory.

## [2.32.0] - 2025-11-23

Includes updates to core through commit: [ce20f15](https://github.com/PreTeXtBook/pretext/commit/ce20f15d525f2d1e7a3c3fb8da3bb5fa9d16d3ee)
Expand Down
15 changes: 14 additions & 1 deletion pretext/project/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,16 @@ class Target(pxml.BaseXmlModel, tag="target", search_mode=SearchMode.UNORDERED):
latex_engine: LatexEngine = pxml.attr(
name="latex-engine", default=LatexEngine.XELATEX
)
# Flag to indicate whether to include LaTeX source files in the output directory when building a PDF target.
latex_source: t.Optional[str] = pxml.attr(name="latex-source", default=None)

@field_validator("latex_source")
@classmethod
def latex_source_validator(cls, v: t.Optional[str]) -> bool:
if v is None:
return False
return v.lower() != "no"

braille_mode: BrailleMode = pxml.attr(
name="braille-mode", default=BrailleMode.EMBOSS
)
Expand Down Expand Up @@ -769,6 +779,9 @@ def build(
)
log.debug(e, exc_info=True)
elif self.format == Format.PDF:
# Include latex source files if requested.
if self.latex_source:
latex = True
core.pdf(
xml=self.source_abspath(),
pub_file=self.publication_abspath().as_posix(),
Expand All @@ -777,7 +790,7 @@ def build(
out_file=out_file,
dest_dir=self.output_dir_abspath().as_posix(),
method=self.latex_engine,
outputs="all" if latex else "pdf",
outputs="all" if latex else "pdf-only",
)
elif self.format == Format.LATEX:
core.pdf(
Expand Down