Skip to content

Commit

Permalink
Pptx template for aagi output (#14)
Browse files Browse the repository at this point in the history
Co-authored-by: Adam H. Sparks <adam.sparks@curtin.edu.au>
  • Loading branch information
VMT1312 and adamhsparks authored Sep 26, 2024
1 parent 3cc108c commit 3003f02
Show file tree
Hide file tree
Showing 9 changed files with 154 additions and 3 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ asset-report: ## Render pdf report document
asset-short-report: ## Render short pdf document
quarto render docs/demos/template-pdf-short-report.qmd --output-dir assets

assets: asset-report asset-short-report asset-docx asset-revealjs ## Render all assets
asset-pptx: ## Render pptx Slides
quarto render docs/demos/template-pptx.qmd --output-dir assets

assets: asset-report asset-short-report asset-docx asset-revealjs asset-pptx ## Render all assets

help: ## Show help messages for make targets
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(firstword $(MAKEFILE_LIST)) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-18s\033[0m %s\n", $$1, $$2}'
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ See the included template and demo file for each format here:
- **AAGI PDF Short Report:** [AAGI PDF Short Report Demo](demos/template-pdf-short-report+short+report.pdf) ([Source](https://github.com/AAGI-AUS/AAGIQuarto/blob/main/docs/demos/template-pdf-report.qmd))
- **AAGI PDF Report:** [AAGI PDF Report Demo](demos/template-pdf-report+report.pdf) ([Source](https://github.com/AAGI-AUS/AAGIQuarto/blob/main/docs/demos/template-pdf-report.qmd))
- **AAGI Word Document Report:** [AAGI Word Document Demo](demos/template-docx-report.docx) ([Source](https://github.com/AAGI-AUS/AAGIQuarto/blob/main/docs/demos/template-docx-report.qmd))
- **AAGI PPT:** [AAGI PPT Slide Demo](demos/template-pptx.pptx) ([Source](https://github.com/AAGI-AUS/AAGIQuarto/blob/main/docs/demos/template-pptx.qmd))

## Installing

Expand All @@ -29,6 +30,7 @@ For documentation on using reveal.js slides in Quarto, please see,

To use the formatted output, save your qmd file into the extension folder that you created using the command above. Then, in the output format use:
- **aggi-docx+report** for MS Word output
- **aagi-pptx** for MS PPT output
- **aagi-revealjs** for a revealjs presentation
- **aagi-pdf+report** for a full length PDF report
- **aagi-pdf+short+report** for a short PDF report
Expand Down
7 changes: 6 additions & 1 deletion _extensions/aagi/_extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,9 @@ contributes:
- assets/aagi_logo.pdf
- assets/partners.pdf
docx+report:
reference-doc: docx-report/template.docx
reference-doc: docx-report/template.docx
pptx:
reference-doc: pptx/template.pptx
toc: true
number-sections: false
incremental: true
Binary file added _extensions/aagi/assets/AAGI_pres_banner.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _extensions/aagi/assets/partners.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _extensions/aagi/assets/project_partner.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _extensions/aagi/pptx/template.pptx
Binary file not shown.
139 changes: 139 additions & 0 deletions docs/demos/template-pptx.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
---
title: "AAGI"
author: "Analytics for the Australian Grain Industry"
date: last-modified
format:
aagi-pptx: default
---

```{r}
#| label: load
#| message: false
if (!require("pak")) install.packages("pak")
if (!require("AAGIPalettes")) {
pak::pkg_install("AAGI-AUS/AAGIPalettes")
}
if (!require("AAGIThemes")) {
pak::pkg_install("AAGI-AUS/AAGIThemes")
}
if (!require("gapminder")) {
pak::pkg_install("gapminder")
}
library(ggplot2)
library(AAGIThemes)
# set ggplot2 theme
theme_set(theme_aagi())
```

## An AAGI pptx Theme for Quarto

This Quarto extension allows you to create your slides using a theme that follows AAGI typography and colour styles and provides the official AAGI logo and cover image for the title slide.

## Bullet point

- Point 1
- Point 2

## Tables

For tables, we suggest paring with the R package [{AAGIThemes}](https://github.com/AAGI-AUS/AAGIThemes) to provide AAGI themed tables using `theme_ft_aagi`, that offers more flexibility in formatting.

## Example

```{r}
#| label: tab-AAGI
#| message: false
#| echo: false
library(dplyr)
library(flextable)
library(AAGIThemes)
# set flextable theme
set_flextable_defaults(
theme_fun = theme_ft_aagi
)
flex_tab <- flextable(head(airquality) |>
mutate(`Month Name` = "May")) |>
autofit()
flex_tab
```

## Basic Figures

[{AAGIThemes}](https://github.com/AAGI-AUS/AAGIThemes) also provides support for theming basic figures in R, for example.

```{r}
#| label: graphics-figure
#| message: false
library(AAGIThemes)
plot_aagi(pressure)
```

## Figures with {ggplot2}

[{AAGIThemes}](https://github.com/AAGI-AUS/AAGIThemes) also provides support for theming [{ggplot2}](https://ggplot2.tidyverse.org) outputs in R, for example.

```{r}
#| label: ggplot2-figure
#| message: false
#Prepare data
library(gapminder)
library(dplyr)
library(ggplot2)
library(AAGIThemes)
facet <- gapminder |>
filter(continent != "Americas") |>
group_by(continent, year) |>
summarise(pop = sum(as.numeric(pop)))
#> `summarise()` has grouped output by 'continent'. You can override using the
#> `.groups` argument.
col_values <- c(
AAGIPalettes::colour_as_hex("AAGI Teal"),
AAGIPalettes::colour_as_hex("AAGI Green"),
AAGIPalettes::colour_as_hex("AAGI Yellow"),
AAGIPalettes::colour_as_hex("AAGI Blue")
)
#Make plot
ggplot() +
geom_area(data = facet, aes(x = year, y = pop, fill = continent)) +
scale_fill_manual(values = col_values) +
facet_wrap(~ continent, ncol = 5) +
scale_y_continuous(breaks = c(0, 2000000000, 4000000000),
labels = c(0, "2bn", "4bn")) +
theme_aagi() +
geom_hline(yintercept = 0,
linewidth = 1,
colour = "#474747") +
theme(legend.position = "none", axis.text.x = element_blank()) +
labs(title = "Asia's rapid growth", subtitle = "Population growth by continent, 1952-2007")
```

## Slides With Columns

::::: columns
::: {.column width="50%"}
This is a column on the left.
:::

::: {.column width="50%"}
This is a column on the right.
:::
:::::

# Thank You

<!-- Uncomment if you have a bibliography
## References
-->
4 changes: 3 additions & 1 deletion docs/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ This will install the extension and create an example qmd file that you can use

For each format, there is a template file available. See:

- **RevealJS:** [AAGI RevealJS Slide Demo](demos/template-revealjs.qmd) ([Source](https://github.com/AAGI-AUS/AAGIQuarto/blob/main/docs/demos/template-revealjs.qmd))
- **RevealJS Presentation:** [AAGI RevealJS Slide Demo](demos/template-revealjs.qmd) ([Source](https://github.com/AAGI-AUS/AAGIQuarto/blob/main/docs/demos/template-revealjs.qmd))
- **AAGI PDF Short Report:** [AAGI PDF Short Report Demo](demos/template-pdf-short-report+short+report.pdf) ([Source](https://github.com/AAGI-AUS/AAGIQuarto/blob/main/docs/demos/template-pdf-report.qmd))
- **AAGI PDF Report:** [AAGI PDF Report Demo](demos/template-pdf-report+report.pdf) ([Source](https://github.com/AAGI-AUS/AAGIQuarto/blob/main/docs/demos/template-pdf-report.qmd))
- **AAGI Word Document Report:** [AAGI Word Document Demo](demos/template-docx-report.docx) ([Source](https://github.com/AAGI-AUS/AAGIQuarto/blob/main/docs/demos/template-docx-report.qmd))
- **AAGI PowerPoint Presentation:** [AAGI PPT Slide Demo](demos/template-pptx.pptx) ([Source](https://github.com/AAGI-AUS/AAGIQuarto/blob/main/docs/demos/template-pptx.qmd))

## Using

Expand All @@ -31,6 +32,7 @@ For documentation on using reveal.js slides in Quarto, please see,

To use the formatted output, save your qmd file into the extension folder that you created using the command above. Then, in the output format use:
- **aggi-docx+report** for MS Word output
- **aagi-pptx** for MS PPT output
- **aagi-revealjs** for a revealjs presentation
- **aagi-pdf+report** for a full length PDF report
- **aagi-pdf+short+report** for a short PDF report
Expand Down

0 comments on commit 3003f02

Please sign in to comment.