rstudio / rticles

LaTeX Journal Article Templates for R Markdown
https://pkgs.rstudio.com/rticles/
1.47k stars 518 forks source link

arxiv template - Undefined control sequence includegraphics #332

Closed fouodo closed 3 years ago

fouodo commented 3 years ago

Hello,

I am trying to use the arxiv template and face to the following issue:

Undefined control sequence. l.136 \includegraphics

Could you please look at this issue?

A minimal example:

title: A template for the arxiv style authors:

Introduction

\lipsum[2] \lipsum[3]

plot(1:10)

Headings: first level

\label{sec:headings}

\lipsum[4] See Section \ref{sec:headings}.

Headings: second level

\lipsum[5]

\begin{equation} \xi {ij}(t)=P(x{t}=i,x{t+1}=j|y,v,w;\theta)= {\frac {\alpha {i}(t)a^{wt}{ij}\beta {j}(t+1)b^{v{t+1}}{j}(y{t+1})}{\sum {i=1}^{N} \sum {j=1}^{N} \alpha _{i}(t)a^{wt}{ij}\beta {j}(t+1)b^{v{t+1}}{j}(y{t+1})}} \end{equation}

Headings: third level

\lipsum[6]

\paragraph{Paragraph} \lipsum[7]

Examples of citations, figures, tables, references

\label{sec:others}

\lipsum[8] some text [@kour2014real; @kour2014fast] and see @hadash2018estimate.

The documentation for \verb+natbib+ may be found at \begin{center} \url{http://mirrors.ctan.org/macros/latex/contrib/natbib/natnotes.pdf} \end{center} Of note is the command \verb+\citet+, which produces citations appropriate for use in inline text. For example,

\begin{verbatim} \citet{hasselmo} investigated\dots \end{verbatim}

produces

\begin{quote} Hasselmo, et al.\ (1995) investigated\dots \end{quote}

\begin{center} \url{https://www.ctan.org/pkg/booktabs} \end{center}

Figures

\lipsum[10] See Figure \ref{fig:fig1}. Here is how you add footnotes. [^Sample of the first footnote.]

\lipsum[11]

\begin{figure} \centering \fbox{\rule[-.5cm]{4cm}{4cm} \rule[-.5cm]{4cm}{0cm}} \caption{Sample figure caption.} \label{fig:fig1} \end{figure}

Tables

\lipsum[12]

See awesome Table~\ref{tab:table}.

\begin{table} \caption{Sample table title} \centering \begin{tabular}{lll} \toprule \multicolumn{2}{c}{Part} \ \cmidrule(r){1-2} Name & Description & Size ($\mu$m) \ \midrule Dendrite & Input terminal & $\sim$100 \ Axon & Output terminal & $\sim$10 \ Soma & Cell body & up to $10^6$ \ \bottomrule \end{tabular} \label{tab:table} \end{table}

Lists

Regards, Cesaire Fouodo

cderv commented 3 years ago

Hi, can you please follow the issue guide (the one you deleted) to format your code correctly ?

https://yihui.org/issue/#please-format-your-issue-correctly

Thank you

fouodo commented 3 years ago

Hi,

so, the issue just consists in inserting the following code

plot(1:10)

into a default arxiv .rmd file and the compilation will run the an error. I realized that the preamble of the concerned template doesn't contains \usepackage{graphics}. Adding that into my local template solves the problem.

Regards Cesaire

drmowinckels commented 3 years ago

Hi!

I'm having the same issue with the rticle template. Adding any simple plot elicits the include graphics error. It also errors on echo = TRUE with the well-known shading error.

Shading error

---
title: A template for the *arxiv* style
authors:
  - name: David S. Hippocampus
abstract: |
  Enter the text of your abstract here.
bibliography: references.bib
output: rticles::arxiv_article
---

# header

some text blabla

```{r}
plot(1:10)

```sh
/Applications/RStudio.app/Contents/MacOS/pandoc/pandoc +RTS -K512m -RTS test.utf8.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output test.tex --lua-filter /Library/Frameworks/R.framework/Versions/4.0/Resources/library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /Library/Frameworks/R.framework/Versions/4.0/Resources/library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --template /Library/Frameworks/R.framework/Versions/4.0/Resources/library/rticles/rmarkdown/templates/arxiv/resources/template.tex --highlight-style tango --pdf-engine pdflatex --filter /Applications/RStudio.app/Contents/MacOS/pandoc/pandoc-citeproc 
output file: test.knit.md

! LaTeX Error: Environment Shaded undefined.

Error: LaTeX failed to compile test.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See test.log for more info.
Execution halted

Graphics error

---
title: A template for the *arxiv* style
authors:
  - name: David S. Hippocampus
abstract: |
  Enter the text of your abstract here.
bibliography: references.bib
output: rticles::arxiv_article
graphics: yes
---

# header

some text blabla

```{r, echo = FALSE}
plot(1:10)

/Applications/RStudio.app/Contents/MacOS/pandoc/pandoc +RTS -K512m -RTS test.utf8.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output test.tex --lua-filter /Library/Frameworks/R.framework/Versions/4.0/Resources/library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /Library/Frameworks/R.framework/Versions/4.0/Resources/library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --template /Library/Frameworks/R.framework/Versions/4.0/Resources/library/rticles/rmarkdown/templates/arxiv/resources/template.tex --highlight-style tango --pdf-engine pdflatex --filter /Applications/RStudio.app/Contents/MacOS/pandoc/pandoc-citeproc output file: test.knit.md

! Undefined control sequence. l.42 \includegraphics {test_files/figure-latex/unnamed-chunk-1-1.pdf}

Error: LaTeX failed to compile test.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See test.log for more info. Execution halted


## Session info

sessionInfo() R version 4.0.2 (2020-06-22) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Catalina 10.15.7

Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages: [1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached): [1] compiler_4.0.2 backports_1.1.9 here_0.1 rprojroot_1.3-2 htmltools_0.5.0 tools_4.0.2 rticles_0.16 yaml_2.2.1
[9] rmarkdown_2.5 knitr_1.30 xfun_0.16 digest_0.6.25 rlang_0.4.7 evaluate_0.14

fouodo commented 3 years ago

Hi,

I think the corresponding template seems to be incomplete. I just update it in local, by adding the required packages. For this issue, I have added \usepackage{graphicx} in the preamble. It is located in your R library (.Library).

Regards Cesaire

cderv commented 3 years ago

Fixed by #341 and included in the dev version. Thank you @Athanasiamo !

github-actions[bot] commented 3 years ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.