Skip to content
forked from ismayc/thesisdown

An updated R Markdown template for books as part of the digatus technical standards library, based on the bookdown package

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

workoho/dtsldown

 
 

Repository files navigation

dtsldown

Create 21st century documentation for digatus Technical Standards Library

This project was inspired by the reedtemplates package which in turn is based on bookdown.

Currently, the PDF, bs4_book and gitbook versions are fully-functional. The Word version has a basic template assigned. Lastly, the ePub version is developmental, has no templates behind it, and essentially calls the appropriate functions in bookdown.

If you are new to working with bookdown/rmarkdown, please read over the documentation available in the gitbook template at https://digatus-fwd.github.io/dtsldown_gitbook/.

The current output for the four versions is here:

Under the hood, the digatus DTSL LaTeX template is used to ensure that documents conform precisely to submission standards. At the same time, composition and formatting can be done using lightweight markdown syntax, and R code and its output can be seamlessly included using rmarkdown.

Using dtsldown from GitHub

Using {dtsldown} has some prerequisites which are described below. To compile PDF documents using R, you are going to need to have LaTeX installed. By far the easiest way to install LaTeX on any platform is with the tinytex R package:

install.packages(c('tinytex', 'rmarkdown'))
tinytex::install_tinytex()
# after restarting RStudio, confirm that you have LaTeX with
tinytex:::is_tinytex()

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:

tinytex::tlmgr_install("babel-portuges")

To use {dtsldown} from RStudio:

  1. Ensure that you have already installed LaTeX and the fonts described above, and are using the latest version of RStudio. You can use dtsldown without RStudio. For example, you can write the Rmd files in your favorite text editor (e.g. Atom, Notepad++). But RStudio is probably the easiest tool for writing both R code and text in your documentation. It also provides a nice way to build your documentation while editing. We’ll proceed assuming that you have decided to use the RStudio workflow.

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

    if (!require("remotes"))
      install.packages("remotes", repos = "https://cran.rstudio.org")
    remotes::install_github("rstudio/bookdown")
    remotes::install_github("digatus-fwd/dtsldown")

          Note that you may need to restart RStudio at this point for the following dialog to show up.

  1. Get started with the {dtsldown} template. There are two options for doing so.
  • 3a) RECOMMENDED Create a new RStudio project with a {dtsldown} template.

    In RStudio, click on File > New Project > New Directory. Then select DTSL Project using dtsldown from the dropdown that will look something like the image below. You’ll see the graduation cap as the icon on the left for the appropriate project type.

    Next, give your project a name and specify where you’d like the files to appear. In the screenshot below, the project name is my_dtsl and it will appear as a new folder on my Desktop.

    If you got this far, skip over step 3b which is the older version of getting the template. It might force you to change some of the directories to get knitting to work and has some other limitations as well. That’s why step 3a is recommended.

  • 3b) Use the New R Markdown dialog to select DTSL:

    Note that this will currently only Knit if you name the directory index as shown above. This guarantees that index.html is generated correctly for the bs4_book or Gitbook version of the documentation.

  1. After choosing which type of output you’d like in the YAML at the top of index.Rmd, Knit the index.Rmd file to get the book in PDF, Word HTML formats.

Day-to-day writing of your documentation

You need to edit the individual chapter R Markdown files to write your documentation. It’s recommended that you version control your documentation using GitHub if possible. RStudio can also easily sync up with GitHub to make the process easier. While writing, you should git commit your work frequently, after every major activity on your documentation. For example, every few paragraphs or section of text, and after major step of analysis development. You should git push at the end of each work session before you leave your computer or change tasks. For a gentle, novice-friendly guide to getting starting with using Git with R and RStudio, see https://happygitwithr.com/.

Rendering

To render your documentation into a PDF, open index.Rmd in RStudio and then click the “knit” button. To change the output formats between PDF, bs4_book, gitbook and Word, look at the output: field in index.Rmd and comment-out the formats you don’t want.

The PDF file of your documentation will be deposited in the _book/ directory, by default.

Components

The following components are ones you should edit to customize your documentation:

_bookdown.yml

This is the main configuration file for your documentation. You can change the name of your outputted file here for your documentation and other options about your documentation here.

index.Rmd

This file contains all the meta information that goes at the beginning of your document. You’ll need to edit the top portion of this file (the YAML) to put your name on the first page, the title of your documentation, etc. Note that you need to have at least one chapter start in the index.Rmd file for the build to work. For the template, this is done with # Introduction in the example from the template.

01-chap1.Rmd, 02-chap2.Rmd, etc.

These are the .Rmd files for each chapter in your dissertation. Write your documentation in these. If you’re writing in RStudio, you may find the wordcount addin useful for getting word counts and readability statistics in R Markdown documents.

bib/

Store your bibliography (as bibtex files) here. We recommend using the citr addin and Zotero to efficiently manage and insert citations.

Working with citations may be considered optional. The purpose of digatus Technical Standards documentation is different from academic writing. You should rather concentrate on inlcuding other references that might be interesting to the reader to get more details about your content so s/he will be able to better understand what you’re saying. Overall you would likely avoid repeating too many details that could be expexted professional knowledge.

csl/

Specific style files for bibliographies should be stored here. A good source for citation styles is https://github.com/citation-style-language/styles#readme.

figure/ and data/

Store your figures and data here and reference them in your R Markdown files. See the bookdown book for details on cross-referencing items using R Markdown.

About

An updated R Markdown template for books as part of the digatus technical standards library, based on the bookdown package

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TeX 66.6%
  • R 33.4%