Session 1 Exercises
In the publishr_workshop RProject, open the exercises/session1.qmd Quarto script.
Writing in Quarto
Exercise 1: Text formatting
In the script you’ll see an example sentence (repeated below). Add some text formatting to it: try making some words bold, some italic, and add at least one superscript or subscript.
The mean first-pass reading time at the verb region was 312 ms (SD = 159 ms).
Exercise 2: Lists and callouts
Add an unordered list of three things you want to get out of this workshop. Then add a callout box (any type) with a note about your dataset.
Exercise 3: Headers
Add the following headers to structure this document:
- A level-2 header called “Methods”
- A level-3 header called “Participants”
- A level-3 header called “Materials”
Exercise 4: Cross-references
Add the label {#sec-methods} to your Methods header from Exercise 3. Then write a sentence below that cross-references it using @sec-methods.
Exercise 5: Citations
Add a citation to your methods section. You will need to:
- Add
bibliography: references.bibto your YAML (already done above) - Add
csl: apa.cslto your YAML (already done above) - Add at least one entry to
references.bib— you can use the R citation:
toBibtex(citation("base"))- Cite it in prose using
@keyor[@key]syntax
Exercise 6: References section
Add a references section at the end of this document so your citations are listed. Remember to use the .unnumbered class on the heading.
Exercise 7: Inline arithmetic
Use inline R code to compute and report the following directly in prose:
Complete the sentence below:
2 + 2 = ___, and the square root of 144 is ___.
Output formats
Add appropriate headers below to keep your work structured.
Exercise 1: HTML with TOC
The YAML above already has a toc: true option under html. Render this document to HTML and check that the table of contents appears. Try changing toc-depth to 2 and re-render — what changes?
Exercise 2: Word output
Change the active output format to docx and render. Open the .docx file and inspect your citation. How is it formatted? Can you edit it directly in Word?
To render to a specific format from the terminal: quarto render exercises/day1.qmd --to docx
Exercise 3: PDF and .tex output (stretch)
The YAML already has keep-tex: true under pdf. Render to PDF:
quarto render exercises/day1.qmd --to pdfThen:
- Open the PDF — does your citation look correct?
- Open the
.texfile — is your citation a live\cite{}command or plain text? - If you want to experiment with live citations in the
.texfile, try addingcite-method: natbibto your PDF YAML options and re-render. Does the citation look different in the PDF? In the.tex?
Getting APA 7 formatting with live .tex citations working perfectly involves trade-offs — see the Output Formats chapter for a full discussion. The goal here is simply to observe the difference, not necessarily to resolve it.