LaTeX build targets in the CLI

10 views
Skip to first unread message

Oscar Levin

unread,
Nov 22, 2025, 10:42:36 PMNov 22
to PreTeXt development
One of the earliest things the CLI "took care of" for users was the addition of a LaTeX format for a build target.  We hijacked the mostly developer latex build function from the pretext/pretext script and copied the managed asset directories to the output folder together with that LaTeX.

Now the ability to get the latex before or after building the pdf, with or without the additional .aux, .toc, etc latex build artifacts, is built into the pretext/pretext script.  I have also added an option to the CLI when building a pdf-format target, --latex, that will copy the entire temporary build directory with all latex files and the built pdf to the output folder.

A couple of questions for those who use the CLI and build PDFs:
  1. Is there still a need to support "latex" format targets?  You can get the latex from a pdf build.  I suppose for debugging purpose it might be nice to get the PDF without it trying to build the PDF each time...
  2. Should there be an attribute in the project.ptx manifest that does the same thing the `-l` flag does? In other words, might a user want to always get both the latex and pdf for a target?  That would also make it easier to use the pretext-tools buttons.
If you would like to play around with what is currently possible, you can do so with 2.32.0, which will be out momentarily.

Sean Fitzpatrick

unread,
Nov 22, 2025, 11:20:06 PMNov 22
to PreTeXt development
If I can save the source when building PDF, I think that would be good enough for me. It took a big push two summers ago, but I can build APEX pdf without having to hand-edit the .tex file. 

In another book I have to do a couple of find/replace changes to make some preamble changes that I couldn't figure out how to do with XSL. I might prefer not to build the PDF before making those changes, but it's not a big deal.

The main thing that's kept me from using PDF build targets to date is that my books require one more pass with XeLaTeX than the CLI provides. 

The last line in the log is always, "Labels may have changed. Rerun LaTeX..." 

--
You received this message because you are subscribed to the Google Groups "PreTeXt development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-dev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/53112615-4a2e-4bdb-9da2-9d92269c0de9n%40googlegroups.com.

David W. Farmer

unread,
Nov 23, 2025, 7:28:46 AMNov 23
to PreTeXt development

I would also like the per-project option to always save the LaTeX,
for reasons similar to Sean:

1) Sometimes I need to do another pdflatex pass. (So, I would also
want the .log file saved. Or do I mean .aux?)

2) Sometimes I need to do a little hand-edit of the LaTeX.

3) Sometimes I make an error which causes the latex to pdf to fail.
(Yes, that is possible. And if you are processing the latex in a
way that quits on any error, it just takes one extra { in an equation.)

Is this the process?

a) Build the temporary directory and files

b) Copy the necessary files (to the "print" directory, for example)

c) Compile the latex to make the pdf (in the "print" directory)

d) Delete the temporary files

Other orders for those steps might seem equivalent, but if there
is an error somewhere, you can end up not having the latex file(s).

David


On Sat, 22 Nov 2025, Sean Fitzpatrick wrote:

> If I can save the source when building PDF, I think that would be good enough for me. It took a big push two summers ago, but I can build
> APEX pdf without having to hand-edit the .tex file. 
> In another book I have to do a couple of find/replace changes to make some preamble changes that I couldn't figure out how to do with XSL. I
> might prefer not to build the PDF before making those changes, but it's not a big deal.
>
> The main thing that's kept me from using PDF build targets to date is that my books require one more pass with XeLaTeX than the CLI
> provides. 
>
> The last line in the log is always, "Labels may have changed. Rerun LaTeX..." 
>
> On Sat, Nov 22, 2025, 8:42 p.m. Oscar Levin <oscar...@gmail.com> wrote:
> One of the earliest things the CLI "took care of" for users was the addition of a LaTeX format for a build target.  We hijacked
> the mostly developer latex build function from the pretext/pretext script and copied the managed asset directories to the output
> folder together with that LaTeX.
> Now the ability to get the latex before or after building the pdf, with or without the additional .aux, .toc, etc latex build
> artifacts, is built into the pretext/pretext script.  I have also added an option to the CLI when building a pdf-format target,
> --latex, that will copy the entire temporary build directory with all latex files and the built pdf to the output folder.
>
> A couple of questions for those who use the CLI and build PDFs:
> 1. Is there still a need to support "latex" format targets?  You can get the latex from a pdf build.  I suppose for debugging purpose
> it might be nice to get the PDF without it trying to build the PDF each time...
> 2. Should there be an attribute in the project.ptx manifest that does the same thing the `-l` flag does? In other words, might a user
> want to always get both the latex and pdf for a target?  That would also make it easier to use the pretext-tools buttons.
> If you would like to play around with what is currently possible, you can do so with 2.32.0, which will be out momentarily.
>
> --
> You received this message because you are subscribed to the Google Groups "PreTeXt development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pretext-dev...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/53112615-4a2e-4bdb-9da2-9d92269c0de9n%40googlegroups.com.
>
> --
> You received this message because you are subscribed to the Google Groups "PreTeXt development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pretext-dev...@googlegroups.com.
> To view this discussion visit
> https://groups.google.com/d/msgid/pretext-dev/CAH%2BNcPYA1eHAYa49%3D6-XrUdur43-6%3DQHm%3DFW4zxigQvEpbsQ8Q%40mail.gmail.com.
>
>
Reply all
Reply to author
Forward
0 new messages