Skip to content

Commit

Permalink
update (#88)
Browse files Browse the repository at this point in the history
* Add hadamardown template (#67)

* Add hadamardown

* Update documentation

* Update DESCRIPTION

* Switch to PDF by default

* Update README.md

* Update README.md

* updates README.md (#78)

* updates README.md

* changes dependencies from devtools to remotes.

* Update template.tex (#79)

* Add link to amsterdown pkg in README (#80)

* Fixed broken URLs and added few more (#85)

* Fixed broken URLs and added few more

* Reversed a URL change for markdown cheatsheet

I moved the Rmakrdown Cheatsheet under R Markdown and reversed the modification of the Markdown Cheatsheet.

* Allow user to change bookdown::gitbook() options (#84)

* Add ...

* Allow user to change "before" and "after" toc arguments

* Pass all type of option and sub-options to bookdown::gitbook

Co-authored-by: Antoine Bichat <30300749+abichat@users.noreply.github.com>
Co-authored-by: Leon Reteig <35737105+lcreteig@users.noreply.github.com>
Co-authored-by: Mehrad Mahmoudian <m.mahmoudian@gmail.com>
  • Loading branch information
4 people authored May 25, 2020
1 parent 399064f commit f358802
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 16 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Description: Using the bookdown package and LaTeX and Word thesis templates from
Maintainer: Chester Ismay <chester.ismay@gmail.com>
Depends:
R (>= 3.2.0),
devtools,
remotes,
dplyr,
ggplot2,
bookdown,
Expand Down
38 changes: 30 additions & 8 deletions R/thesis.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,36 @@ thesis_pdf <- function(toc = TRUE, toc_depth = 3, highlight = "default", ...){
#' }
thesis_gitbook <- function(...){

base <- bookdown::gitbook(
split_by = "chapter+number",
config = list(toc = list(collapse = "section",
before = '<li><a href="./"></a></li>',
after = '<li><a href="https://github.com/rstudio/bookdown" target="blank">Published with bookdown</a></li>',
...)
)
)
config_default <- list(
toc = list(collapse = "section",
before = '<li><a href="./"></a></li>',
after = '<li><a href="https://github.com/rstudio/bookdown" target="blank">Published with bookdown</a></li>'))

listarg <- list(...)

if (!"split_by" %in% names(listarg)) {
listarg$split_by <- "chapter+number"
}

if (!"config" %in% names(listarg)) {
listarg$config <- config_default
} else {
if (!"toc" %in% names(listarg$config)) {
listarg$config$toc <- config_default$toc
} else {
if (!"collapse" %in% names(listarg$config$toc)) {
listarg$config$toc$collapse <- config_default$toc$collapse
}
if (!"before" %in% names(listarg$config$toc)) {
listarg$config$toc$before <- config_default$toc$before
}
if (!"after" %in% names(listarg$config$toc)) {
listarg$config$toc$after <- config_default$toc$after
}
}
}

base <- do.call(bookdown::gitbook, listarg)

# Mostly copied from knitr::render_sweave
base$knitr$opts_chunk$comment <- NA
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ Have you created a thesisdown template for your institution and would like to ha
|University of Washington |[benmarwick/huskydown](https://github.com/benmarwick/huskydown) |[ismayc/thesisdown](https://github.com/ismayc/thesisdown) |
|TU Wien |[ben-schwen/robotdown](https://github.com/ben-schwen/robotdown) |[ismayc/thesisdown](https://github.com/ismayc/thesisdown) |
|University of Bristol |[mattlee821/bristolthesis](https://github.com/mattlee821/bristolthesis) |[ismayc/thesisdown](https://github.com/ismayc/thesisdown) |
|Universidade Federal de Santa Catarina | [lfpdroubi/ufscdown](https://github.com/lfpdroubi/ufscdown) |[ismayc/thesisdown](https://github.com/ismayc/thesisdown) |
|Universiteit van Amsterdam | [lcreteig/amsterdown](https://github.com/lcreteig/amsterdown) |[benmarwick/huskydown](https://github.com/benmarwick/huskydown) |

### Using thesisdown from Chester's GitHub

Expand All @@ -63,13 +65,17 @@ tinytex::install_tinytex()
tinytex:::is_tinytex()
```

You may need to install a few extra LaTeX packages on your first attempt to knit as well.
You may need to install a few extra LaTeX packages on your first attempt to knit as well. Here is one such example of how to do so:

```{r}
tinytex::tlmgr_install("babel-portuges")
```

To use **thesisdown** from [RStudio](http://www.rstudio.com/products/rstudio/download/):

1) Ensure that you have already installed LaTeX and the fonts described above, and are using the latest version of [RStudio](http://www.rstudio.com/products/rstudio/download/). You can use `thesisdown` without RStudio. For example, you can write the Rmd files in your favourite text editor (e.g. [Atom](https://atom.io/), [Notepad++](https://notepad-plus-plus.org/)). But RStudio is probably the easiest tool for writing both R code and text in your thesis. It also provides a nice way to build your thesis while editing. We'll proceed assuming that you have decided to use the RStudio workflow.

2) Install the **bookdown** and **thesisdown** packages:
2) Install the **bookdown** and **thesisdown** packages. Note that **thesisdown** is not available on CRAN at the moment and that's why `install.packages("thesisdown")` won't work. Use `remotes::install_github()` as shown below instead to install the package.

```r
if (!require("remotes")) install.packages("remotes", repos = "http://cran.rstudio.org")
Expand Down
15 changes: 12 additions & 3 deletions inst/rmarkdown/templates/thesis/skeleton/01-chap1.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,17 @@ flights %>% filter(month == 3, day == 3) %>%

- _Markdown_ Cheatsheet - <https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet>

- _R Markdown_ Reference Guide - <https://www.rstudio.com/wp-content/uploads/2015/03/rmarkdown-reference.pdf>
- _R Markdown_
- Reference Guide - <https://www.rstudio.com/wp-content/uploads/2015/03/rmarkdown-reference.pdf>
- Cheatsheet - <https://github.com/rstudio/cheatsheets/raw/master/rmarkdown-2.0.pdf>

- Introduction to `dplyr` - <https://cran.rstudio.com/web/packages/dplyr/vignettes/introduction.html>
- _RStudio IDE_
- Cheatsheet - <https://github.com/rstudio/cheatsheets/raw/master/rstudio-ide.pdf>
- Official website - <https://rstudio.com/products/rstudio/>

- Introduction to `dplyr` - <https://cran.rstudio.com/web/packages/dplyr/vignettes/dplyr.html>

- `ggplot2`
- Documentation - <https://ggplot2.tidyverse.org/>
- Cheatsheet - <https://github.com/rstudio/cheatsheets/raw/master/data-visualization-2.1.pdf>

- `ggplot2` Documentation - <http://docs.ggplot2.org/current/>
4 changes: 2 additions & 2 deletions inst/rmarkdown/templates/thesis/skeleton/skeleton.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ title: 'My Final College Paper'
knit: "bookdown::render_book"
site: bookdown::bookdown_site
output:
# thesisdown::thesis_pdf: default
thesisdown::thesis_gitbook: default
thesisdown::thesis_pdf: default
# thesisdown::thesis_gitbook: default
# thesisdown::thesis_word: default
# thesisdown::thesis_epub: default
# If you are creating a PDF you'll need to write your preliminary content (e.g., abstract, acknowledgements) here or
Expand Down
10 changes: 10 additions & 0 deletions inst/rmarkdown/templates/thesis/skeleton/template.tex
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,16 @@
}
\makeatother

%Added by @MyKo101, code provided by @GerbrichFerdinands
$if(csl-refs)$
\newlength{\cslhangindent}
\setlength{\cslhangindent}{1.5em}
\newenvironment{cslreferences}%
{$if(csl-hanging-indent)$\setlength{\parindent}{0pt}%
\everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces$endif$}%
{\par}
$endif$

\renewcommand{\contentsname}{Table of Contents}
% End of CII addition

Expand Down

0 comments on commit f358802

Please sign in to comment.