Skip to content

Commit

Permalink
document apa-twocolumn
Browse files Browse the repository at this point in the history
  • Loading branch information
wjschne committed Apr 25, 2024
1 parent ae91240 commit eee2e02
Show file tree
Hide file tree
Showing 16 changed files with 57 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .quartoignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ README.qmd
references.bib
resources.qmd
template.pdf
example_journal.pdf
example_manuscript.pdf
template_journal.pdf
template_manuscript.pdf
template.rmarkdown
Expand Down
Binary file added docs/example_journal.pdf
Binary file not shown.
Binary file added docs/example_manuscript.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ <h1 class="title">Introduction to apaquarto</h1>
<div id="fig-manuscript" class="quarto-figure quarto-figure-center quarto-float anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-manuscript-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<object data="template_manuscript.pdf" type="application/pdf" width="100%" height="800" '=""><p>Unable to display PDF file. <a href="template_manuscript.pdf">Download</a> instead.</p></object>
<object data="example_manuscript.pdf" type="application/pdf" width="100%" height="800" '=""><p>Unable to display PDF file. <a href="example_manuscript.pdf">Download</a> instead.</p></object>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-manuscript-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1: Example document in manuscript mode
Expand All @@ -199,7 +199,7 @@ <h1 class="title">Introduction to apaquarto</h1>
<div id="fig-journal" class="quarto-figure quarto-figure-center quarto-float anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-journal-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<object data="template_journal.pdf" type="application/pdf" width="100%" height="800" '=""><p>Unable to display PDF file. <a href="template_journal.pdf">Download</a> instead.</p></object>
<object data="example_journal.pdf" type="application/pdf" width="100%" height="800" '=""><p>Unable to display PDF file. <a href="example_journal.pdf">Download</a> instead.</p></object>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-journal-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;2: Example document in journal mode
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.html
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ <h4 class="anchored" data-anchor-id="an-existing-file">An existing file</h4>
});
</script>
</div> <!-- /content -->
<script>var lightboxQuarto = GLightbox({"loop":false,"selector":".lightbox","closeEffect":"zoom","descPosition":"bottom","openEffect":"zoom"});
<script>var lightboxQuarto = GLightbox({"selector":".lightbox","descPosition":"bottom","closeEffect":"zoom","openEffect":"zoom","loop":false});
window.onload = () => {
lightboxQuarto.on('slide_before_load', (data) => {
const { slideIndex, slideNode, slideConfig, player, trigger } = data;
Expand Down
7 changes: 7 additions & 0 deletions docs/search.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,13 @@
"section": "Tables Made Directly with Markdown",
"text": "Tables Made Directly with Markdown\nYou can create tables with Markdown in several ways. See here for details. If you need to make a more complex table in Markdown, I suggest using RStudio’s visual editor. Here is an example of a simple table:\n\n| Letters | Numbers |\n|:-------:|:-------:|\n| A | 1 |\n| B | 2 |\n| C | 3 |\n\n: My Caption {#tbl-mytable2 apa-note=\"Note below table\" data-quarto-disable-processing=\"true\"}\n\n\n\n\nTable \n\n\nMy Caption\n\n\n\n\n\n\nLetters\nNumbers\n\n\n\n\nA\n1\n\n\nB\n2\n\n\nC\n3\n\n\n\n\n\n\n\nNote. Note below table"
},
{
"objectID": "writing.html#tables-and-figures-in-journal-mode-.pdf",
"href": "writing.html#tables-and-figures-in-journal-mode-.pdf",
"title": "APA Style via Markdown",
"section": "Tables and Figures in Journal Mode (.pdf)",
"text": "Tables and Figures in Journal Mode (.pdf)\nWhen creating tables and figures in journal mode, care must be taken not to make figures and tables wider than the columns, otherwise sometimes makes them disappear (and sometimes takes large swaths of text with it).\nYou can make figures and tables span the two columns by setting the apa-twocolumn chunk option to true."
},
{
"objectID": "writing.html#parenthetical-citations",
"href": "writing.html#parenthetical-citations",
Expand Down
Binary file removed docs/template_journal.pdf
Binary file not shown.
Binary file removed docs/template_manuscript.pdf
Binary file not shown.
10 changes: 8 additions & 2 deletions docs/writing.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ <h2 id="toc-title">On this page</h2>
<li><a href="#tables-in-code-chunks" id="toc-tables-in-code-chunks" class="nav-link" data-scroll-target="#tables-in-code-chunks">Tables in Code Chunks</a>
<ul class="collapse">
<li><a href="#tables-made-directly-with-markdown" id="toc-tables-made-directly-with-markdown" class="nav-link" data-scroll-target="#tables-made-directly-with-markdown">Tables Made Directly with Markdown</a></li>
<li><a href="#tables-and-figures-in-journal-mode-.pdf" id="toc-tables-and-figures-in-journal-mode-.pdf" class="nav-link" data-scroll-target="#tables-and-figures-in-journal-mode-.pdf">Tables and Figures in Journal Mode (.pdf)</a></li>
</ul></li>
<li><a href="#citations" id="toc-citations" class="nav-link" data-scroll-target="#citations">Citations</a>
<ul class="collapse">
Expand Down Expand Up @@ -748,7 +749,7 @@ <h1>Tables in Code Chunks</h1>
</figcaption>
<div aria-describedby="tbl-mytable-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<div class="cell-output-display">
<div class="tabwid tabwid_left"><style>.cl-94c2c456{}.cl-94b99cdc{font-family:'Times New Roman';font-size:11pt;font-weight:normal;font-style:normal;text-decoration:none;color:rgba(0, 0, 0, 1.00);background-color:transparent;}.cl-94bd1a56{margin:0;text-align:center;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);padding-bottom:5pt;padding-top:5pt;padding-left:5pt;padding-right:5pt;line-height: 2;background-color:transparent;}.cl-94bd331a{width:0.75in;background-color:transparent;vertical-align: middle;border-bottom: 0.75pt solid rgba(0, 0, 0, 1.00);border-top: 0.75pt solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-94bd3324{width:0.75in;background-color:transparent;vertical-align: middle;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-94bd3325{width:0.75in;background-color:transparent;vertical-align: middle;border-bottom: 0.75pt solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}</style><table data-quarto-disable-processing="true" class="cl-94c2c456"><thead><tr style="overflow-wrap:break-word;"><th class="cl-94bd331a"><p class="cl-94bd1a56"><span class="cl-94b99cdc">Letters</span></p></th><th class="cl-94bd331a"><p class="cl-94bd1a56"><span class="cl-94b99cdc">Numbers</span></p></th></tr></thead><tbody><tr style="overflow-wrap:break-word;"><td class="cl-94bd3324"><p class="cl-94bd1a56"><span class="cl-94b99cdc">A</span></p></td><td class="cl-94bd3324"><p class="cl-94bd1a56"><span class="cl-94b99cdc">1</span></p></td></tr><tr style="overflow-wrap:break-word;"><td class="cl-94bd3324"><p class="cl-94bd1a56"><span class="cl-94b99cdc">B</span></p></td><td class="cl-94bd3324"><p class="cl-94bd1a56"><span class="cl-94b99cdc">2</span></p></td></tr><tr style="overflow-wrap:break-word;"><td class="cl-94bd3325"><p class="cl-94bd1a56"><span class="cl-94b99cdc">C</span></p></td><td class="cl-94bd3325"><p class="cl-94bd1a56"><span class="cl-94b99cdc">3</span></p></td></tr></tbody></table></div>
<div class="tabwid tabwid_left"><style>.cl-655fc504{}.cl-6556fe38{font-family:'Times New Roman';font-size:11pt;font-weight:normal;font-style:normal;text-decoration:none;color:rgba(0, 0, 0, 1.00);background-color:transparent;}.cl-655a8d3c{margin:0;text-align:center;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);padding-bottom:5pt;padding-top:5pt;padding-left:5pt;padding-right:5pt;line-height: 2;background-color:transparent;}.cl-655aa614{width:0.75in;background-color:transparent;vertical-align: middle;border-bottom: 0.75pt solid rgba(0, 0, 0, 1.00);border-top: 0.75pt solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-655aa61e{width:0.75in;background-color:transparent;vertical-align: middle;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-655aa61f{width:0.75in;background-color:transparent;vertical-align: middle;border-bottom: 0.75pt solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}</style><table data-quarto-disable-processing="true" class="cl-655fc504"><thead><tr style="overflow-wrap:break-word;"><th class="cl-655aa614"><p class="cl-655a8d3c"><span class="cl-6556fe38">Letters</span></p></th><th class="cl-655aa614"><p class="cl-655a8d3c"><span class="cl-6556fe38">Numbers</span></p></th></tr></thead><tbody><tr style="overflow-wrap:break-word;"><td class="cl-655aa61e"><p class="cl-655a8d3c"><span class="cl-6556fe38">A</span></p></td><td class="cl-655aa61e"><p class="cl-655a8d3c"><span class="cl-6556fe38">1</span></p></td></tr><tr style="overflow-wrap:break-word;"><td class="cl-655aa61e"><p class="cl-655a8d3c"><span class="cl-6556fe38">B</span></p></td><td class="cl-655aa61e"><p class="cl-655a8d3c"><span class="cl-6556fe38">2</span></p></td></tr><tr style="overflow-wrap:break-word;"><td class="cl-655aa61f"><p class="cl-655a8d3c"><span class="cl-6556fe38">C</span></p></td><td class="cl-655aa61f"><p class="cl-655a8d3c"><span class="cl-6556fe38">3</span></p></td></tr></tbody></table></div>
</div>
</div>
</figure>
Expand Down Expand Up @@ -808,6 +809,11 @@ <h2 data-anchor-id="tables-made-directly-with-markdown">Tables Made Directly wit
<p><em>Note</em>. Note below table</p>
</div>
</section>
<section id="tables-and-figures-in-journal-mode-.pdf" class="level2">
<h2 data-anchor-id="tables-and-figures-in-journal-mode-.pdf">Tables and Figures in Journal Mode (.pdf)</h2>
<p>When creating tables and figures in journal mode, care must be taken not to make figures and tables wider than the columns, otherwise sometimes makes them disappear (and sometimes takes large swaths of text with it).</p>
<p>You can make figures and tables span the two columns by setting the <code>apa-twocolumn</code> chunk option to <code>true</code>.</p>
</section>
</section>
<section id="citations" class="level1">
<h1>Citations</h1>
Expand Down Expand Up @@ -1351,7 +1357,7 @@ <h1>Appendices</h1>
});
</script>
</div> <!-- /content -->
<script>var lightboxQuarto = GLightbox({"descPosition":"bottom","closeEffect":"zoom","selector":".lightbox","openEffect":"zoom","loop":false});
<script>var lightboxQuarto = GLightbox({"descPosition":"bottom","loop":false,"selector":".lightbox","openEffect":"zoom","closeEffect":"zoom"});
window.onload = () => {
lightboxQuarto.on('slide_before_load', (data) => {
const { slideIndex, slideNode, slideConfig, player, trigger } = data;
Expand Down
31 changes: 28 additions & 3 deletions example.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ One way to import an existing graphic as a figure is to use `knitr::include_grap



```{r fig-import1}
```{r}
#| label: fig-import1
#| fig-cap: An Imported Graphic
#| apa-note: A note below the figure
#| fig-width: 3
Expand All @@ -177,12 +178,12 @@ Figure graphics can be imported directly with Markdown:

Which style of creating figures you choose depends on preference and need.


## Displaying Tables

We can make a table the same way as a figure. Generating a table that conforms to APA format in all document formats can be tricky. When the table is simple, the `kable` function from knitr works well. Feel free to experiment with different methods, but I have found that David Gohel's [flextable](https://davidgohel.github.io/flextable/) to be the best option when I need something more complex.

```{r tbl-mytable}
```{r}
#| label: tbl-mytable
#| tbl-cap: The Table Caption
#| apa-note: The note below the table.
#| ft.align: left
Expand All @@ -209,6 +210,30 @@ Table Caption of a Markdown Table

What if you want the tables and figures to be at the end of the document? In the .pdf format, you can set the `floatsintext` option to false. For .html and .docx documents, there is not yet an automatic way to put tables and figures at the end. You can, of course, just put them all at the end, in order. The reference labels will work no matter where they are in the text.

## Tables and Figures Spanning Two Columns in Journal Mode

When creating tables and figures in journal mode, care must be taken not to make figures and tables wider than the columns, otherwise \LaTeX sometimes makes them disappear.

As demonstrated in @fig-twocolumn, you can make figures tables span the two columns by setting the `apa-twocolumn` chunk option to `true`.

```{r}
#| label: fig-twocolumn
#| fig-cap: A Figure Spanning Two Columns When in Journal Mode
#| apa-note: Figures in two-column mode are only different for jou mode in .pdf documents
#| apa-twocolumn: true
#| fig-height: 3
#| fig-width: 6.4
#| fig-align: center
ggplot(data.frame(x = c(-4, 4)), aes(x)) +
stat_function(fun = dnorm,
geom = "area",
n = 1000,
color = NA,
fill = "#41448780") +
theme_void()
```


## Citations

See [here](https://quarto.org/docs/authoring/footnotes-and-citations.html) for instructions on setting up citations and references.
Expand Down
Binary file added example_journal.pdf
Binary file not shown.
Binary file added example_manuscript.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ I wrote [apaquarto](https://github.com/wjschne/apaquarto) so that I would never

::: {#fig-manuscript fig-cap="Example document in manuscript mode"}
```{=html}
<object data="template_manuscript.pdf" type="application/pdf" width=100% height=800 '><p>Unable to display PDF file. <a href="template_manuscript.pdf">Download</a> instead.</p></object>
<object data="example_manuscript.pdf" type="application/pdf" width=100% height=800 '><p>Unable to display PDF file. <a href="example_manuscript.pdf">Download</a> instead.</p></object>
```
:::

::: {#fig-journal fig-cap="Example document in journal mode"}
```{=html}
<object data="template_journal.pdf" type="application/pdf" width=100% height=800 '><p>Unable to display PDF file. <a href="template_journal.pdf">Download</a> instead.</p></object>
<object data="example_journal.pdf" type="application/pdf" width=100% height=800 '><p>Unable to display PDF file. <a href="example_journal.pdf">Download</a> instead.</p></object>
```
:::

Expand Down
Binary file removed template_journal.pdf
Binary file not shown.
Binary file removed template_manuscript.pdf
Binary file not shown.
7 changes: 7 additions & 0 deletions writing.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,13 @@ You can create tables with Markdown in several ways. See [here](https://quarto.o

: My Caption {#tbl-mytable2 apa-note="Note below table"}


## Tables and Figures in Journal Mode (.pdf)

When creating tables and figures in journal mode, care must be taken not to make figures and tables wider than the columns, otherwise \LaTeX sometimes makes them disappear (and sometimes takes large swaths of text with it).

You can make figures and tables span the two columns by setting the `apa-twocolumn` chunk option to `true`.

# Citations

See [here](https://quarto.org/docs/authoring/footnotes-and-citations.html) for instructions on setting up citations and references.
Expand Down

0 comments on commit eee2e02

Please sign in to comment.