bmacGTPM / rticles

LaTeX Journal Article Templates for R Markdown
0 stars 0 forks source link

Add examples for figures, labels, etc #6

Open bmacGTPM opened 5 years ago

bmacGTPM commented 5 years ago

The current skeleton.rmd has example text copied and pasted from dg_template.tex from the JQAS website. The text contains, for example, an sample of how to include a figure in the document using \begin{figure}.

However, it would be more useful to have a sample figure created in an R chunk, with caption, label, etc., and a sample reference to that figure somewhere in the text, since this is the more common way to include a figure in the document when using R Markdown. This could be especially helpful for those not experienced with rmarkdown/bookdown/etc.

Examples to add:

bmacGTPM commented 5 years ago

I will try to finish this today

bmacGTPM commented 5 years ago

I had a couple issues with this. The first is with tables. This works when knitting to pdf_documentbut not when knitting to degruyter_article

knitr::kable(head(mtcars), booktabs = TRUE, longtable=FALSE, 
caption = 'Some mtcars data')

It gives the error

! LaTeX Error: Environment longtable undefined.
Error: Failed to compile skeleton.tex. See skeleton.log for more info.
bmacGTPM commented 5 years ago

I also couldn't get equation references to work

\begin{equation} 
  1+1=2
  \label{eq:fancymath1}
\end{equation} 

I tried three things that I found in various documentation: \@ref(eq:fancymath1) \ref{eq:fancymath1}

That last one in bold actually gives a number, but doesn't put the parentheses around it. \eqref{eq:fancymath1} does though.

However, this is supposedly the preferred method, but I can't get it to work:

\begin{equation} 
  1+1=2
  (\#eq:fancymath2)
\end{equation} 

Stuff I tried:
\@ref(eq:fancymath2) \ref{eq:fancymath2}

bmacGTPM commented 5 years ago

bulleted lists lists like this

- Item 1
- Item 2
    - Subitem 1

gives the error

! Undefined control sequence.
l.224 \tightlist

We might need to create a command in the header like this \providecommand{\tightlist}{% \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}

bmacGTPM commented 5 years ago

bulleted lists lists like this

- Item 1
- Item 2
    - Subitem 1

gives the error

! Undefined control sequence.
l.224 \tightlist

We might need to create a command in the header like this \providecommand{\tightlist}{% \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}

I added this line to degruyter.sty, and the bulleted lists now work.