nmfs-opensci / quarto_titlepages

A Quarto extension for making title and cover pages for PDF output.
https://nmfs-opensci.github.io/quarto_titlepages/
Creative Commons Zero v1.0 Universal
115 stars 20 forks source link

[Question] How to insert line break in subtitle? #19

Closed fredguth closed 1 year ago

fredguth commented 1 year ago

First of all, thanks for this great extension!

I have some questions regarding the usage of quarto_titlepages: 1) How do I insert a line break in a subtitle? I have tried: subtitle: "line1\\line2" subtitle: "line1\\\\\line2"

subtitle: |
  line1
  line2

none of these options worked.

2) Do I need to install the fonts or is it automatic?

3) Can I have a title_page classic lined theme as cover page and formal theme as a title page?

4) How can I use the fonts installed and used in the classic lined theme as the font used in my headings?

eeholmes commented 1 year ago

Hi!

  1. You were so close!
subtitle: |
  line1 \
  line2 \

with the \ at the end. I think it is a Pandoc syntax thing.

  1. If you are trying to change the font for the whole document, then look up the Quarto documentation on font specification: https://quarto.org/docs/reference/formats/pdf.html#fonts. Typically what you need to do is install a font library. Something like \usepackage{lmodern} in your header. But you might try some font names, "Palatino" and see if it works just be aware that your code will break on another machine if that machine doesn't have the fonts installed.

But I have spent too many hours fighting fonts, so I just download the fonts from https://tug.org/FontCatalogue/ and use the font file. And use something like

  coverpage-theme:
    title-fontfamily: "QTDublinIrish.otf"

which inserts a font-family definition using the font file. The bad part about this is it probably won't recognize bold and italic since those are separate files.

  1. Sorry I have not implemented that. But you can use just static tex pages https://nmfs-opensci.github.io/quarto_titlepages/06-static-files.html#static-cover-page-and-title-page So

    titlepage: "none"
    coverpage: "none"  
    titlepage-include-file:
      - your_coverpage.tex
      - your_titlepage.tex

    If you use, keep-tex: true, you can see the tex and copy the tex code for the title pages for the 2 themes.

  2. Here is how to find the specification for any of the themes. In the documentation go to Title page themes

image

Click on titlepage-theme-code (it is kind of small).

For classic lined, that'll take you to

image

From this, you can see that no font-family is specified so it is using whatever is the default for Quarto (I forget what that is). But it has added some styling. Note, the styling is standard LaTeX without the \ in front of the command. Specifically: title-fontstyle: "uppercase" makes the title all uppercase. subtitle-fontstyle: ["Large", "textit"] converts to

\Large{\textit{<subtitle>}}

so makes the subtitle Large and italic. The footer is footer-fontstyle: ["large", "textsc"]. \textsc is a LaTeX styling with all caps but the first letter is a larger capital letter.

Hope that helps!

fredguth commented 1 year ago

Thanks!!!!