-
I am trying to migrate my thesis to quarto, but I still don't get the best way to do that. I have a custom .cls, .sty and .tex files. Obviously I want to transform most .tex files (chapters) into .qmd files. Still, I don't know what to do with my main.tex which loads everything, including external packages. As far as I understood, quarto-cli creates a temporary index.tex file and deletes it after using. How do I customize this file to add the packages that I need? Do I need to create an extension for this kind of customization? Where do I find more in-depth documentation? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 17 replies
-
Hi @fredguth Thanks for your enthusiastic adoption of Quarto. Quarto processes the
This option is available in Quarto, see https://quarto.org/docs/reference/formats/pdf.html#includes. |
Beta Was this translation helpful? Give feedback.
-
Thanks for you answer @rgaiacs. Let me give some additional context and details. This will be a long answer to cover everything I think off, and I hope it will help you get a broad picture of what you can do. Quarto is based on Pandoc (https://pandoc.org) and use its system with useful addition. The conversion from You can interact with the process is several way to tweak the default. First, as I mentioned, a default TeX template is used. You can find it [here for Pandoc]https://github.com/jgm/pandoc/blob/master/data/templates/default.latex) and we get a copy of it in Quarto. This template follows Pandoc's templating system (https://pandoc.org/MANUAL.html#template-syntax) which allows some variables. This mean of lot of things can be tweak by only setting some value in the YAML, like setting title, changing More specifically, you can also add some content in header, before body and after body using special What to do if your template is more complex that the default one and setting YAML fields or setting includes is not enough ?
So for complex document, you would tweak this. For example doing that in your YAML header format:
pdf:
template-partials:
- title.tex This would replace the title part of the default template, by your own template. Another way to tweak content is to do some processing before the template to transform the parsed Markdown content to some specific LaTeX code to be inserted (usually modyfing the body part or using the metadata). This can be done with Lua using a Filter. See more on this here: https://quarto.org/docs/extensions/filters.html All this can be done for a single project. The step after that would be to create a new format for Quarto, instead of tweaking the default It would use the same mechanism as described above (providing a new template, or rather using new partials, and possibly some filters) but this could be used in several project by installing the extension and then using Hope it helps you find the right way to use Quarto for your thesis. (We don't have a thesis format yet I think...) |
Beta Was this translation helpful? Give feedback.
-
@cderv, I thought I would need to explore the nuts and bolts of Quarto and pandoc, develop lua-filters etc... but most customizations I needed can actually be easily done with Quarto/Pandoc variables (as you predicted). Using variables and partials I believe I can finish tweaking a book project to my thesis format. Still, I was looking on the repo you referenced https://github.com/quarto-journals/. Is there anything different for creating an extension for a book? |
Beta Was this translation helpful? Give feedback.
-
@cderv, @dragonstyle, @rgaiacs The Lua filter options I saw focus on elements or blocks. I have no idea on how the book project type is built. Alternatively, I could come-up with a templating system like quarto_titlepages, but I think this would miss the opportunity of using the flexibility of Quarto authoring features. Any suggestion on how should I proceed? Is there an example of a filter or other kind of extension that include whole tex files in partials? Should I forget this strategy for something like what Titlepages does? |
Beta Was this translation helpful? Give feedback.
-
@fredguth Whenever I think "pre-process", I think makefile. I realize that's abandoning having it all bundled in |
Beta Was this translation helpful? Give feedback.
Thanks for you answer @rgaiacs. Let me give some additional context and details.
This will be a long answer to cover everything I think off, and I hope it will help you get a broad picture of what you can do.
Quarto is based on Pandoc (https://pandoc.org) and use its system with useful addition. The conversion from
.qmd
to.pdf
, will pass through a.md
file (with computational code evaluated) converted to.tex
by Pandoc going through an abstract representation (AST) and using a default template. Then LaTeX will convert to PDF.You can interact with the process is several way to tweak the default.
First, as I mentioned, a default TeX template is used. You can find it [here for Pandoc]https…