How do I add lettered appendices to a quarto manuscript project? #13190
Replies: 3 comments
-
Did you look at the other discussions on the subject?
Note that your example is not fully reproducible as it lacks all the metadata or did not tell if the default Manuscript project is the basis here. Could you please provide more details after going through the discussions linked and the documentation on appendices. |
Beta Was this translation helpful? Give feedback.
-
Thanks @mcanouil for the quick reply! And I apologize for the lack of details and the non-reproducible example. I can't find anything in the appendix documentation of scholarly writing on the numbering/lettering of the appendix sections. Adding {.appendix} to a heading marks it as an "appendix" section, but apart from now being able to play with the 3 appendix-style options shown in this documentation section, I don't know how to make use of this to adjust the lettering. I had looked through the discussions you linked above, but I didn't find anything that I thought would help. In #4581, the discussion revolves around formatting and cross-referencing appendices in article and book type qmd projects, in #8775 around book projects. I was hoping that there was a "simple" yaml setting for a manuscript project, that would allow formatting the appendices across output types. But perhaps, it doesn't exist? (You pointed out in #8775, that changing the numbering style of chapters of quarto books isn't possible, so perhaps what I'm trying to do isn't either...). The basis of my example is indeed the default manuscript project, cloned from here. I wanted to slim down the index file for clarity, but here it is, unadjusted, apart from the last lines, where I added
Whole index.qmd file: ---
title: La Palma Earthquakes
author:
- name: Steve Purves
orcid: 0000-0002-0760-5497
corresponding: true
email: [email protected]
roles:
- Investigation
- Project administration
- Software
- Visualization
affiliations:
- Curvenote
- name: Rowan Cockett
orcid: 0000-0002-7859-8394
corresponding: false
roles: []
affiliations:
- Curvenote
keywords:
- La Palma
- Earthquakes
abstract: |
In September 2021, a significant jump in seismic activity on the island of La Palma (Canary Islands, Spain) signaled the start of a volcanic crisis that still continues at the time of writing. Earthquake data is continually collected and published by the Instituto Geográphico Nacional (IGN). ...
plain-language-summary: |
Earthquake data for the island of La Palma from the September 2021 eruption is found ...
key-points:
- A web scraping script was developed to pull data from the Instituto Geogràphico Nacional into a machine-readable form for analysis
- Earthquake events on La Palma are consistent with the presence of both mantle and crustal reservoirs.
date: last-modified
bibliography: references.bib
citation:
container-title: Earth and Space Science
number-sections: true
---
## Introduction
```{r}
eruptions <- c(1492, 1585, 1646, 1677, 1712, 1949, 1971, 2021)
n_eruptions <- length(eruptions)
```
```{r}
#| label: fig-timeline
#| fig-cap: Timeline of recent earthquakes on La Palma
#| fig-alt: An event plot of the years of the last 8 eruptions on La Palma.
#| fig-height: 1.5
#| fig-width: 6
par(mar = c(3, 1, 1, 1) + 0.1)
plot(eruptions, rep(0, n_eruptions),
pch = "|", axes = FALSE)
axis(1)
box()
```
```{r}
#| output: false
avg_years_between_eruptions <- mean(diff(eruptions[-n_eruptions]))
avg_years_between_eruptions
```
Based on data up to and including 1971, eruptions on La Palma happen every `{r} round(avg_years_between_eruptions, 1)` years on average.
Studies of the magma systems feeding the volcano, such as @marrero2019, have proposed that there are two main magma reservoirs feeding the Cumbre Vieja volcano; one in the mantle (30-40km depth) which charges and in turn feeds a shallower crustal reservoir (10-20km depth).
Eight eruptions have been recorded since the late 1400s (@fig-timeline).
Data and methods are discussed in @sec-data-methods.
Let $x$ denote the number of eruptions in a year. Then, $x$ can be modeled by a Poisson distribution
$$
p(x) = \frac{e^{-\lambda} \lambda^{x}}{x !}
$$ {#eq-poisson}
where $\lambda$ is the rate of eruptions per year. Using @eq-poisson, the probability of an eruption in the next $t$ years can be calculated.
| Name | Year |
| -------------------- | ------ |
| Current | 2021 |
| Teneguía | 1971 |
| Nambroque | 1949 |
| El Charco | 1712 |
| Volcán San Antonio | 1677 |
| Volcán San Martin | 1646 |
| Tajuya near El Paso | 1585 |
| Montaña Quemada | 1492 |
: Recent historic eruptions on La Palma {#tbl-history}
@tbl-history summarises the eruptions recorded since the colonization of the islands by Europeans in the late 1400s.
{#fig-map}
La Palma is one of the west most islands in the Volcanic Archipelago of the Canary Islands (@fig-map).
{{< embed notebooks/explore-earthquakes.qmd#fig-spatial-plot >}}
@fig-spatial-plot shows the location of recent Earthquakes on La Palma.
## Data & Methods {#sec-data-methods}
## Conclusion
## References {.unnumbered}
:::{#refs}
:::
## Appendices {.appendix}
### Appendix 1 {.appendix} The appendix section of the html output looks like this: The goal, again, would be to have the Appendices lettered as they are in quarto books. Thanks again, for your time and any tips you may have! |
Beta Was this translation helpful? Give feedback.
-
The best you can do for now would be to use JavaScript to replace the numbers set by Quarto. ---
title: "13190"
authors:
- name: Norah Jones
affiliation: The University
roles: writing
corresponding: true
bibliography: references.bib
number-sections: true
include-after-body:
- text: |
<script>
document.addEventListener("DOMContentLoaded", function () {
const appendix = document.getElementById("quarto-appendix");
if (!appendix) return;
const headers = appendix.querySelectorAll('span.header-section-number');
headers.forEach((span, idx) => {
// Only renumber if the current number is numeric
if (/^\d+$/.test(span.textContent.trim())) {
// Convert index to uppercase letter (A, B, ...)
span.textContent = String.fromCharCode(65 + idx);
}
});
});
</script>
---
## Introduction
This is a simple placeholder for the manuscript's main document [@knuth84].
{{< lipsum 1 >}}
## Discussion
{{< lipsum 1 >}}
## Appendix A {.appendix}
{{< lipsum 1 >}}
## Appendix B {.appendix}
{{< lipsum 1 >}} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Hi,
I would like to add lettered appendices to a quarto manuscript project, but I can't seem to find a way to do it. From the quarto documentation, it seems to be an easy thing to do when working in a book project, but how can I do it in a manuscript project?
So say this is the structure of the index.qmd file in the manuscript project:
I would like the following numbering/lettering to apply to the different sections:
There seems to be a trick involving adding the following right before the Appendix 1 section
but that only seems to work for pdf output.
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions