![]() ![]() ![]() At first I used a shell script wrapper to automatically get my preferred options, then I developed a package for the Atom editor ( Pandoc/PDF), which is based on defaults files. I wanted to share thoughts thanks for your reply, and: fair questions! I'll also try to play more with the default file as you are trying to do. Maybe we are missing some things though as it predates default file and so could be different.Īnyway, I am trying to see if you seek a thinner wrapper function to call Pandoc from R that would respect all Pandoc feature 100% or if there are some expected adjustments in rmarkdown that are wished, different than a "default" mode that would be "Just call pandoc as-is", skipping all internally set args. IMO this plays the same role as default file but accept rmarkdown's format definition. There is even a output_yaml argument in rmarkdown::render() to set a specific global file if needed. For example, for beamer presentation, you could define some default option for rmarkdown::beamer_presentation() in a _output.yml that would be use when you want to convert to a beamer presentation. The latter was even there I think before Pandoc introduced default file. Are you using Rmd as source but only knitr to convert to md file and then Pandoc directly to convert to an output format ?įrom my perspective, rmarkdown has already a similar thing than default file with the YAML header, or even YAML _output.yml.Are you using a rmarkdown output format ? You are mentioning beamer but are you using beamer_presentation() ?.So that I understand better the initial reason of this, can I ask what you expect from rmarkdown exactly ? Hope this context helps you understand the way things currently works. Even a low level function in rmarkdown which is pandoc_convert() will currently make such assumption. That is also why, part of the code in rmarkdown will assume that converting to (i.e -to pdf) means -to latex as Pandoc will only be used to convert. With rmarkdown, it would require parsing this to set the correct option to pass to tinytex::latexmk(). When you specify pdf-engine and pdf-engine-opt in a default file, you are telling Pandoc what to do. For example Rmd to PDF will use Pandoc to convert to LaTeX and tinytex R package to convert to PDF. So I am not surprised that you feel a default file parsing is needed to build a default_output() format based on a default file.Īlso, as another piece of context, some of the step in the process are different. What I mean is that calling pandoc directly and calling rmarkdown::render() is not equivalent. Pandoc knows what to do when reading a default file, but rmarkdown would still need to read the default file so that it can translate the content to how it works internally when calling Pandoc. This means for example that some of the option used by R Markdown are not supported / known by Pandoc, and the otherway around. Rmarkdown is built on Pandoc feature but is not a thin wrapper on Pandoc. I believe that this might also be useful for other users, because they wouldn't have to create an R package with a custom function, but they would simply write a defaults file. I'd rather have a simple-to-use output format in R Markdown, the complete behavior of which is defined by the YAML defaults file. However, that would mean to duplicate the effort I have already put in my defaults files, and every time I change something in my defaults files I would have to do the corresponding changes in the R code. I am aware that I could probably achieve the equivalent of my defaults files by inheriting from an existing output format and overriding the right options. The -defaults command line argument is at the end, which makes Pandoc ignore it for the most part.Īs a question: What do I have to do in order to get the exact necessary Pandoc command to use my defaults file?Īs a feature request: In case that proves impossible, I propose that it is made possible. I tried the argument to = "pdf" – then I get a pdf file, but also a -to latex command line option. The output file is specified with extension. Well, I guess I could extract that, too, and set it explicitly. I don't mind autolink_bare_uris and tex_math_single_backslash, but I do prefer to have hard_line_breaks. usr/bin/pandoc +RTS -K512m -RTS -to beamer -from markdown+autolink_bare_uris+tex_math_single_backslash -output test.tex -defaults=beamer_pdf.yamlĪ default value of from has been used, which conflicts with my setting in the defaults file. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |