2
votes

(I'm not sure if this question is better suited to the LaTeX forum. I have posted it here because I suspect the problem is more about knitr and RMarkdown than LaTeX.)

I have the following RMarkdown document in RStudio:

 ---
 title: 'Capricious Behavior In Markdown: A Case Study'
 header-includes:
 - \usepackage{natbib}
 - \setcitestyle{square,numbers,super}
 output:
  word_document: default
  pdf_document:
    citation_package: natbib
  html_document: default
bibliography: refs.bib
---
Here's an equation with a citation\citep{aune}:

\begin{align}
5 &= 5
\end{align}

which produces the desired result when knitted as PDF:

enter image description here

but mysteriously loses both the equation and the reference when knitted as Word:

enter image description here

How do I produce a Word document that looks like the PDF?

1
This post discusses tweaking word output to different styles. May be worth checking out: stackoverflow.com/questions/37671868/…Z.Lin

1 Answers

0
votes

According to rdabbler I accomplished equations in Word using this code:

$$
\begin{array}{c}
5 = 5 
\end{array}
$$

Unfortunately equation numbering has beaten me, perhaps you can live with this issue.

As I rather used the pandoc native citation references they are even working with Word, but the style seems to be different to yours with the superscript numbers.