Skip to content

Commit 205e392

Browse files
Merge pull request #331 from UBC-DSCI/quotes
fixing figure captions in jupyter and version control
2 parents fb60e3a + 5b48e50 commit 205e392

File tree

3 files changed

+59
-18
lines changed

3 files changed

+59
-18
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,18 @@ bookdown::gitbook:
117117
- when saying that students will do things in code, always say "in R"
118118
- "you will be able to" (not "students will be able to", "the reader will be able to")
119119

120+
#### Captions
121+
- If you have special characters (particularly underscores, quotation marks, plus signs, other LaTeX math symbols) make sure to separate
122+
the caption out of the code chunk like so
123+
```
124+
(ref:blah)
125+
126+
\`\`\`
127+
{r blah, other_options}
128+
code here
129+
\`\`\`
130+
```
131+
120132
#### Equations
121133
- make sure all equations get capitalized labels ("Equation \\@ref(blah)", not "equation below" or "equation above")
122134

jupyter.Rmd

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,10 @@ image_read("img/out-of-order-2.png") |>
260260
image_crop("3632x800")
261261
```
262262

263-
```{r out-of-order-3, echo = FALSE, fig.cap = 'Code that was written out of order, and was executed in a linear order using "Restart Kernel and Run All Cells..." This resulted in an error at the execution of the second code cell and it failed to run all code cells in the notebook.', fig.retina = 2, out.width="100%"}
263+
264+
(ref:out-of-order-3) Code that was written out of order, and was executed in a linear order using "Restart Kernel and Run All Cells..." This resulted in an error at the execution of the second code cell and it failed to run all code cells in the notebook.
265+
266+
```{r out-of-order-3, echo = FALSE, fig.cap = '(ref:out-of-order-3)', fig.retina = 2, out.width="100%"}
264267
image_read("img/out-of-order-3.png") |>
265268
image_crop("3632x800")
266269
```

version-control.Rmd

Lines changed: 43 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ If you are working on a project with collaborators, they will also be making cha
267267
(e.g., to the analysis code in a Jupyter notebook and the project's README file),
268268
committing them to their own local repository, and pushing their commits to the remote GitHub repository
269269
to share them with you. When they push their changes, those changes will only initially exist in
270-
the remote GitHub repository and not in your local repository (Figure \@ref(fig:vc2-changes)).
270+
the remote GitHub repository and not in your local repository (Figure \@ref(fig:vc6-remote-changes)).
271271

272272
```{r vc6-remote-changes, fig.cap = 'Changes pushed by collaborators, or created directly on GitHub will not be automatically sent to your local repository.', fig.retina = 2, out.width="100%"}
273273
image_read("img/vc6-remote-changes.png") %>%
@@ -276,7 +276,7 @@ image_read("img/vc6-remote-changes.png") %>%
276276

277277
To obtain the new changes from the remote repository on GitHub, you will need
278278
to **pull** \index{git!pull} those changes to your own local repository. By pulling changes,
279-
you synchronize your local repository to what is present on GitHub.
279+
you synchronize your local repository to what is present on GitHub (Figure \@ref(fig:vc7-pull)).
280280
Additionally, until you pull changes from the remote repository, you will not
281281
be able to push any more changes yourself (though you will still be able to
282282
work and make commits in your own local repository).
@@ -310,7 +310,9 @@ your project by clicking on the "+" icon in the upper right
310310
hand corner, and then on "New Repository," as shown in
311311
Figure \@ref(fig:new-repository-01).
312312

313-
```{r new-repository-01, fig.cap = 'New repositories on GitHub can be created by clicking on "New Repository" from the + menu.', fig.retina = 2, out.width="100%"}
313+
(ref:new-repository-01) New repositories on GitHub can be created by clicking on "New Repository" from the + menu.
314+
315+
```{r new-repository-01, fig.cap = '(ref:new-repository-01)', fig.retina = 2, out.width="100%"}
314316
image_read("img/version_control/new_repository_01.png") %>%
315317
image_flop() %>%
316318
image_crop("3632x1148") %>%
@@ -449,7 +451,9 @@ image_read("img/version_control/upload-files_01.png") %>%
449451
image_flop()
450452
```
451453

452-
```{r upload-files-02, fig.cap = 'Specify files to upload by dragging them into the GitHub website (red circle) or by clicking on "choose your files." Uploaded files are also required to be committed along with an associated commit message.', fig.retina = 2, out.width="100%"}
454+
(ref:upload-files-02) Specify files to upload by dragging them into the GitHub website (red circle) or by clicking on "choose your files." Uploaded files are also required to be committed along with an associated commit message.
455+
456+
```{r upload-files-02, fig.cap = '(ref:upload-files-02)', fig.retina = 2, out.width="100%"}
453457
image_read("img/version_control/upload-files_02.png") %>%
454458
image_flop() %>%
455459
image_crop("3584x2200") %>%
@@ -485,7 +489,9 @@ copy that knows where it was obtained from so that it knows where send/receive
485489
new committed edits. In order to do this, first copy the URL from the HTTPS tab
486490
of the Code drop down menu on GitHub (Figure \@ref(fig:clone-02)).
487491

488-
```{r clone-02, fig.cap = 'The remote address (URL) corresponding to the location of the remote GitHub repository can be found in the green "Code" drop down menu.', fig.retina = 2, out.width="100%"}
492+
(ref:clone-02) The remote address (URL) corresponding to the location of the remote GitHub repository can be found in the green "Code" drop down menu.
493+
494+
```{r clone-02, fig.cap = '(ref:clone-02)', fig.retina = 2, out.width="100%"}
489495
image_read("img/version_control/clone_02.png") %>%
490496
image_crop("3584x1500")
491497
```
@@ -539,18 +545,22 @@ This is a temporary "checkpoint file" created by Jupyter when you work on `eda.i
539545
You generally do not want to add auto-generated files to Git repositories;
540546
only add the files you directly create and edit.
541547

542-
```{r git-add-02, fig.cap = 'The plus sign (+) is used to add the `eda.ipynb` file to the staging area.', fig.retina = 2, out.width="100%"}
548+
(ref:git-add-02) The plus sign (+) is used to add the `eda.ipynb` file to the staging area.
549+
550+
```{r git-add-02, fig.cap = '(ref:git-add-02)', fig.retina = 2, out.width="100%"}
543551
image_read("img/version_control/git_add_02.png")
544552
```
545553

546554
Clicking the plus sign (+) moves the file from the "Untracked" heading to the "Staged" heading,
547555
flagging this file so that Git knows we want a snapshot of its current state
548-
as a commit (Figure \@ref(fig:git-add-02)).
556+
as a commit (Figure \@ref(fig:git-add-03)).
549557
Now we are ready to "commit" the changes.
550558
Make sure to include a (clear and helpful!) message about what was changed
551559
so that your collaborators (and future you) know what happened in this commit.
552560

553-
```{r git-add-03, fig.cap = 'Once added, the `eda.ipynb` file is visible in the staging area, labeled as "Staged" in the Jupyter Git extension tool.', fig.retina = 2, out.width="100%"}
561+
(ref:git-add-03) Once added, the `eda.ipynb` file is visible in the staging area, labeled as "Staged" in the Jupyter Git extension tool.
562+
563+
```{r git-add-03, fig.cap = '(ref:git-add-03)', fig.retina = 2, out.width="100%"}
554564
image_read("img/version_control/git_add_03.png")
555565
```
556566

@@ -574,7 +584,7 @@ image_read("img/version_control/git_commit_01.png")
574584

575585
After "committing" the file(s), you will see there are 0 "Staged" files
576586
and we are now ready to push our changes
577-
to our remote repository on GitHub (Figure \@ref(fig:git-commit-01)).
587+
to our remote repository on GitHub (Figure \@ref(fig:git-commit-03)).
578588

579589
```{r git-commit-03, fig.cap = 'After recording a commit, the staging area should be empty.', fig.retina = 2, out.width="100%"}
580590
image_read("img/version_control/git_commit_03.png")
@@ -586,7 +596,9 @@ To send the committed changes back to the remote repository on
586596
GitHub, we need to *push* them. \index{git!push} To do this we click on the cloud icon with the up arrow on the Jupyter Git tab
587597
(Figure \@ref(fig:git-push-01)).
588598

589-
```{r git-push-01, fig.cap = 'The Jupyter Git extension "push" button (circled in red).', fig.retina = 2, out.width="100%"}
599+
(ref:git-push-01) The Jupyter Git extension "push" button (circled in red).
600+
601+
```{r git-push-01, fig.cap = '(ref:git-push-01)', fig.retina = 2, out.width="100%"}
590602
image_read("img/version_control/git_push_01.png")
591603
```
592604

@@ -624,22 +636,28 @@ person who created the GitHub \index{GitHub!collaborator access} repository has
624636
delete files (*write access*). To give your collaborators write access to the
625637
projects, navigate to the "Settings" tab (Figure \@ref(fig:add-collab-01)).
626638

627-
```{r add-collab-01, fig.cap = 'The "Settings" tab on the GitHub web interface.', fig.retina = 2, out.width="100%"}
639+
(ref:add-collab-01) The "Settings" tab on the GitHub web interface.
640+
641+
```{r add-collab-01, fig.cap = '(ref:add-collab-01)', fig.retina = 2, out.width="100%"}
628642
image_read("img/version_control/add_collab_01.png") %>%
629643
image_crop("3584x1250")
630644
```
631645

632646
Then click "Manage access" (Figure \@ref(fig:add-collab-02)).
633647

634-
```{r add-collab-02, fig.cap = 'The "Manage access" tab on the GitHub web interface.', fig.retina = 2, out.width="100%"}
648+
(ref:add-collab-02) The "Manage access" tab on the GitHub web interface.
649+
650+
```{r add-collab-02, fig.cap = '(ref:add-collab-02)', fig.retina = 2, out.width="100%"}
635651
image_read("img/version_control/add_collab_02.png") %>%
636652
image_crop("3584x1200")
637653
```
638654

639655
Click the green "Invite a collaborator" button
640656
(Figure \@ref(fig:add-collab-03)).
641657

642-
```{r add-collab-03, fig.cap = 'The "Invite a collaborator" button on the GitHub web interface.', fig.retina = 2, out.width="100%"}
658+
(ref:add-collab-03) The "Invite a collaborator" button on the GitHub web interface.
659+
660+
```{r add-collab-03, fig.cap = '(ref:add-collab-03)', fig.retina = 2, out.width="100%"}
643661
image_read("img/version_control/add_collab_03.png") %>%
644662
image_crop("3584x2200")
645663
```
@@ -692,7 +710,9 @@ image_read("img/version_control/git_pull_02.png")
692710
And then when you open (or refresh) the files whose changes you just pulled,
693711
you should be able to see them (Figure \@ref(fig:git-pull-03)).
694712

695-
```{r git-pull-03, fig.cap = 'Changes made by the collaborator to `eda.ipynb` (code highlighted by red arrows).', fig.retina = 2, out.width="100%"}
713+
(ref:git-pull-03) Changes made by the collaborator to `eda.ipynb` (code highlighted by red arrows).
714+
715+
```{r git-pull-03, fig.cap = '(ref:git-pull-03)', fig.retina = 2, out.width="100%"}
696716
image_read("img/version_control/git_pull_03.png")
697717
```
698718

@@ -795,14 +815,18 @@ thread. Replying to issues from email is also possible. Given all of these advan
795815
To open a GitHub issue,
796816
first click on the "Issues" tab (Figure \@ref(fig:issue-01)).
797817

798-
```{r issue-01, fig.cap = 'The "Issues" tab on the GitHub web interface.', fig.retina = 2, out.width="100%"}
818+
(ref:issue-01) The "Issues" tab on the GitHub web interface.
819+
820+
```{r issue-01, fig.cap = '(ref:issue-01)', fig.retina = 2, out.width="100%"}
799821
image_read("img/version_control/issue_01.png") %>%
800822
image_crop("3584x1250")
801823
```
802824

803825
Next click the "New issue" button (Figure \@ref(fig:issue-02)).
804826

805-
```{r issue-02, fig.cap = 'The "New issues" button on the GitHub web interface.', fig.retina = 2, out.width="100%"}
827+
(ref:issue-02) The "New issues" button on the GitHub web interface.
828+
829+
```{r issue-02, fig.cap = '(ref:issue-02)', fig.retina = 2, out.width="100%"}
806830
image_read("img/version_control/issue_02.png") %>%
807831
image_crop("3584x1250")
808832
```
@@ -828,7 +852,9 @@ When a conversation is resolved, you can click "Close issue".
828852
The closed issue can be later viewed by clicking the "Closed" header link
829853
in the "Issue" tab (Figure \@ref(fig:issue-06)).
830854

831-
```{r issue-06, fig.cap = 'The "Closed" issues tab on the GitHub web interface.', fig.retina = 2, out.width="100%"}
855+
(ref:issue-06) The "Closed" issues tab on the GitHub web interface.
856+
857+
```{r issue-06, fig.cap = '(ref:issue-06)', fig.retina = 2, out.width="100%"}
832858
image_read("img/version_control/issue_06.png") %>%
833859
image_crop("3584x1900")
834860
```

0 commit comments

Comments
 (0)