### Repository <https://github.com/pzhaonet/bookdownplus> ### What Will I Learn? - Setting-up of the environment which bookdownplus requires. - Using the function `bd()` to build a demo book. - Using the function `bookdownplus()` with different output formats and templates. - Contribute your own templates. - Using other R packages to enhance bookdownplus. ### Requirements - Windows/mac/Linux OS - R environment - R bookdown package - R bookdownplus package - RStudio IDE (recommended) ### Difficulty - Intermediate ## Introduction The package [bookdownplus](https://cran.r-project.org/web/packages/bookdownplus) (Zhao 2017a) is an extension of R [bookdown](https://bookdown.org/yihui/bookdown/) (Xie 2016). It is a collection of multiple templates on the basis of LaTeX, which are tailored so that I can work happily under the umbrella of bookdown. bookdownplus helps you write academic journal articles, guitar books, chemical equations, mails, calendars, and diaries. An old tutorial for bookdownplus was written more than one year ago and included in the readme of the bookdownplus repo. However, it is out of date and too short. In the recent months, bookdownplus has changed significantly. The structure of the functions have been improved. More book and article templates have been included. The website [bookdownplus gallery](https://bookdownplus.netlify.com) has been set up. Thus, a new tutorial is necessary. ## Quick start ### Preparation 1. Install [R](https://cran.r-project.org), [RStudio](https://www.rstudio.com/products/rstudio/download/). LaTeX(e.g. [MiKTeX](https://miktex.org/) or [TinyTeX](https://yihui.name/tinytex/). See the [official manual of ‘bookdown’](https://bookdown.org/yihui/bookdown/) for details. 2. Run RStudio. Type the following codes in the top-left panel to install ‘bookdown’ packages: ``` r install.packages('bookdown') ``` ### Installation ``` r # the development version from GitHub (recommended) devtools::install_github("pzhaonet/bookdownplus") # or the stable version from CRAN install.package("bookdownplus") ```  ### Generate a demo book Firstly check your working directory (`getwd()`) and make sure that it is empty. `bookdownplus` will generate lots of files. An empty folder as a working directory is highly recommended. If you don’t know how to change your working directory with R command, you can use RStudio to create a new project (File – New Project - New Directory – Empty Project) and work always in this project. Run the following codes: ``` r require(bookdownplus) bd('ubt') ``` Now a demo dissertation for the University of Bayreuth is generated in many formats in the `_book/` folder in your working directory. Open `_book/ubt.pdf`or other files so as to get an impression.  ### Write your own book `bd()` is a simplified function for demos. The main function of the bookdownplus package is: ```r bookdownplus() ``` with multiple parameters. For example, ``` bookdownplus(template = 'ubt', render = TRUE) ``` You can see some other files (e.g. `index.Rmd`, `body.Rmd`, `-bookdownplus.Rproj`) and folders. Write your own texts in `body.Rmd` and revise the author and the book title in `index.Rmd`. You can use RStudio or any other text editor (but please don’t use Microsoft Word). After writing some texts, open `-bookdownplus.Rproj` with RStudio, and press `ctrl+shift+b` to build your own lovely book. ### More outputs By default, the book is built in a .pdf file and an .md file. From ‘bookdownplus v1.0.3’, users can get more output formats, including word, html and epub. From ‘bookdownplus v1.2.0’, uses can see the available output formats by running: ``` r get_output() ``` You can specify the `more_output` argument in the `bookdownplus()` function: ``` r bookdownplus(more_output = get_output()) ``` Then all the required output files are in `_book/` folder. ### More templates By default, the book is built from the ‘ubt’ template. From ‘bookdownplus v1.2.0’, users can see the available templates by running: ``` r get_template() ``` A template with a name ended with ’\_zh’ means that it supports Chinese characters. To list all these Chinese templates, run: ``` r grep('_zh$', get_template()[, 'name'], value = TRUE) ``` You can specify the `template` argument in the `bookdownplus()` function: ``` r bookdownplus(template = get_template()$name[1]) ``` Then all the required output files are in `_book/` folder. ## Magic trick Now it is time to witness the miracles. With the following magic trick you will see what bookdownplus can do. Chinese users can run the following codes, and go and have a coffee break. When you come back, you will get more than 20 demo books generated from available templates, each in .pdf, .doc, .html, and .epub formats, in `_book/`: ``` r bd() ``` Non-Chinese users might encounter some errors because their computers do not support Chinese characters in the demo books. Instead, run the following codes, which exclude the Chinese templates and the remote templates: ``` r my_t <- get_template() my_t <- my_t$name[my_t$location == 'local' & !grepl('_zh$', my_t$name)] bd(my_t) ``` ## Showcase The website [bookdownplus gallery](https://bookdownplus.netlify.com) shows some samples that bookdownplus provides. [](https://bookdownplus.netlify.com) ## Share Your Own Templates `bookdownplus` provides around 30 templates (Version 1.5.0). If you are willing to contribute your own bookdown templates to bookdownplus, just upload them to the [bookdownplus repo](https://github.com/pzhaonet/bookdownplus). They will be displayed in the [bookdownplus gallery](https://bookdownplus.netlify.com) automatically once accepted. From the version 1.5, bookdownplus opens a widest-ever door to contributors. Here is how: 1. Make sure that your template works successfully with bookdown. 2. Prepare a folder in your working directory by running: ```r bookdownplus::share('your_template_name') ``` Follow the instructions in each subfolder and create the required files. - (Mandatory) 'your_template_name/demo.zip' is the compressed file from your bookdown project folder. - (Optional) 'your_template_name/showcase/' contains the sample files (e.g. pdf, image files). An image file 'cover.png' is recommended, which will be used as the cover image in the gallery. - (Optional) You could write a 'your_template/readme.txt' (in markdown syntax), which will be displayed as the text in the gallery. 3. Upload your template folder 'your_template_name/' in to '[upload/](https://github.com/pzhaonet/bookdownplus/tree/master/upload)' of the bookdownplus repo. 4. Add the template information, including the template name, the contributor's name, and a brief introduction, into 'upload/-list.csv'. 5. Create a Pull Request to bookdownplus. Wait for the response, and your template will be available in the gallery. Users can get it easily by clicking the ".zip" link in the gallery, or running ``` bookdownplus("your_template_name") ``` ## Recommendations I have been developing some other packages, which bring more features into ‘bookdown’, such as: - [mindr](https://cran.r-project.org/web/packages/mindr) (Zhao 2017b), which can extract the outline of your book and turn it into a mind map, and - [pinyin](https://cran.r-project.org/web/packages/pinyin) (Zhao 2017c), which can automatically generate [‘{\#ID}’](https://bookdown.org/yihui/bookdown/cross-references.html) of the chapter headers even if there are Chinese characters in them. Both of them have been released on CRAN and can be installed via `install.packages('mindr')` and `install.packages('pinyin')`. Enjoy your bookdowning! ## References Xie, Yihui. 2016. *Bookdown: Authoring Books and Technical Documents with R Markdown*. <https://github.com/rstudio/bookdown>. Zhao, Peng. 2017a. *Bookdownplus: Generate Varied Types of Books and Documents with R ’Bookdown’ Package*. <https://CRAN.R-project.org/package=bookdownplus>. ———. 2017b. *Mindr: Convert Files Between Markdown or Rmarkdown Files and Mindmaps*. <https://CRAN.R-project.org/package=mindr>. ———. 2017c. *Pinyin: Convert Chinese Characters into Pinyin*. <https://CRAN.R-project.org/package=pinyin>. ### Proof of Work Done This tutorial is inserted into the readme of the bookdownplus repo: - <https://github.com/pzhaonet/bookdownplus> The code used in this tutorial can be found in: - <https://github.com/pzhaonet/bookdownplus-textbook/blob/master/codes/quickstart.R>
author | dapeng |
---|---|
permlink | bookdownplus-tutorial-installation |
category | utopian-io |
json_metadata | {"tags":["utopian-io","tutorials","r","promo-steem","markdown"],"image":["https://github.com/pzhaonet/bookdown-plus-textbook/raw/master/images/rstudio.jpg","https://raw.githubusercontent.com/pzhaonet/bookdownplus/master/inst2/ubt/showcase/cover.png","https://github.com/pzhaonet/bookdownplus-web/raw/master/static/img/webshot.png"],"links":["https://github.com/pzhaonet/bookdownplus","https://cran.r-project.org/web/packages/bookdownplus","https://bookdown.org/yihui/bookdown/","https://bookdownplus.netlify.com","https://cran.r-project.org","https://www.rstudio.com/products/rstudio/download/","https://miktex.org/","https://yihui.name/tinytex/","https://github.com/pzhaonet/bookdownplus/tree/master/upload","https://cran.r-project.org/web/packages/mindr","https://cran.r-project.org/web/packages/pinyin","https://bookdown.org/yihui/bookdown/cross-references.html","https://github.com/rstudio/bookdown","https://CRAN.R-project.org/package=bookdownplus","https://CRAN.R-project.org/package=mindr","https://CRAN.R-project.org/package=pinyin","https://github.com/pzhaonet/bookdownplus-textbook/blob/master/codes/quickstart.R"],"app":"steemit/0.1","format":"markdown"} |
created | 2018-09-24 13:22:00 |
last_update | 2018-09-25 11:21:54 |
depth | 0 |
children | 5 |
last_payout | 2018-10-01 13:22:00 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 27.591 HBD |
curator_payout_value | 8.622 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 8,783 |
author_reputation | 64,632,001,917,831 |
root_title | "[Tutorial for R bookdownplus package] Installation + Quick Start (in RStudio)" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 72,126,258 |
net_rshares | 26,366,880,481,411 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
deanliu | 0 | 404,225,780,945 | 30% | ||
magicmonk | 0 | 169,597,861,954 | 100% | ||
justyy | 0 | 21,101,305,959 | 1.08% | ||
jianghao | 0 | 231,676,028 | 10% | ||
dapeng | 0 | 32,057,444,795 | 100% | ||
happyukgo | 0 | 101,330,750 | 5% | ||
htliao | 0 | 321,251,067,689 | 100% | ||
smartcasual | 0 | 1,269,768,488 | 100% | ||
nationalpark | 0 | 21,908,414,395 | 100% | ||
shenchensucc | 0 | 789,138,616 | 50% | ||
sensation | 0 | 210,255,651 | 100% | ||
doughtaker | 0 | 12,084,100,058 | 50% | ||
codingdefined | 0 | 4,312,352,489 | 5% | ||
liangfengyouren | 0 | 1,654,327,657 | 50% | ||
pzhao | 0 | 4,411,876,037 | 100% | ||
jiangchen | 0 | 675,300,528 | 10% | ||
mangoanddaddy | 0 | 2,273,666,148 | 80% | ||
steem-d-anlovnit | 0 | 16,491,371,766 | 35% | ||
tvb | 0 | 70,753,784,510 | 100% | ||
skenan | 0 | 14,623,966,504 | 50% | ||
mrspointm | 0 | 18,576,376,988 | 37% | ||
liumei | 0 | 487,390,933 | 35% | ||
waiyee422 | 0 | 982,944,707 | 15.88% | ||
davidke20 | 0 | 4,254,771,268 | 5% | ||
rosatravels | 0 | 1,465,767,231 | 10% | ||
superbing | 0 | 407,959,125 | 5% | ||
espoem | 0 | 1,352,019,185 | 1.73% | ||
dailystats | 0 | 1,015,896,835 | 5% | ||
victory622 | 0 | 57,836,536,380 | 34% | ||
lindalex | 0 | 180,953,113 | 20% | ||
jianan | 0 | 966,143,996 | 5% | ||
utopian-io | 0 | 23,946,635,638,776 | 17.8% | ||
windowglass | 0 | 30,007,288,752 | 100% | ||
cnbuddy | 0 | 319,871,434,546 | 31.76% | ||
nileelily | 0 | 621,497,957 | 15.88% | ||
chann | 0 | 3,493,607,134 | 20% | ||
jacktan | 0 | 84,918,922 | 25% | ||
anxin | 0 | 133,512,745 | 5% | ||
angelina6688 | 0 | 16,515,977,442 | 100% | ||
lebin | 0 | 24,777,757,404 | 5% | ||
coindzs | 0 | 218,019,788 | 100% | ||
auleo | 0 | 3,942,494,440 | 20% | ||
amosbastian | 0 | 29,984,439,192 | 37.79% | ||
portugalcoin | 0 | 7,315,164,673 | 28% | ||
joeliew | 0 | 97,053,681 | 2.5% | ||
wilhb81 | 0 | 3,690,823,109 | 75% | ||
foodielifestyle | 0 | 54,627,279 | 5% | ||
woolfe19861008 | 0 | 113,191,246 | 5% | ||
dailychina | 0 | 1,124,583,261 | 5% | ||
yjcps | 0 | 1,950,982,583 | 90% | ||
dongfengman | 0 | 546,561,876 | 5% | ||
serenazz | 0 | 58,567,835 | 5% | ||
polbot | 0 | 252,983,604 | 100% | ||
shentrading | 0 | 86,044,204 | 28.58% | ||
ethanlee | 0 | 234,476,289 | 5% | ||
fanso | 0 | 66,944,544 | 5% | ||
eondas | 0 | 139,458,994 | 31.76% | ||
mansyaprime | 0 | 7,301,176,150 | 100% | ||
liewsc | 0 | 915,317,085 | 25% | ||
tanzy | 0 | 139,504,425 | 25% | ||
abss | 0 | 90,042,623 | 11% | ||
lilypang22 | 0 | 265,572,404 | 5% | ||
liewps | 0 | 139,634,157 | 25% | ||
liuzg | 0 | 452,677,409 | 25% | ||
honoru | 0 | 260,834,449 | 15.88% | ||
sweet-jenny8 | 0 | 1,043,834,355 | 5% | ||
fishlucy | 0 | 21,277,957,087 | 50% | ||
pgr | 0 | 303,252,479 | 25% | ||
china-mobile | 0 | 131,484,008 | 50% | ||
cn-malaysia | 0 | 5,769,023,855 | 10% | ||
xiaoyuanwmm | 0 | 494,559,801 | 50% | ||
ybeyond | 0 | 111,006,985 | 50% | ||
team-cn | 0 | 152,255,689,553 | 50% | ||
weitz | 0 | 128,567,476 | 25% | ||
marcoy2j | 0 | 148,541,290 | 31.76% | ||
shuxuan | 0 | 139,458,994 | 31.76% | ||
xiaowucw | 0 | 136,764,557 | 31.76% | ||
turtlegraphics | 0 | 577,796,326 | 5% | ||
sunai | 0 | 573,070,559 | 100% | ||
julian2013 | 0 | 32,628,354,296 | 100% | ||
bunnymandy | 0 | 66,741,583 | 25% | ||
changxiu | 0 | 83,411,569 | 15.88% | ||
myreader | 0 | 107,369,438,895 | 2% | ||
iauns | 0 | 20,522,236,372 | 25% | ||
jlsycxy | 0 | 91,142,275 | 15.88% | ||
wongmanman | 0 | 94,406,140 | 15.88% | ||
kissfirer | 0 | 299,623,363 | 50% | ||
witnesstools | 0 | 557,463,902 | 5% | ||
steem-ua | 0 | 428,151,513,014 | 1.82% | ||
ilovecoding | 0 | 430,209,480 | 5% | ||
foodblogresteem | 0 | 61,590,382 | 5% | ||
ygrj | 0 | 89,562,808 | 15.88% | ||
curbot | 0 | 3,843,784,376 | 10% | ||
steemfuckeos | 0 | 365,635,925 | 5% |
Thank you for your contribution @dapeng. Below we suggest some points: - We suggest that in the tutorial put the keyword R / R Studio in title. Tutorial well explained and easy to understand. Thank you for your beautiful work. Your contribution has been evaluated according to [Utopian policies and guidelines](https://join.utopian.io/guidelines), as well as a predefined set of questions pertaining to the category. To view those questions and the relevant answers related to your post, [click here](https://review.utopian.io/result/8/21133313). ---- Need help? Write a ticket on https://support.utopian.io/. Chat with us on [Discord](https://discord.gg/uTyJkNm). [[utopian-moderator]](https://join.utopian.io/)
author | portugalcoin |
---|---|
permlink | re-dapeng-bookdownplus-tutorial-installation-20180924t210753110z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"users":["dapeng"],"links":["https://join.utopian.io/guidelines","https://review.utopian.io/result/8/21133313","https://support.utopian.io/","https://discord.gg/uTyJkNm","https://join.utopian.io/"],"app":"steemit/0.1"} |
created | 2018-09-24 21:07:54 |
last_update | 2018-09-24 21:07:54 |
depth | 1 |
children | 2 |
last_payout | 2018-10-01 21:07:54 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 6.096 HBD |
curator_payout_value | 1.985 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 720 |
author_reputation | 598,828,312,571,988 |
root_title | "[Tutorial for R bookdownplus package] Installation + Quick Start (in RStudio)" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 72,163,750 |
net_rshares | 5,860,959,982,754 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
yuxi | 0 | 8,983,632,848 | 30% | ||
dapeng | 0 | 32,515,408,292 | 100% | ||
pixelfan | 0 | 2,078,368,960 | 0.54% | ||
espoem | 0 | 2,632,218,169 | 15% | ||
utopian-io | 0 | 5,773,216,154,029 | 4.41% | ||
zapncrap | 0 | 2,257,279,630 | 5% | ||
amosbastian | 0 | 5,714,692,674 | 7.54% | ||
curx | 0 | 2,055,380,739 | 5% | ||
organicgardener | 0 | 4,290,898,078 | 25% | ||
mightypanda | 0 | 24,151,606,669 | 30% | ||
anonyvoter | 0 | 1,318,775,619 | 50% | ||
fastandcurious | 0 | 1,489,043,689 | 35% | ||
mops2e | 0 | 256,523,358 | 10% |
Thank you very much for your comments! The title has been revised.
author | dapeng |
---|---|
permlink | re-portugalcoin-re-dapeng-bookdownplus-tutorial-installation-20180925t112239236z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"app":"steemit/0.1"} |
created | 2018-09-25 11:22:42 |
last_update | 2018-09-25 11:22:42 |
depth | 2 |
children | 0 |
last_payout | 2018-10-02 11:22:42 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 66 |
author_reputation | 64,632,001,917,831 |
root_title | "[Tutorial for R bookdownplus package] Installation + Quick Start (in RStudio)" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 72,219,917 |
net_rshares | 0 |
Thank you for your review, @portugalcoin! So far this week you've reviewed 5 contributions. Keep up the good work!
author | utopian-io |
---|---|
permlink | re-re-dapeng-bookdownplus-tutorial-installation-20180924t210753110z-20180930t144206z |
category | utopian-io |
json_metadata | "{"app": "beem/0.20.1"}" |
created | 2018-09-30 14:42:09 |
last_update | 2018-09-30 14:42:09 |
depth | 2 |
children | 0 |
last_payout | 2018-10-07 14:42:09 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 115 |
author_reputation | 152,955,367,999,756 |
root_title | "[Tutorial for R bookdownplus package] Installation + Quick Start (in RStudio)" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 72,358,887 |
net_rshares | 0 |
#### Hi @dapeng! Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation! Your post is eligible for our upvote, thanks to our collaboration with @utopian-io! **Feel free to join our [@steem-ua Discord server](https://discord.gg/KpBNYGz)**
author | steem-ua |
---|---|
permlink | re-bookdownplus-tutorial-installation-20180924t233355z |
category | utopian-io |
json_metadata | "{"app": "beem/0.19.54"}" |
created | 2018-09-24 23:33:57 |
last_update | 2018-09-24 23:33:57 |
depth | 1 |
children | 0 |
last_payout | 2018-10-01 23:33:57 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 285 |
author_reputation | 23,214,230,978,060 |
root_title | "[Tutorial for R bookdownplus package] Installation + Quick Start (in RStudio)" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 72,172,864 |
net_rshares | 0 |
Hey, @dapeng! **Thanks for contributing on Utopian**. We’re already looking forward to your next contribution! **Get higher incentives and support Utopian.io!** Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via [SteemPlus](https://chrome.google.com/webstore/detail/steemplus/mjbkjgcplmaneajhcbegoffkedeankaj?hl=en) or [Steeditor](https://steeditor.app)). **Want to chat? Join us on Discord https://discord.gg/h52nFrV.** <a href='https://steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1'>Vote for Utopian Witness!</a>
author | utopian-io |
---|---|
permlink | re-bookdownplus-tutorial-installation-20180930t143029z |
category | utopian-io |
json_metadata | "{"app": "beem/0.20.1"}" |
created | 2018-09-30 14:30:30 |
last_update | 2018-09-30 14:30:30 |
depth | 1 |
children | 0 |
last_payout | 2018-10-07 14:30:30 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 588 |
author_reputation | 152,955,367,999,756 |
root_title | "[Tutorial for R bookdownplus package] Installation + Quick Start (in RStudio)" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 72,358,298 |
net_rshares | 0 |