You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think every student who has been through college has had to write an essay with citations and referencing for all their sources for a mandatory prerequisite class, and I was no exception to this.
46
+
Many colleges give students a mandatory class where they learn how to cite and do referencing in essays.
47
47
48
-
Just as a fun little challenge, I wanted to write my essay using [Neovim](https://neovim.io), the same terminal text-editor I code on and write blogs for my website with, so I had to find a word processor that can compile documents from plaintext (unlike What-You-See-Is-What-You-Get (WYSIWYG) word processors, such as [LibreOffice](https://www.libreoffice.org)[Writer](https://www.libreoffice.org/discover/writer)). As you could tell from the title of this blog post, I chose to use [groff](https://www.gnu.org/software/groff)for that task.
48
+
For my essay, I wrote it using [Neovim](https://neovim.io), the same terminal text-editor I code on and write blogs for my website with, and that would not have been possible without a word processor that can compile documents from plaintext (unlike What-You-See-Is-What-You-Get (WYSIWYG) word processors, such as [LibreOffice](https://www.libreoffice.org)[Writer](https://www.libreoffice.org/discover/writer)). As you could tell from the title of this blog post, I used [groff](https://www.gnu.org/software/groff)to accomplish this.
49
49
50
-
You do not have to be writing in APA to find this guide helpful, as it goes through where many of the things that you will need to change are and explains how to change them. Just adapt some of the specific changes made in this guide to suit your needs.
50
+
Although some of the modifications detailed in this guide are specific to APA, you do not have to be writing in APA to find this guide helpful. Just adapt some of the specific changes made in this guide to suit your style guide.
51
51
52
52
This blog guide mainly just serves to compile all the relevant research I had done into a simple step-by-step solution I can easily follow when I want to use groff to write essays in APA again, but it also hopes to help others who were in the same spot I was save themselves some time and frustration that I had to go through when figuring things out by myself for the first time.
53
53
54
54
I made a [Github repository](https://github.com/de-soot/groff-apa) as a companion to this guide. It gives an example of the final generated output so you know exactly what you are going to get out of this. The source files included in the repository have some extra comments to help readability and can also be used as a template to quickly set things up to just get started writing.
55
55
56
-
A fun little fact about this blog post: this is actually my second time writing this blog post because I lost the first one after almost finishing it.
56
+
A fun fact about this blog post: this is actually my second time writing this whole thing because I frustratingly lost the first one in the dumbest way possible. I accidentally deleted the folder containing it because I forgot that I put it in the folder. Unfortunately, it was already gone by the time I realised due to the auto-emptying routine of my Trash folder scheduled to run once every hour.
57
57
58
58
# Introduction <aname=introduction></a>
59
59
@@ -110,7 +110,7 @@ Many lecturers demand assignments to be submitted in double-spaced Times New Rom
110
110
111
111
## Font Family <aname=fontfamily></a>
112
112
113
-
By default, groff already outputs text in your [device's default serif font family](https://www.gnu.org/software/groff/manual/groff.html.node/Using-Fonts.html) (typically Times New Roman), but sometimes (very rarely, in my experience) lecturers prefer sans-serif or even monospace in some strange cases.
113
+
By default, groff already outputs text in your [device's default serif font family](https://www.gnu.org/software/groff/manual/groff.html.node/Using-Fonts.html) (typically Times New Roman), but sometimes (very rarely, in my experience) lecturers prefer sans-serif or even monospace in some cases.
114
114
115
115
### Default Fonts <aname=defaultfonts></a>
116
116
@@ -142,14 +142,22 @@ Installing custom fonts for groff is a little bit trickier; I have not been able
142
142
143
143
## Font Size <aname=fontsize></a>
144
144
145
-
The default font size in groff is a little bit less than 12pt ([10pt](https://www.gnu.org/software/groff/manual/groff.html.node/Manipulating-Type-Size-and-Vertical-Spacing.html), to be exact), but it is very easy to change. Simply add this line to your plaintext document:
145
+
The default font size in groff is a little bit less than 12pt ([10pt](https://www.gnu.org/software/groff/manual/groff.html.node/Manipulating-Type-Size-and-Vertical-Spacing.html), to be exact), but it is very easy to change. Simply add this line to your plaintext document to change the font size to 12pt:
146
146
147
147
```
148
148
.nr PS 12
149
149
```
150
150
151
151
As for what `PS` stands for, it probably means something like "Point Size"; `.nr` stands for "Number Registers".
152
152
153
+
## Line Spacing <aname=linespacing></a>
154
+
155
+
All parts of an APA-styled paper [should be double-spaced](https://apastyle.apa.org/style-grammar-guidelines/paper-format/line-spacing). By default, groff uses [120% of font size](https://www.gnu.org/software/groff/manual/groff.html.node/Manipulating-Type-Size-and-Vertical-Spacing.html) as vertical spacing. Fortunately, changing this to double-spacing is just as simple as changing the font size: just set the vertical spacing (`.nr VS`) to double your font size (`.nr PS`).
156
+
157
+
```
158
+
.nr VS 24
159
+
```
160
+
153
161
## Font Style <aname=fontstyle></a>
154
162
155
163
Here is how to make your text **bold**,
@@ -176,17 +184,9 @@ And to set it back to normal:
176
184
.ft R \" Stands for Regular or Roman
177
185
```
178
186
179
-
## Line Spacing <aname=linespacing></a>
180
-
181
-
All parts of an APA-styled paper [should be double-spaced](https://apastyle.apa.org/style-grammar-guidelines/paper-format/line-spacing). By default, groff uses [120% of font size](https://www.gnu.org/software/groff/manual/groff.html.node/Manipulating-Type-Size-and-Vertical-Spacing.html) as vertical spacing. Fortunately, changing this to double-spacing is just as simple as changing the font size: just set the vertical spacing (`.nr VS`) to double your font size (`.nr PS`).
182
-
183
-
```
184
-
.nr VS 24
185
-
```
186
-
187
187
# In-text Citation <aname=intextcitation></a>
188
188
189
-
It is finally about time to start getting into the actual citations after all that setting-up.
189
+
Now that everything is set up, we can start to get into the citations.
190
190
191
191
refer uses numbered footnotes by default, but APA wants the author(s) and date included in their in-text citations. This section will cover how to do exactly as APA says.
192
192
@@ -295,7 +295,7 @@ Documentation for what each of the `ref*spec!N` mean can be found in the comment
295
295
296
296
The values for the letters after the `ref*spec!N` are specified in the bibliography file linked in the refer block (`ref.bib`).
297
297
298
-
Rearranging `D` (Date) into the correct order (right after `A` (Author(s)) and before `T` (Title)):
298
+
Rearranging `D` (date) into the correct order (right after `A` (author(s)) and before `T` (title)):
299
299
300
300
```
301
301
.ds ref*spec!0 Q A D T S V N P I C O
@@ -307,7 +307,7 @@ Rearranging `D` (Date) into the correct order (right after `A` (Author(s)) and b
307
307
308
308
## Punctuation <aname=punctuation></a>
309
309
310
-
Switching the order of the fields messes up the hard-coded punctuation order, but there are some other defaults that do not follow APA guidelines.
310
+
Switching the order of the fields messes up the hard-coded punctuation order, but there are also some defaults that do not follow APA guidelines.
311
311
312
312
Go to lines 59--73 of `refer-ms.tmac`, where you will find this:
313
313
@@ -383,16 +383,54 @@ This is how it looks like after some changes:
383
383
384
384
The list below details the changes:
385
385
386
-
- In the `.ds ref*spec!J` row, its `arg 1` is changed from a comma (`,`) to a period (`.`) to add a period after the Title field.
387
-
- In the `.ds ref*spec!T` row, `\\*Q` and `\\*U` are removed to remove the opening and closing double quotation marks, respectively, around the Title field.
386
+
- In the `.ds ref*spec!J` row, its `arg 1` is changed from a comma (`,`) to a period (`.`) to add a period after the title field.
387
+
- In the `.ds ref*spec!T` row, `\\*Q` and `\\*U` are removed to remove the opening and closing double quotation marks, respectively, around the title field.
388
388
- In both the `.ds ref*spec!T:0` and `.ds ref*spec!T:2` rows, `\fI` in `arg 3` and `\fP` in `arg 5` are removed to not italicise the text and because of redundancy (`\fP` resets font style back to normal), respectively.
389
-
- In the `.ds ref*spec!V` row, its `arg 1` is changed from empty (`""`) to a comma (`,`) to add a comma after the Journal/Periodical field; its `arg 3` is changed from bold-ing (`\fI`) to italicising (`\fB`) the text.
390
-
- All `\fP` in `arg 5` are moved to `arg 4` to make sure punctuations are not in bold or italics.
389
+
- In the `.ds ref*spec!V` row, its `arg 1` is changed from empty (`""`) to a comma (`,`) to add a comma after the journal/periodical field; its `arg 3` is changed from bold-ing (`\fI`) to italicising (`\fB`) the text.
390
+
- All `\fP` in `arg 5` are moved to `arg 4` to make sure the punctuations after each field are not in bold or italics.
By default, refer prepends "and" before the last author for more than 1 author. This is in contrast to the ampersand (&) that APA wants.
395
+
396
+
It should have been an easy fix to simply replace an "and" in one of the refer tmac files, but there is surprisingly no such thing to be found in any of the 2 files.
397
+
398
+
A solution to this is to simply manually type out the whole Authors field in the bibliography file:
399
+
400
+
```
401
+
%K key123
402
+
%A Author, A., Author, B. & Author, C.
403
+
%D 2025
404
+
%T Title
405
+
%J Journal
406
+
%V 123
407
+
%N 456
408
+
%P 999
409
+
%O https://doi.org/12.34
410
+
```
411
+
412
+
As opposed to how it would usually be:
413
+
414
+
```
415
+
%K key123
416
+
%A Author, A., Author, B. & Author, C.
417
+
%D 2025
418
+
%T Title
419
+
%J Journal
420
+
%V 123
421
+
%N 456
422
+
%P 999
423
+
%O https://doi.org/12.34
424
+
```
425
+
426
+
However, this solution conflicts with the format of in-text citations, as described in the subsection below.
427
+
394
428
#### Effect on Citations <aname=effectoncitations></a>
395
429
430
+
Due to having only one `%A` in the bibliography file, refer will think that there is only one author and the formatting for citations specified in the refer block will not work.
431
+
432
+
There is a solution for this. It is not pretty, but it works. Similarly to what you would do in the solution described in the Narrative Citations section, you would have to have 2 separate bibliography files: one that generates the correct citations (normal file with multiple `%A` for multiple authors) and one that generates the correct author field in the reference entry (modified file with only one `%A` for multiple authors). After compiling both versions of the document by changing the argument of `bibliography` in the refer block to switch between both of the bibliography files, use a PDF-editing tool to extract and combine the correct citations and references into one final file.
433
+
396
434
### Period Suppression <aname=periodsuppression></a>
397
435
398
436
By default, refer appends a period at the end of each entry. This means that a period is added after the last field that contains a DOI or URL, which APA has [explicitly stated to not do](https://apastyle.apa.org/instructional-aids/reference-guide.pdf).
0 commit comments