diff --git a/.github/workflows/quarto-publish.yml b/.github/workflows/quarto-publish.yml index 1cffb1c..15ce025 100644 --- a/.github/workflows/quarto-publish.yml +++ b/.github/workflows/quarto-publish.yml @@ -62,21 +62,18 @@ jobs: env: QUARTO_PROFILE: html GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Check chromium - # hack from https://github.com/quarto-dev/quarto-actions/issues/45 - run: | - echo $(which chromium-browser) - $(which chromium-browser) --headless https://www.chromestatus.com - - name: Render PDF - uses: quarto-dev/quarto-actions/render@v2 - with: - to: pdf - path: . - env: - QUARTO_PROFILE: pdf - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# - name: Render PDF +# uses: quarto-dev/quarto-actions/render@v2 +# with: +# to: pdf +# path: . +# env: +# QUARTO_PROFILE: pdf +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Manually Render PDF + run: quarto render --profile pdf --output-dir _book # Debug: List files after rendering PDF - name: List files after rendering PDF 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..2c7e88e 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,53 @@ # 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. The [Barlow font (Regular and Bold)](https://github.com/google/fonts/blob/main/ofl/barlow/) must be installed on your machine. This will be different for different operating systems. + + 1. For Macs, follow the instructions for [installing fonts via Font Book](https://support.apple.com/guide/font-book/install-and-validate-fonts-fntbk1000/mac) + + 2. For Linux, manually perform the commands listed in this project's [GitHub Workflow](https://github.com/eldobbins/aetr-web-book-2024/blob/b3c9762e4528243bef33a7e09d1e52dabc206602/.github/workflows/quarto-publish.yml#L51) + +4. 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() + ``` + +### Previewing Locally + +[Web book Previewing](https://quarto.org/docs/websites/#website-preview) describes viewing the website locally by using `quarto preview` on the command line to generate HTML from the `qmd` files. The generated HTML code goes in the `_book/` directory. It should also automatically open a browser window. See `quarto preview help` for hints. + +However, we use [Profiles](https://github.com/acep-uaf/aetr-web-book-2024/wiki/Quarto-Profiles) in this repository with three different configuration files which complicates local previewing somewhat. -[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. +1. `_quarto.yml` = the main configuration file that triggers the other two +2. `_quarto-html.yml` = configures the web book +3. `_quarto-pdf.yml` = configures the PDF report -To preview the website using commands in the terminal: -``` bash -# preview the website in the current directory -quarto preview -``` -It should automatically open a browser window. See `quarto preview help` for hints +If the default profile is not set in `_quarto.yml`, the `quarto preview` renders both, one after the other; however the second render clobbers the first so you can only view HTML or PDF depending on the order of the profile group. So in our case, it is better to specify which format you want to render with `quarto preview --profile html` or `quarto preview --profile pdf`, or to toggle `default` between the two by editing `_quarto.yml`. -You can also render the website without displaying it. The generated code goes in the `_site` 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 `Preview` button. In VSCode, open a `.qmd` page in the editor such as `index.qmd`, and hit shift-command-K to preview the page. ## Publishing via GitHub -Set things up (or is that the cc business) +This project includes a [GitHub Workflow](https://github.com/eldobbins/aetr-web-book-2024/blob/b3c9762e4528243bef33a7e09d1e52dabc206602/.github/workflows/quarto-publish.yml) that renders the Markdown as HTML and PDF and posts those to the `gh-pages` branch to create a website. You can see in that workflow that the two profiles are rendered sequentially with the PDF subsequently copied into the `gh-pages` branch to avoid the clobbering issue noted locally. +Note that rendered files and directories containing rendered files should be listed in `.gitignore` so they don't get copied into the GitHub repo. The presence of those files causes GitHub Actions to choke which breaks the generation and posting of the web book. ## Credits Website format is based on the [Quarto Website Tutorial](https://openscapes.github.io/quarto-website-tutorial/) developed by [Openscapes](https://openscapes.org/). Code is avalable in the [tutorial GitHub repo](https://github.com/Openscapes/quarto-website-tutorial/tree/main). -This project was created using the [cookiecutter-quarto-website](https://github.com/eldobbins/cookiecutter-quarto-website) template that utilizes the [Cookiecutter](https://cookiecutter.readthedocs.io/en/stable/README.html) project +This project was created using the [cookiecutter-quarto-website](https://github.com/eldobbins/cookiecutter-quarto-website) template that utilizes the [Cookiecutter](https://cookiecutter.readthedocs.io/en/stable/README.html) project, but has many extensions not included in that template. diff --git a/_quarto-html.yml b/_quarto-html.yml index 6556ffe..ae52f1d 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 @@ -51,6 +52,7 @@ format: code-copy: true code-overflow: wrap css: styles.css + email-obfuscation: javascript # fig-align: center Tried this but it overridden by Observable defaults (bootstrap?) number-depth: 2 theme: diff --git a/_quarto-pdf.yml b/_quarto-pdf.yml index 428bbcf..3ed8da8 100644 --- a/_quarto-pdf.yml +++ b/_quarto-pdf.yml @@ -28,6 +28,7 @@ format: fig-height: 3.25 fontsize: 11pt + mainfont: Barlow toc: true toc-depth: 3 diff --git a/_quarto.yml b/_quarto.yml index 4b1bdaa..35a64c1 100644 --- a/_quarto.yml +++ b/_quarto.yml @@ -20,5 +20,6 @@ warning: false cap-location: top profile: + default: html # toggle this to choose which profile to render if neither is specified group: - [pdf, html] 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 <- diff --git a/credits.qmd b/credits.qmd index 4114cf2..fb035d1 100644 --- a/credits.qmd +++ b/credits.qmd @@ -37,75 +37,50 @@ Data used in the energy workbooks comes from a variety of sources and partners, ## Credits and Roles {#sec-contacts} -```{r} -#| echo: false -# Hack to reuse footnotes from https://stackoverflow.com/questions/74632879/use-footnote-multiple-times-in-html-quarto - -gen_fn <- function(n, id) { - # n is number of footnote - # id is a unique id for that footnote - paste0('') -} -``` - The Alaska Electrical Trends report has been produced by the Alaska Center for Energy and Power ([ACEP](https://www.uaf.edu/acep/)) at the University of Alaska Fairbanks ([UAF](https://www.uaf.edu/uaf/index.php)). It is a collaboration between data scientists, researchers, and policy experts. Roles here are described by [Contributor Roles Taxonomy (CRediT)](https://credit.niso.org/). +### Authors -* [Jesse Kaczmarski](https://www.uaf.edu/acep/about/our-team/jesse-kaczmarski.php)`r if (knitr::is_html_output()) gen_fn(1, "fn1") else "^1^"` +* [Jesse Kaczmarski](https://www.uaf.edu/acep/about/our-team/jesse-kaczmarski.php)`r "^1^"` * Roles: data curation, formal analysis, project administration, software, validation, visualization, writing – original draft -* [Ian MacDougall](https://www.uaf.edu/acep/about/our-team/ian-macdougall.php)`r if (knitr::is_html_output()) gen_fn(1, "fn1") else "^1^"` +* [Ian MacDougall](https://www.uaf.edu/acep/about/our-team/ian-macdougall.php)`r "^1^"` * Roles: data curation, formal analysis, software, validation, visualization, writing – original draft -* [Steve Colt](https://www.uaf.edu/acep/about/our-team/steve-colt.php)`r if (knitr::is_html_output()) gen_fn(1, "fn1") else "^1^"` +* [Steve Colt](https://www.uaf.edu/acep/about/our-team/steve-colt.php)`r "^1^"` * Roles: data curation, formal analysis, investigation, validation, writing – review & editing -* [Elizabeth (Liz) Dobbins](https://www.uaf.edu/acep/about/our-team/elizabeth-dobbins.php)`r if (knitr::is_html_output()) gen_fn(1, "fn1") else "^1^"` +* [Elizabeth (Liz) Dobbins](https://www.uaf.edu/acep/about/our-team/elizabeth-dobbins.php)`r "^1^"` * Roles: software, project administration, resources, supervision, writing – review & editing -* Neil McMahon`r if (knitr::is_html_output()) gen_fn(3, "fn3") else "^3^"` +* Neil McMahon`r "^2^"` * Roles: data curation, investigation, validation -* [Sara Fisher-Goad](https://www.uaf.edu/research/contact-us/index.php)`r if (knitr::is_html_output()) gen_fn(2, "fn2") else "^2^"` +* [Sara Fisher-Goad](https://www.uaf.edu/research/contact-us/index.php)`r "^3^"` * Roles: conceptualization, validation, writing – review & editing -* [Brittany Smart](https://www.uaf.edu/acep/about/our-team/brittany-smart.php)`r if (knitr::is_html_output()) gen_fn(1, "fn1") else "^1^"` +* [Brittany Smart](https://www.uaf.edu/acep/about/our-team/brittany-smart.php)`r "^3^"` * Roles: project administration, writing – review & editing -* [Dayne Broderson](https://www.uaf.edu/acep/about/our-team/dayne-broderson.php)`r if (knitr::is_html_output()) gen_fn(1, "fn1") else "^1^"` +### Acknowledgements + +* [Dayne Broderson](https://www.uaf.edu/acep/about/our-team/dayne-broderson.php)`r "^1^"` * Roles: conceptualization, funding acquisition -* [Gwen Holdmann](https://www.uaf.edu/acep/about/our-team/gwen-holdmann.php)`r if (knitr::is_html_output()) gen_fn(1, "fn1") else "^1^"` +* [Gwen Holdmann](https://www.uaf.edu/acep/about/our-team/gwen-holdmann.php)`r "^1^"` * Roles: conceptualization, funding acquisition -* [Shivani Mathur](https://www.uaf.edu/acep/about/our-team/shivani-mathur.php)`r if (knitr::is_html_output()) gen_fn(1, "fn1") else "^1^"` +* [Emily Richmond](https://www.uaf.edu/acep/about/our-team/emily-richmond.php)`r "^1^"` + * Roles: software, visualization + +* [Shivani Mathur](https://www.uaf.edu/acep/about/our-team/shivani-mathur.php)`r "^1^"` * Roles: validation, writing – review & editing -* [Erika Boice](https://www.uaf.edu/acep/about/our-team/erika-boice.php)`r if (knitr::is_html_output()) gen_fn(1, "fn1") else "^1^"` +* [Erika Boice](https://www.uaf.edu/acep/about/our-team/erika-boice.php)`r "^1^"` * Roles: writing – review & editing ### Affiliations -```{=html} - -``` - -::: {.content-visible when-format="pdf"} - -**^1^ [Alaska Center for Energy and Power](https://www.uaf.edu/acep/)** - -\vspace{1em} - -**^2^ [Office of the Vice Chancellor for Research, UAF](https://www.uaf.edu/research/)** - -\vspace{1em} - -**^3^ [DOWL](https://www.dowl.com)** - -::: +1. Alaska Center for Energy and Power ([ACEP](https://www.uaf.edu/acep/)), University of Alaska Fairbanks ([UAF](https://www.uaf.edu/uaf/index.php)) +2. Project Manager, [DOWL](https://www.dowl.com/) +3. [Office of the Vice Chancellor for Research](https://www.uaf.edu/research/), University of Alaska Fairbanks ([UAF](https://www.uaf.edu/uaf/index.php)) diff --git a/index.qmd b/index.qmd index 62d7452..510da7f 100644 --- a/index.qmd +++ b/index.qmd @@ -14,20 +14,19 @@ source("scripts/R/space.R") `r space(br="", vspace="-3em")` +::: {.content-visible when-format="html"} + ## Welcome {#welcome .unnumbered} -This report summarizes electricity data gathered from federal, state, and utility sources. It provides an overview of electricity capacity, generation, consumption, and price trends from 2011 to 2021. A comprehensive report highlighting these trends has not been produced for the state of Alaska since 2013's _Alaska Energy Statistics Report_. +This report summarizes electricity data gathered from federal, state, and utility sources. It provides an overview of electricity capacity, generation, consumption, and price trends from 2011 to 2021. A comprehensive report highlighting these trends has not been produced for the state of Alaska since 2013's _Alaska Energy Statistics Report_. It is available in two formats: as a PDF and as a digital "web book". -::: {.content-visible when-format="html"} -This web book is designed as 'best available' document for the 2011-2021 energy trends data and reports. This website will be updated when updates to the underlying 2011-2021 data or fixes become available. Future year trends reports will be tackled in a different context and reporting structure. +The web book is designed as 'best available' document for the 2011-2021 energy trends data and reports. This website will be updated when updates to the underlying 2011-2021 data or fixes become available. Future year trends reports will be tackled in a different context and reporting structure. Please explore the data using the chapter navigation links in the left sidebar and the section navigation links in the right sidebar. -::: ## How to Cite -::: {.content-visible when-format="html"} -Alaska Center for Energy and Power. "2024 Alaska Energy Trends Report Web Book." Accessed `{ojs} currentDate`. https://acep-uaf.github.io/aetr-web-book-2024 +Kaczmarski, J., I. Yeager, S. Colt, E. L. Dobbins, N. McMahon, S. Fisher-Goad, and B. Smart. "2024 Alaska Energy Trends Report Web Book." Accessed `{ojs} currentDate`. https://acep-uaf.github.io/aetr-web-book-2024 ```{ojs} //| echo: false @@ -55,7 +54,7 @@ citation_button = (blob, filename = 'test.bib', displayname) => { // BibLaTeX content biblatexContent = `@online{aetr_web_book_2024, - author = {{Alaska Center for Energy and Power}}, + author = {Jesse Kaczmarski and Ian Yeager and Steve Colt and Elizabeth L. Dobbins and Neil McMahon and Sara Fisher-Goad and Brittany Smart}, title = {{2024 Alaska Electricity Trends Report}}, year = 2024, url = {https://acep-uaf.github.io/aetr-web-book-2024/}, @@ -64,7 +63,13 @@ biblatexContent = risContent = `TY - ELEC -AU - Alaska Center for Energy and Power +AU - Kaczmarski,Jesse +AU - Yeager,Ian +AU - Colt,Steve +AU - Dobbins,Elizabeth L. +AU - McMahon,Neil +AU - Fisher-Goad,Sara +AU - Smart,Brittany TI - 2024 Alaska Electricity Trends Report PY - 2024 DA - {${year}-${month_2digit}-${day_2digit}} @@ -84,33 +89,10 @@ citation_button(ris_blob, 'aetr_web_book_2024.ris', 'RIS'); ::: - -::: {.content-visible when-format="pdf"} - -##### APA: -Alaska Center for Energy and Power. (2024). Alaska Energy Trends Report. Retrieved `r format(Sys.Date(), "%B %d, %Y")`, from https://acep-uaf.github.io/aetr-web-book-2024/report2024.pdf - -###### BibLaTeX: -```{r, eval=FALSE, echo=TRUE} -@online{aetr_web_book_2024, - author = {{Alaska Center for Energy and Power}}, - title = {{2024 Alaska Electricity Trends Report}}, - year = 2024, - url = {https://acep-uaf.github.io/aetr-web-book-2024/}, - urldate = {2024-08-01} -} -``` - -::: - -## Executive Summary {.unnumbered} +## Executive Summary {{< include _executive_summary.qmd >}} - -## Key Takeaways {.unnumbered} +## Key Takeaways {{< include _key_takeaways.qmd >}} - - - diff --git a/methods.qmd b/methods.qmd index 8f86d17..fcf1554 100644 --- a/methods.qmd +++ b/methods.qmd @@ -237,4 +237,4 @@ Please visit the Alaska Energy Authority [PCE webpage](https://www.akenergyauth ## Feedback Regarding Potential Errors -Since these data come from multiple sources, there is potential for errors in its compilation. An integral part of this effort is the creation of a high quality dataset that can constructively contribute to future work. Therefore, any discrepancies or noted errors should be reported using email or GitHub issues via the links in the right hand navigation menu of every page. Alternatively, direct contact information for members of the DCM team is listed in @sec-contacts. \ No newline at end of file +Since these data come from multiple sources, there is potential for errors in its compilation. An integral part of this effort is the creation of a high quality dataset that can constructively contribute to future work. Therefore, any discrepancies or noted errors should be reported by emailing [support](mailto:uaf-acep-dcm-support@alaska.edu) or submitting a GitHub issue via the links in the right hand navigation menu of every page of the web book. Alternatively, direct contact information for members of the DCM team is listed in @sec-contacts. diff --git a/scripts/latex/before-body.tex b/scripts/latex/before-body.tex index e966c27..d048b01 100644 --- a/scripts/latex/before-body.tex +++ b/scripts/latex/before-body.tex @@ -31,22 +31,20 @@ {\normalsize Jesse Kaczmarski \textsuperscript{1}, Ian Yeager \textsuperscript{1}, - Steve Colt \textsuperscript{1}\\ - Neil McMahon \textsuperscript{3}, - Sara Fisher-Goad \textsuperscript{2}, - Brittany Smart \textsuperscript{1}, - Dayne Broderson \textsuperscript{1} \\ - Gwen Holdmann \textsuperscript{1}, - Shivani Mathur \textsuperscript{1}, - Erika Boice \textsuperscript{1}, - Elizabeth Dobbins \textsuperscript{1}} + Steve Colt \textsuperscript{1}, + Elizabeth L. Dobbins \textsuperscript{1}\\ + Neil McMahon \textsuperscript{2}, + Sara Fisher-Goad \textsuperscript{3}, + Brittany Smart \textsuperscript{3}, +} \vspace{5ex} {\large - \textsuperscript{1} Alaska Center for Energy and Power \\ - \textsuperscript{2} Office of the Vice Chancellor for Research, UAF \\ - \textsuperscript{3} DOWL} + \textsuperscript{1} Alaska Center for Energy and Power, UAF \\ + \textsuperscript{2} DOWL \\ + \textsuperscript{3} Office of the Vice Chancellor for Research, UAF +} % \end{flushright} % uncomment if you want all text on one side @@ -62,10 +60,11 @@ \vspace{3ex} August 2024 \\ Suggested Citation: \\ -J. Kaczmarski et al., “2024 Alaska Energy Trends Report,” Alaska Center for Energy and Power, University of Alaska, Fairbanks, 2024. UAF/ACEP/number. DOI:number. +Kaczmarski, J., I. Yeager, S. Colt, E. L. Dobbins, N. McMahon, S. Fisher-Goad, and B. Smart. “2024 Alaska Energy Trends Report,” Alaska Center for Energy and Power, University of Alaska, Fairbanks, 2024. UAF/ACEP/number. DOI:number. -\newpage +% \newpage % \thispagestyle{empty} +\vspace{30ex} \noindent {\centering \bfseries\normalsize Notice @@ -75,4 +74,4 @@ \\ \small This report is available at no cost from the Alaska Center for Energy and Power (ACEP) at the University of Alaska, Fairbanks (UAF) at www.uaf.edu/acep/our-resources/index.php. \\ \\ -\small Cover photo courtesy of Frontier Suites \ No newline at end of file +\small Cover photo is the Salmon Creek Dam in Juneau, courtesy of Sarah Traiger. \ No newline at end of file diff --git a/scripts/latex/preamble.tex b/scripts/latex/preamble.tex index 09033f8..f50e483 100644 --- a/scripts/latex/preamble.tex +++ b/scripts/latex/preamble.tex @@ -1,17 +1,9 @@ \usepackage{graphicx} \usepackage{fancyhdr} \usepackage{xcolor} -\usepackage[T1]{fontenc} -\usepackage{fontspec} \usepackage[margin=2cm, bottom=2cm, top=3cm, headheight=50pt, footskip=20pt]{geometry} -% Set font to Barlow -\setmainfont{Barlow} - -% Styling -\renewcommand\familydefault{\sfdefault} - % Define colors \definecolor{uafblue}{HTML}{104179} \definecolor{uafyellow}{HTML}{F8DA08} @@ -22,9 +14,9 @@ \fancyhf{} \fancyhead[C]{ \makebox[0pt][c]{\hspace*{0cm}\color{uafblue}\rule{\dimexpr\textwidth+2cm\relax}{40pt}} - \makebox[0pt][c]{\hspace*{-0.25cm}\color{uafyellow}\rule{\dimexpr\textwidth+2cm\relax}{5pt}} + \makebox[0pt][c]{\hspace*{-0.145cm}\color{uafyellow}\rule{\dimexpr\textwidth+2cm\relax}{5pt}} } - \fancyhead[R]{\raisebox{17pt}{\color{white} \textbf{\fontsize{14}{16}\selectfont Alaska Electricity Trends Report, 2024}}} + \fancyhead[R]{\raisebox{17pt}{\color{white} \textbf{\fontsize{14}{16} Alaska Electricity Trends Report, 2024}}} \fancyfoot[R]{\raisebox{0pt}{\color{uafblue} \textbf{\thepage}}} \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt}