nmfs-opensci / quarto-thesis

Quarto extension for a masters or PhD thesis
Creative Commons Zero v1.0 Universal
46 stars 12 forks source link

Scoping of `setspace` classoption #1

Closed johnghill closed 1 year ago

johnghill commented 1 year ago

Prerequisites

Having trouble rendering to PDF?

Description

Alternative classoptions for line spacing have the effect of increasing all spacing, including of front matter, tables and code chunks (see Table 1.1 of the rendered A-doctoral-thesis-title.pdf file.

Steps to Reproduce

  1. Edit ./_extensions/quarto-thesis/_extension.yml
  2. Change classoption from singlespacing to either onehalfspacing or doublespacing
  3. quarto render to render PDF

Additional Information

Shouldn't user alterations to setspace be confined in their scope to paragraph text within the main body? Relevant Stack Overflow discussions here, here, and here

Adding the following to ./_quarto.yml protects single line spacing within code (shaded environment) and tabular environments. I'm not sure if all of these tabular environments are relevant : in my test (with keep-tex: true) Table 1.1 was located within a longtable environment.

format:
  quarto-thesis-pdf: 
    urlcolor: red
    toclinkcolor: black
    toc-depth: 2
    classoption: [onehalfspacing, oneside]
    header-includes: |
      \usepackage{etoolbox}
      \AtBeginEnvironment{Shaded}{\singlespace}
      \AtBeginEnvironment{tabular}{\singlespacing}
      \AtBeginEnvironment{lltable}{\singlespacing}
      \AtBeginEnvironment{longtable}{\singlespacing}
      \AtBeginEnvironment{tablenotes}{\doublespacing}
      \captionsetup[table]{font={stretch=1.5}}
      \captionsetup[figure]{font={stretch=1.5}}
eeholmes commented 1 year ago

Thanks for the comment and solution(!) The scoping of setspace, I assume is being set with the cls file (MastersDoctoralThesis.cls). While I could add those lines to the cls file, I think taking control of the spacing as you did by adding some lines to the header is a better approach.

I'll add your solution to the FAQs so if others have the same questions they can find a solution.

eeholmes commented 1 year ago

Moved solution to the discussion forum.