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
111 stars 17 forks source link

Conflict of titlepage-pdf with margin figure captions #54

Open dkStevensNZed opened 3 months ago

dkStevensNZed commented 3 months ago

I'm using titlepage-pdf format for a quarto document. It works great except that when I use that format, the captions for margin figures are clipped to ~0.75" and the caption is hyphenated and wraps around to the next line. If I use the standard pdf format, the caption extends across the full width of the margin before wrapping. I've attached the pdf file produced using titlepage-pdf (see p. 2 of the file)

Tester.pdf

with format: titlepage

Figure 1: Empiri-
cal CDF

with format: pdf

Figure 1: Empirical CDF

format: pdf or titlepage-pdf editor: visual

\newgeometry{left=10mm,right= 80mm,top=25mm,bottom=25mm}

#| label: fig-ecdfm
#| fig-cap: Empirical CDF
#| echo: false
#| include: true
#| column: margin
#| fig-pos: center
#| fig-width: 4
#| fig-asp: .75
#| out-width: 2.5in

  x <- rnorm(10000,-0.75,1)
  hist(x)

\clearpage \restoregeometry `

eeholmes commented 3 months ago

Seems to have to do with the \usepackage{geometry} call. I can replicate with format: pdf by adding geometry. titlepage-pdf has a \usepackage{geometry} call backed in.

---
  title: Test case
  format: 
    pdf:
      documentclass: scrartcl
      geometry:
        - top=30mm
        - left=20mm
  ---

  # Introduction

  \newgeometry{left=10mm,right= 80mm,top=25mm,bottom=25mm}

  ```{r}
  #| label: fig-ecdfm
  #| fig-cap: Empirical CDF
  #| echo: false
  #| include: true
  #| column: margin
  #| fig-pos: center
  #| fig-width: 4
  #| fig-asp: .75
  #| out-width: 2.5in

    x <- rnorm(10000,-0.75,1)
    hist(x)
  ```

 \clearpage
 \restoregeometry
dkStevensNZed commented 3 months ago

After adding the geometry include with no success,I tried your example with the same result. Then I took out the documentclass: scrartcl and the result was correct, as I had gotten with 'just' pdf format. When I change the format from pdf: default to titlepage-pdf: default, the shortened caption came back. Is pdf with 'documentclass: scrartcl' the same as titlepage-pdf?