I would like to convert a *.Rmd
to document to PDF without rstudio being available.
Current approach follows the following steps:
*.Rmd
document is passed to knitr
: knit(input = "report.Rmd"))
Obtained md is converted via pandoc:
# Convert pandoc --smart --to latex \\ --latex-engine pdflatex \\ -s report.md \\ -o report.PDF
This results in the following problems, the top section of the Rmarkdown document:
---
title: "Report Title"
author: "Person"
output: pdf_document
classoption: landscape
---
and shows as:
all text is centered, whereas I would like for it to be left-aligned:
I would like to make use of the rmarkdown::render
; however, despite setting RSTUDIO_PANDOC
(as discussed here ), the command fails on pandoc
not being available.
I don't care much whether the utilised mechanism makes use of the rmarkdown::render
, what I want to achieve is:
*.Rmd
file as possible without the need to add parameters to the pandoc
command. pandoc
command pass files and generate exports with no problems. It only doesn't work with the rmarkdown::render
package. *.Rmd
files, this is what I'm trying to understand as I see that that the first section of my *.Rmd
file is ignored. The current process looks as follows:
*.Rmd
(not much in it, just title section and dummy text and code that renders but wrongly justified) > *.R
file running one line knit(input = "report.Rmd"))
> *.sh
file running pandoc
command and generating PDF if all that is in place, it is indeed just a call to
rmarkdown::render(...)
The rmarkdown::render(...)
fails: Error: pandoc version 1.12.3 is required and was not found ...
However:
>> rmarkdown::pandoc_available()
[1] TRUE
and:
$ pandoc -v
pandoc 1.9.4.1 (...)
The RSTUDIO_PANDOC
points to pandoc.
A few things:
"the command fails on pandoc not being available." well you must have pandoc
installed in order to call it -- but you didn't say what OS you have. On Linux it is pretty trivial to install pandoc
from the package manager; otherwise jgm has binaries for you on the site; "should" be similar on OS X
for different styling you need to modify the LaTeX code which you can via numerous hooks to include macro files; see the RMarkdown cheat sheets for detail
if you want to exercise more control, you can supply your own template; I have done so in the tint package (which is also on CRAN)
rmarkdown::render(...)
Error: pandoc version 1.12.3 is required and was not found
I think the error says it plainly: you need pandoc 1.12.3 and you have pandoc 1.9.4.1
I do not know, however, why such a specific version is required.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.