-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
LaTeX: let latexpdf implement '-q' and '-Q' sphinx-build options #12729
Conversation
I am open to using Latexmk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a change to use in case of -q
the -silent
option of Latexmk, for reasons explained above. However I don't know how to not override environment or command line (in case of make
) LATEXOPTS and LATEXMKOPTS, and I am not even sure this syntax is make.bat compatible at all (help wanted for Windows). I thought about setting the variables at start of command line, but feared it would be even worse for Windows, not sure.
Help is needed for Windows. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is paradoxical that -q
runs Latexmk with -silent
and -Q
does not but captures all its output instead to save it into some file. The reason for not having -q
simply capture stdout
in a file, is that Latexmk outputs benign information to stderr sometimes, not stdout.
Also: currently make latexpdf O=-q LATEMKOPTS=-xelatex
will ignore the LATEXMKOPTS
setting (for a project using xelatex
). One will have to do make latex O=-q
(or equivalent with sphinx-build) and in second step do make -C <builddir> all-pdf LATEXMKOPTS="-xelatex -silent"
to achieve similar effect. I don't know how to use subprocess.call to merge env or cmd line LATEXMKOPTS with addition of -silent
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please could you add a CHANGES entry?
A
@AA-Turner ok, will do for CHANGES. I had some mail exchanges with the maintainer of Latexmk, and proposed that perhaps in future Latexmk's options The defect of my implementation is that it overrides user |
Closes #12717
EDIT: this whole description is obsolete as it was decided in a later stage to actually use
latexmk -silent
for-q
.obsolete Due to the fact that Latexmk sends to stderr messages of a purely informative nature (such as missing
.toc
file on first run), I could not handle the-q
as I intended to (i.e. simply suppress or capture stdout). I find the-silent
option of Latexmk is too drastic as it continues to print out to stdout but makes it more obscure what is happening, so I opted for running the sub-latex in "batchmode", knowing all info is anyhow available at end of LaTeX run in.log
file (there are extreme situations, where the log file can remain empty and suppressing stdout loses information, but this is impossible in Sphinx except under special user additions to preamble).And regarding
-Q
the stdout/stderr get redirected to some file containing the Latexmk+LaTeX console output which may be checked prior to log file in case of problems. Contrarily to using-silent
with Latexmk (and even--silent
with make), there is really no output whatsoever in case of successful build.Examples (for a fresh project each)
i.e. no output whatsoever if no error,
and
in case of an error. Regarding
-q
option it behaves like this:EDIT: final version of this PR simply uses
latexmk -silent
, so there is less console output than was shown here.In case of error it will end in
(obsolete) This is admittedly a bit verbose but as explained above, the
-silent
option of Latexmk suppresses too much, and allowing onlystderr
gives strange console output with innocuous messages making it tostderr
.EDIT: it was decided to use
-silent
option of Latexmk despite initial reservations.Alternative syntax are
make latexpdf O="-Q"
and respectivelymake latexpdf O="-q"
.For example, in case of LaTeX error:
and
i.e. no output whatsoever if no error.