From 20211543c84c022995a282106742401c5d7941ae Mon Sep 17 00:00:00 2001 From: "Elizabeth (Liz) Dobbins" Date: Tue, 27 Aug 2024 08:22:21 -0800 Subject: [PATCH] Trying to add button to PDF --- .gitignore | 12 ++++++++++++ README.md | 33 +++++++++++++++++++++++++++------ _quarto-html.yml | 1 + consumption.qmd | 4 ++-- 4 files changed, 42 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 47f3d24..7708ebe 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,18 @@ dev_* *_cache/ _site/ _book/ +README_files/ +capacity_files/ +consumption_files/ +generation_files/ +prices_files/ +*.html +*.aux +*.lof +*.log +*.lot +*.tex +*.toc node_modules/ diff --git a/README.md b/README.md index 9f65cc3..1b8f9fc 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,49 @@ # AETR Web Book -Preliminary Alaska Electricity Trends Report as a web book. +Preliminary Alaska Electricity Trends Report as a web book. ## Preview and Render Locally +### Prepare the environment + +Rendering this web-book requires R (>=4.4.0) and some R packages. + +1. Install R from [The Comprehensive R Archive Network](https://cran.r-project.org) using the correct method for your operating system. +2. Install OpenSSL, which is required for one of the packages. + +3. Issue these commands on your command line (or however you access R) to prepare your R environment using `renv`: + + ``` bash + % cd aetr-web-book-2024/ + % R # at the command line to start R + > renv::restore() + ``` -[Website Previewing](https://quarto.org/docs/websites/#website-preview) allows viewing of the completed website by generating HTML from the `qmd` files. VSCode and RStidio both render and preview pages automatically using a `Render` button. +4. The Barlow font must be installed. + + +### Previewing + +[Web-book Previewing](https://quarto.org/docs/websites/#website-preview) allows viewing of the completed website by generating HTML from the `qmd` files. To preview the web-book using commands in the terminal: -To preview the website using commands in the terminal: ``` bash -# preview the website in the current directory +# preview the web-book in the current directory quarto preview ``` + It should automatically open a browser window. See `quarto preview help` for hints -You can also render the website without displaying it. The generated code goes in the `_site` directory (which should be listed in .gitignore) +You can also render the web-book without displaying it. The generated code goes in the `_book` directory (which should be listed in .gitignore) + ``` bash # render the website in the current directory quarto render ``` +VSCode and RStudio both render and preview pages automatically using a `Render` button. In VSCode, open a `.qmd` page in the editor such as `index.qmd`, and + ## Publishing via GitHub -Set things up (or is that the cc business) ## Credits diff --git a/_quarto-html.yml b/_quarto-html.yml index 6556ffe..6fdda44 100644 --- a/_quarto-html.yml +++ b/_quarto-html.yml @@ -9,6 +9,7 @@ book: text: Alaska Energy Statistics Workbooks (2011-2021) icon: bi-file-spreadsheet repo-actions: [issue] + downloads: pdf chapters: - index.qmd diff --git a/consumption.qmd b/consumption.qmd index f0cb297..76c158c 100644 --- a/consumption.qmd +++ b/consumption.qmd @@ -248,7 +248,7 @@ print(customers_pdf) `r space()` -`r if (knitr::is_html_output())"@fig-sales_per_capita-html" else if (knitr::is_latex_output()) "@fig-sales_per_capita-pdf"` shows the average annual electricity consumption for each of the regions. The Coastal region led the state in consumption per capita, with an average of `r regional_consumption_per_capita("Coastal","Residential")` kWh per customer per year. This was followed by the Railbelt region with `r regional_consumption_per_capita("Railbelt","Residential")` kWh per capita and the Rural Remote region with `r regional_consumption_per_capita("Rural Remote","Residential")` kWh per capita. Overall, each region has seen reductions in consumption per capita, which may reflect improvements in energy efficient technologies and energy efficiency/conservation behaviors. +`r if (knitr::is_html_output())"@fig-sales_per_capita-html" else if (knitr::is_latex_output()) "@fig-sales-per-capita-pdf"` shows the average annual electricity consumption for each of the regions. The Coastal region led the state in consumption per capita, with an average of `r regional_consumption_per_capita("Coastal","Residential")` kWh per customer per year. This was followed by the Railbelt region with `r regional_consumption_per_capita("Railbelt","Residential")` kWh per capita and the Rural Remote region with `r regional_consumption_per_capita("Rural Remote","Residential")` kWh per capita. Overall, each region has seen reductions in consumption per capita, which may reflect improvements in energy efficient technologies and energy efficiency/conservation behaviors. `r space()` @@ -317,7 +317,7 @@ girafe(code = print(sales_per_capita_html)) ``` ```{r, eval=knitr::is_latex_output(), fig.pos = "H"} -#| label: fig-sales_per_capita-pdf +#| label: fig-sales-per-capita-pdf #| fig-cap: "Average Residential Sales per Customer" sales_per_capita_pdf <-