Skip to content

Commit 68bbf7c

Browse files
author
cjvanlissa
committed
Update: separate chapter for prerequisites
1 parent f382672 commit 68bbf7c

23 files changed

+1572
-226
lines changed

_bookdown.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
book_filename: "bookdown-demo"
1+
book_filename: "gitbook-demo"
22
rmd_files: ["index.Rmd",
3+
"prerequisites.Rmd",
34
"get_your_gitbook.Rmd",
45
"editing_the_book.Rmd",
56
"figures_tables.Rmd",
67
"examples.Rmd",
8+
"open_educational.Rmd",
79
"licenses.Rmd",
810
"references.Rmd"]
911
output_dir: "docs"

docs/bookdown-demo.pdf

7.63 KB
Binary file not shown.

docs/bookdown-demo.tex

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120

121121
\title{A GitBook Example for Teaching}
122122
\author{\href{https://www.uu.nl/staff/CJvanLissa}{dr. Caspar J. van Lissa}}
123-
\date{2020-03-26}
123+
\date{2020-03-28}
124124

125125
\begin{document}
126126
\maketitle
@@ -129,6 +129,36 @@
129129
\setcounter{tocdepth}{1}
130130
\tableofcontents
131131
}
132+
\hypertarget{about-gitbooks}{%
133+
\chapter{About GitBooks}\label{about-gitbooks}}
134+
135+
A \emph{GitBook} is a useful tool for creating (open?) educational materials. It is an online ``book'' format, that can be hosted directly from a GitHub repository. You are currently reading a GitBook designed to help you get started creating your own educational GitBooks for your courses (how meta!). It does this in two ways: By explaining how to create GitBooks, and by serving as a template that you can copy and edit, instead of having to start from scratch. This template GitBook has all the settings that I consider to be useful for educational GitBooks, but you can always customize it.
136+
137+
I will focus specifically on GitBooks that are made in \href{www.rstudio.com}{Rstudio}, using the \href{https://rstudio.com/wp-content/uploads/2016/03/rmarkdown-cheatsheet-2.0.pdf}{\texttt{rmarkdown} markup language}, rendered using the \href{https://bookdown.org/yihui/bookdown/get-started.html}{\texttt{bookdown} package}, and hosted on \href{www.github.com}{GitHub}. \href{https://cjvanlissa.github.io/gitbook-demo/}{Here is an example of such a book}.
138+
139+
\hypertarget{why-use-a-gitbook-for-teaching}{%
140+
\section{Why use a GitBook for teaching?}\label{why-use-a-gitbook-for-teaching}}
141+
142+
\textbf{To spead the workload}
143+
144+
My challenge was that I had to translate all tutorial instructions from proprietary software to R, and there was not enough time to complete this task before the course commenced. By making the tutorial instructions available in \href{https://cjvanlissa.github.io/TCSM/}{this GitBook}, I was able to continue translating tutorial instructions \emph{while the semester was ongoing}, and push updates to GitHub in time for each session, which were immediately available to all students. The parallel with the current situation is that some courses are now forced to start teaching in an online format, without having enough time to completely prepare. By using a GitBook, you can spread out the workload of preparing your materials across the semester. \href{https://cjvanlissa.github.io/TCSM/}{This is the finished GitBook}
145+
146+
\textbf{To contribute or use existing Open Educational Materials}
147+
148+
Another key advantage of using a GitBook is, that you can easily make your course materials available for others to use under an open access license, or perhaps you can use an existing GitBook from the internet and adapt it for your own uses. GitBooks can be easily duplicated and adapted, just like any other project hosted on GitHub. Contributing Open Educational Materials can help reduce the workload on teachers around the world, and can improve the quality of the materials used thanks to online collaborating and feedback.
149+
150+
\textbf{To benefit from formatting advantages}
151+
152+
GitBooks also have two formatting advantages over classic PDF or Word files. First, they are Rmarkdown files, and can thus include blocks of R (\href{https://rstudio.github.io/reticulate/articles/r_markdown.html}{or Python}) code that can be evaluated, and whose results are rendered to the file. Second, they are interactive web pages, and as such, can have dynamic features (such as answers to assignments that can be hidden, or boxes where students can fill out an answer to be checked). Additionally, other web pages or interactive apps can be embedded within the page. So whereas a traditional document is static, GitBooks can be interactive.
153+
154+
\textbf{How do GitBooks work?}
155+
156+
GitBooks consist of an Rstudio project, with several Rmarkdown files containing the chapters of the book. Inside Rstudio, users can press a ``Build Book'' button, which renders all of these chapters to a nicely formatted HTML book (and a PDF file for users to download). Users can push the finished book to a GitHub repository, and indicate on GitHub that the book should be hosted on GitHub pages. Voilà!
157+
158+
\textbf{Getting started}
159+
160+
If you are convinced that this tool might benefit your teaching, your first point of action is to prepare your system for creating GitBooks (Chapter \ref{prerequisites}). After that, you can get a copy of this GitBook as a template (Chapter \ref{getgitbook}). Then, you can start tweaking it for your own course!
161+
132162
\hypertarget{prerequisites}{%
133163
\chapter{Prerequisites}\label{prerequisites}}
134164

@@ -221,8 +251,8 @@ \chapter{Prerequisites}\label{prerequisites}}
221251

222252
That's it! Everything should be installed and connected now.
223253

224-
\hypertarget{get-your-gitbook}{%
225-
\chapter{Get your GitBook}\label{get-your-gitbook}}
254+
\hypertarget{getgitbook}{%
255+
\chapter{Get your GitBook}\label{getgitbook}}
226256

227257
To get your GitBook, you should follow these steps:
228258

@@ -300,6 +330,7 @@ \section{Creating new chapters}\label{creating-new-chapters}}
300330
\end{Shaded}
301331

302332
rmd\_files: {[}``index.Rmd'',
333+
``prerequisites.Rmd'',
303334
``get\_your\_gitbook.Rmd'',
304335
``editing\_the\_book.Rmd'',
305336
``figures\_tables.Rmd'',

docs/editing-the-book.html

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,34 @@
44

55
<meta charset="utf-8" />
66
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
7-
<title>Chapter 3 Editing the book | A GitBook Example for Teaching</title>
7+
<title>Chapter 4 Editing the book | A GitBook Example for Teaching</title>
88
<meta name="description" content="This GitBook is an example of a GitBook for teaching. It can be adapted for specific courses. The output format for this example is bookdown::gitbook." />
99
<meta name="generator" content="bookdown 0.17 and GitBook 2.6.7" />
1010

11-
<meta property="og:title" content="Chapter 3 Editing the book | A GitBook Example for Teaching" />
11+
<meta property="og:title" content="Chapter 4 Editing the book | A GitBook Example for Teaching" />
1212
<meta property="og:type" content="book" />
1313

1414

1515
<meta property="og:description" content="This GitBook is an example of a GitBook for teaching. It can be adapted for specific courses. The output format for this example is bookdown::gitbook." />
1616
<meta name="github-repo" content="cjvanlissa/gitbook-demo" />
1717

1818
<meta name="twitter:card" content="summary" />
19-
<meta name="twitter:title" content="Chapter 3 Editing the book | A GitBook Example for Teaching" />
19+
<meta name="twitter:title" content="Chapter 4 Editing the book | A GitBook Example for Teaching" />
2020

2121
<meta name="twitter:description" content="This GitBook is an example of a GitBook for teaching. It can be adapted for specific courses. The output format for this example is bookdown::gitbook." />
2222

2323

2424
<meta name="author" content="dr. Caspar J. van Lissa" />
2525

2626

27-
<meta name="date" content="2020-03-26" />
27+
<meta name="date" content="2020-03-28" />
2828

2929
<meta name="viewport" content="width=device-width, initial-scale=1" />
3030
<meta name="apple-mobile-web-app-capable" content="yes" />
3131
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
3232

3333

34-
<link rel="prev" href="get-your-gitbook.html"/>
34+
<link rel="prev" href="getgitbook.html"/>
3535
<link rel="next" href="figtab.html"/>
3636
<script src="libs/jquery-2.2.3/jquery.min.js"></script>
3737
<link href="libs/gitbook-2.6.7/css/style.css" rel="stylesheet" />
@@ -131,19 +131,23 @@
131131
<li><a href="./">A GitBook for Teaching</a></li>
132132

133133
<li class="divider"></li>
134-
<li class="chapter" data-level="1" data-path="index.html"><a href="index.html"><i class="fa fa-check"></i><b>1</b> Prerequisites</a></li>
135-
<li class="chapter" data-level="2" data-path="get-your-gitbook.html"><a href="get-your-gitbook.html"><i class="fa fa-check"></i><b>2</b> Get your GitBook</a></li>
136-
<li class="chapter" data-level="3" data-path="editing-the-book.html"><a href="editing-the-book.html"><i class="fa fa-check"></i><b>3</b> Editing the book</a><ul>
137-
<li class="chapter" data-level="3.1" data-path="editing-the-book.html"><a href="editing-the-book.html#creating-new-chapters"><i class="fa fa-check"></i><b>3.1</b> Creating new chapters</a></li>
138-
<li class="chapter" data-level="3.2" data-path="editing-the-book.html"><a href="editing-the-book.html#linking-across-chapters"><i class="fa fa-check"></i><b>3.2</b> Linking across chapters</a></li>
139-
<li class="chapter" data-level="3.3" data-path="editing-the-book.html"><a href="editing-the-book.html#advanced-editing"><i class="fa fa-check"></i><b>3.3</b> Advanced editing</a></li>
134+
<li class="chapter" data-level="1" data-path="index.html"><a href="index.html"><i class="fa fa-check"></i><b>1</b> About GitBooks</a><ul>
135+
<li class="chapter" data-level="1.1" data-path="index.html"><a href="index.html#why-use-a-gitbook-for-teaching"><i class="fa fa-check"></i><b>1.1</b> Why use a GitBook for teaching?</a></li>
140136
</ul></li>
141-
<li class="chapter" data-level="4" data-path="figtab.html"><a href="figtab.html"><i class="fa fa-check"></i><b>4</b> Figures and tables</a></li>
142-
<li class="chapter" data-level="5" data-path="examples.html"><a href="examples.html"><i class="fa fa-check"></i><b>5</b> Examples</a><ul>
143-
<li class="chapter" data-level="5.1" data-path="examples.html"><a href="examples.html#doing-meta-analysis-in-r"><i class="fa fa-check"></i><b>5.1</b> Doing Meta-Analysis in R</a></li>
144-
<li class="chapter" data-level="5.2" data-path="examples.html"><a href="examples.html#theory-construction-and-statistical-modeling"><i class="fa fa-check"></i><b>5.2</b> Theory Construction and Statistical Modeling</a></li>
137+
<li class="chapter" data-level="2" data-path="prerequisites.html"><a href="prerequisites.html"><i class="fa fa-check"></i><b>2</b> Prerequisites</a></li>
138+
<li class="chapter" data-level="3" data-path="getgitbook.html"><a href="getgitbook.html"><i class="fa fa-check"></i><b>3</b> Get your GitBook</a></li>
139+
<li class="chapter" data-level="4" data-path="editing-the-book.html"><a href="editing-the-book.html"><i class="fa fa-check"></i><b>4</b> Editing the book</a><ul>
140+
<li class="chapter" data-level="4.1" data-path="editing-the-book.html"><a href="editing-the-book.html#creating-new-chapters"><i class="fa fa-check"></i><b>4.1</b> Creating new chapters</a></li>
141+
<li class="chapter" data-level="4.2" data-path="editing-the-book.html"><a href="editing-the-book.html#linking-across-chapters"><i class="fa fa-check"></i><b>4.2</b> Linking across chapters</a></li>
142+
<li class="chapter" data-level="4.3" data-path="editing-the-book.html"><a href="editing-the-book.html#advanced-editing"><i class="fa fa-check"></i><b>4.3</b> Advanced editing</a></li>
145143
</ul></li>
146-
<li class="chapter" data-level="6" data-path="license-your-gitbook.html"><a href="license-your-gitbook.html"><i class="fa fa-check"></i><b>6</b> License your GitBook</a></li>
144+
<li class="chapter" data-level="5" data-path="figtab.html"><a href="figtab.html"><i class="fa fa-check"></i><b>5</b> Figures and tables</a></li>
145+
<li class="chapter" data-level="6" data-path="examples.html"><a href="examples.html"><i class="fa fa-check"></i><b>6</b> Examples</a><ul>
146+
<li class="chapter" data-level="6.1" data-path="examples.html"><a href="examples.html#doing-meta-analysis-in-r"><i class="fa fa-check"></i><b>6.1</b> Doing Meta-Analysis in R</a></li>
147+
<li class="chapter" data-level="6.2" data-path="examples.html"><a href="examples.html#theory-construction-and-statistical-modeling"><i class="fa fa-check"></i><b>6.2</b> Theory Construction and Statistical Modeling</a></li>
148+
</ul></li>
149+
<li class="chapter" data-level="7" data-path="open-educational-resources.html"><a href="open-educational-resources.html"><i class="fa fa-check"></i><b>7</b> Open Educational Resources</a></li>
150+
<li class="chapter" data-level="8" data-path="license-your-gitbook.html"><a href="license-your-gitbook.html"><i class="fa fa-check"></i><b>8</b> License your GitBook</a></li>
147151
<li class="chapter" data-level="" data-path="references.html"><a href="references.html"><i class="fa fa-check"></i>References</a></li>
148152
<li class="divider"></li>
149153
<li><a href="https://github.com/rstudio/bookdown" target="blank">Published with bookdown</a></li>
@@ -166,7 +170,7 @@ <h1>
166170

167171
<section class="normal" id="section-">
168172
<div id="editing-the-book" class="section level1">
169-
<h1><span class="header-section-number">Chapter 3</span> Editing the book</h1>
173+
<h1><span class="header-section-number">Chapter 4</span> Editing the book</h1>
170174
<p>The contents of the book are written in <strong>RMarkdown</strong>. You can use any formatting code that Pandoc’s Markdown supports, e.g., a math equation <span class="math inline">\(a^2 + b^2 = c^2\)</span>. Moreover, you can include chunks of R-code, like this:</p>
171175
<pre><code>```{r}
172176
print("This is an R-command!")
@@ -176,27 +180,29 @@ <h1><span class="header-section-number">Chapter 3</span> Editing the book</h1>
176180
<p>To edit the book, you can change the text in the <code>.Rmd</code> files. Each Rmd file should contain <strong>one and only one</strong> chapter. A chapter is defined by the first-level heading <code>#</code>, e.g., <code># Editing the book</code>.</p>
177181
<p>Any sub-headings within the chapter are indicated with several <code>#</code> signs, e.g., <code>##</code> (level 2) and <code>###</code> (level 3).</p>
178182
<div id="creating-new-chapters" class="section level2">
179-
<h2><span class="header-section-number">3.1</span> Creating new chapters</h2>
183+
<h2><span class="header-section-number">4.1</span> Creating new chapters</h2>
180184
<p>To create a new chapter, you must follow two steps: 1) Create the file, and 2) Include it in the list of chapters.</p>
181185
<p>First, to create the file for a new chapter in Rstudio, click <code>File &gt; New File &gt; Text file</code>. At the top of the file, write your chapter heading, as explained above. Then, click <code>File &gt; Save</code>. Save the file as <code>.Rmd</code>, without spaces in the file name, e.g.: <code>editing_the_book.Rmd</code>.</p>
182186
<p>Second, to include it in the list of chapters, open the file <code>_bookdown.yml</code> (click it in the Files explorer in the bottom right of Rstudio). This file has a list of <code>.Rmd</code> files to be included in the book. In this example, the list looks like this:</p>
183187
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" title="1">tmp &lt;-<span class="st"> </span><span class="kw">readLines</span>(<span class="st">&quot;_bookdown.yml&quot;</span>)</a>
184188
<a class="sourceLine" id="cb3-2" title="2"><span class="kw">cat</span>(tmp[<span class="kw">grep</span>(<span class="st">&quot;^rmd_files&quot;</span>, tmp)<span class="op">:</span><span class="kw">grep</span>(<span class="st">&quot;references</span><span class="ch">\\</span><span class="st">.Rmd&quot;</span>, tmp)], <span class="dt">sep =</span> <span class="st">&quot;</span><span class="ch">\n</span><span class="st">&quot;</span>)</a></code></pre></div>
185189
<p>rmd_files: [“index.Rmd”,
190+
“prerequisites.Rmd”,
186191
“get_your_gitbook.Rmd”,
187192
“editing_the_book.Rmd”,
188193
“figures_tables.Rmd”,
189194
“examples.Rmd”,
195+
“open_educational.Rmd”,
190196
“licenses.Rmd”,
191197
“references.Rmd”]</p>
192198
<p>Insert the file name of your new chapter in the desired position in this list.</p>
193199
</div>
194200
<div id="linking-across-chapters" class="section level2">
195-
<h2><span class="header-section-number">3.2</span> Linking across chapters</h2>
196-
<p>You can label chapter and section titles using <code>{#label}</code> after them. The labels can be used as cross-references. For example, we can link to Chapter <a href="figtab.html#figtab">4</a>. If you do not manually label chapters, there will be automatic labels anyway, e.g., Chapter <a href="examples.html#examples">5</a>.</p>
201+
<h2><span class="header-section-number">4.2</span> Linking across chapters</h2>
202+
<p>You can label chapter and section titles using <code>{#label}</code> after them. The labels can be used as cross-references. For example, we can link to Chapter <a href="figtab.html#figtab">5</a>. If you do not manually label chapters, there will be automatic labels anyway, e.g., Chapter <a href="examples.html#examples">6</a>.</p>
197203
</div>
198204
<div id="advanced-editing" class="section level2">
199-
<h2><span class="header-section-number">3.3</span> Advanced editing</h2>
205+
<h2><span class="header-section-number">4.3</span> Advanced editing</h2>
200206
<p>The convenient <a href="https://rstudio.com/wp-content/uploads/2016/03/rmarkdown-cheatsheet-2.0.pdf">Rmarkdown Cheat Sheet</a> by Rstudio covers most of the knowledge required for advanced Rmarkdown editing. You can print it out and stick it to your wall!</p>
201207

202208
</div>
@@ -206,7 +212,7 @@ <h2><span class="header-section-number">3.3</span> Advanced editing</h2>
206212
</div>
207213
</div>
208214
</div>
209-
<a href="get-your-gitbook.html" class="navigation navigation-prev " aria-label="Previous page"><i class="fa fa-angle-left"></i></a>
215+
<a href="getgitbook.html" class="navigation navigation-prev " aria-label="Previous page"><i class="fa fa-angle-left"></i></a>
210216
<a href="figtab.html" class="navigation navigation-next " aria-label="Next page"><i class="fa fa-angle-right"></i></a>
211217
</div>
212218
</div>
@@ -249,7 +255,7 @@ <h2><span class="header-section-number">3.3</span> Advanced editing</h2>
249255
"link": null,
250256
"text": null
251257
},
252-
"download": ["bookdown-demo.pdf"],
258+
"download": ["gitbook-demo.pdf"],
253259
"toc": {
254260
"collapse": "subsection"
255261
}

0 commit comments

Comments
 (0)