Trouble customizing Theorem with LaTeX Includes #13345
-
DescriptionHello! I'm using Quarto to write a book. Using version 1.7.31 on Windows with a full installation of TeXLive. I want to customize how theorems are rendered in PDF. Looking at the documentation for LaTeX Includes and reading that it would include my LaTeX commands "at the end of the header" I added a few commands inside
I tried to render to PDF, but got a nasty error message during the xelatex compilation:
Looking at the generated TeX file (attaching it here with extension txt, as extension tex is not supported tmp-minimal-header.txt), the problem is clear. My included commands are in lines 182 through 198. But further down, on lines 237 to 239, we have
The documentation line saying "contents will be included at the end of the header" does not mean at "the end of the LaTeX preamble." There are a lot more LaTeX commands after my included code. I have tried to trace back how lines 237 to 239 were inserted there, but have not yet succeeded. I managed to understand that most of the LaTeX preamble is generated via LaTeX Partials, but I cannot yet see which partial is responsible for adding these three lines. If I knew which partial generated these lines, I could create a replacement with my definitions and use that. Any suggestions as to which partial might be responsible would be greatly appreciated. Or perhaps a different way of customizing theorems. Thank you very much! Ernesto |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
You need to use the proper LaTeX command to overwrite what Quarto is adding but you won't be able to replace it without post-processing the LaTeX file then manually compile it to PDF. |
Beta Was this translation helpful? Give feedback.
-
I found a way to customize a theorem, definition, conjecture, etc... by inserting LaTeX code in two places:
In your
Create a new file,
The first two lines redefine the theorem and definition environment. The remaining lines of code are from the original With these changes, your theorems and definitions will be blue colored and in a sans serif, bold font. I'm sure that there is a more elegant way to accomplish this, but at least it solves my current problem. |
Beta Was this translation helpful? Give feedback.
I found a way to customize a theorem, definition, conjecture, etc... by inserting LaTeX code in two places:
include-in-header
LaTeX includes to create new theorems, definitions, conjectures, etc... in a different style, andtitle.tex
LaTeX partial to redefine theorem, definition, conjecture, etc... to use the newly defined environments in the previous step.In your
_quarto.yml
add template partials and LaTeX code as follows: