Skip to content

Commit

Permalink
Trying to add button to PDF
Browse files Browse the repository at this point in the history
  • Loading branch information
eldobbins committed Aug 27, 2024
1 parent b3c9762 commit 2021154
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 8 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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/

Expand Down
33 changes: 27 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions _quarto-html.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ book:
text: Alaska Energy Statistics Workbooks (2011-2021)
icon: bi-file-spreadsheet
repo-actions: [issue]
downloads: pdf

chapters:
- index.qmd
Expand Down
4 changes: 2 additions & 2 deletions consumption.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -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"` <!--orig: The following table--> 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"` <!--orig: The following table--> 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()`

Expand Down Expand Up @@ -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 <-
Expand Down

0 comments on commit 2021154

Please sign in to comment.