inserting figures in rticles IEEE Transaction Template

Does anyone have a good working example of adding a figure in rticles IEEE Transactions Template?

If I insert a code chunk like this in one of the subsections as described in R Markdown Definitive guide (13.4 LaTeX content | R Markdown: The Definitive Guide)

I get this error
! Undefined control sequence.
\includegraphics

A quick websearch shows that I need to have a statement
\usepackage[pdftex]{graphicx}

Where does this statement go?

The example code for figure placement does not seem to work either. How can I make this work?

I figured this out. To anyone else who agonized over this for hours, here's the answer.
Add the statement \usepackage{graphix} in the Tex document in your project folder. This should appear in the preamble. That does the trick.

The code chunk for figure can be as simple as

```{r fig_2, out.width="2.5in", echo=FALSE, warning=FALSE}
plot(cars)
1 Like

This is an issue in the rticles package. This package should be loaded in the template.

I have added it in the current dev version of rticles. You can update or wait for next CRAN release.

Thanks a lot for the report !

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.