I was wondering whether there is a way for me to completely use Markdown language for writing a scientific paper along with R. I gave up on using Latex with knitr a while ago, since most of the journals need .docx files for submission, and converting from Latex to docx with pandoc is not always easy, especially when you get long scientific papers and you end up wasting hours debugging pandoc for trivial errors that Latex (and pdflatex) can easily pass. Anyway, I would like to use the power of knitr with flexibility of pandoc, markdown seems to be a good common ground. The only problem seems to be the bibliography and different citation styles that journals require. My question is: does markdown provide a simple to use (similar to biblatex, natbib, etc) bibliography engine? If not, what do you recommend for me to have a seamless transition from analyzing my data to submitting my papers? I'm sick of converting Latex to docx.
I basically use this setup, i.e. markdown in emacs but the concept is editor-independent. You can use a latex-like way to cite your paper in markdown and then use pandoc and the *.csl files. Check out this post for more details.
Related
I am making a presentation in latex (Oxygen Beamer Template) in the online latex editor Overleaf, it is the original template that overleaf is available to modify it, the idea is to be able to implement it in Rmarkdown. So my question is if there is any package in R or trick to be able to capture the result of latex as a presentation in Rmarkdown?
Anyway when I have an advance or discover something I share it in this same way.
Thanks for your time, regards!
Is there any way to take a Bookdown project, and build it as Markdown instead of HTML or TeX?
I ask because I need to post-process the final Markdown output from Bookdown, in order to extract R and Python notebooks for download.
In more detail, I am using Bookdown to build a textbook that embeds notebooks to download, where the notebooks contain subsets of the code and text in the bookdown .Rmd files. For example, a single chapter could contain more than one notebook.
In order to do this, I put start and end comment markers in the RMarkdown input text to identify the section that will be a notebook, and then post-process the generated Markdown files to extract the notebook section. As in something like:
<!--- notebook: first_section.Rmd
-->
Some explanation, maybe using Bookdown extra markup such as #a_citation.
```{r}
a <- 1
a
```
<!--- end of notebook
-->
More markdown.
```{r}
# More code not in notebook.
b <- 2
```
Obviously I could use the input RMarkdown pages, but this would be ugly, because all the extended Bookdown markup such as citations, cross-references and so on, would appear in raw and ugly form in the generated notebook. So I'd really like to be able to get the final output Markdown, after merging, resolving of citations and cross references. Is there any way of doing that?
My question is similar to this as-yet unanswered question, but adds my motivation for an official solution to this problem.
With the latest version of bookdown on CRAN, you can use the output format bookdown::markdown_document2, e.g.,
output:
bookdown::markdown_document2:
base_format: rmarkdown::md_document
variant: gfm
I recently started to use r-markdown to prepare journal articles with the handy templates from rticles. However, we ended up with submitting in Word rather than LaTex. Collaborators prefer Word, and at the moment, not all journals accept LaTex but all journals accept Word. Is there a place to get a collection of r-markdown templates to generate journal articles for Word document like rticles for LaTex?
Most likely you already found the option of editing the YAML:
output:
word_document:
reference_docx: template.docx
However, from experience, the best is to export the PDF as a word document (without figures) and add them later on.
I think what you are stating is really true and certainly helding Rmarkdown adoption.
Cheers
Hopefully this is quick and easy question. Is there an equivalent in R Markdown, either as a latex imbed or a chunk option for a float barrier for images / R output, as in \FloatBarrier ?
Obviously, I could compile the doc in LaTeX, but I'm hoping to do it quickly and easily via markdown.
R Markdown allows embedding raw HTML or raw Tex. As is typical for Markdown, it does not appear to provide that level of control natively.
Custom CSS can also be specified for the output HTML.
I am not sure if this type of question complies with the SO rules for well-defined questions ;) ... anyway:
I want to convert several R Sweave files (.Rnw) to R markdown files (.Rmd). Jeromy Anglin has posted on this matter here but there is no code supplied. I tried to use pandoc, but of course pandoc cannot handle the chunk tags and inline code tags correctly.
Consclusion: I guess I will have do write some code to parse my .Rnw files to prepare them for pandoc conversion. Thus my questions:
Is there a better way to go?
Does someone by chance have code
available that will do the job?
TIA
As #Karl commented, LaTeX --> markdown is not a trivial conversion as there are far more options and environments available in LaTeX compared to markdown. You are probably best off working with something like pandoc (see Demo #5). Basically, instead of doing
.Rnw --> .Rmd --> .md
you would do
.Rnw --> .tex --> .md
with pandoc. If you really want to go from .Rnw --> .Rmd, you may want to check out the pander package to write a function to extract code chunks, convert the remaining LaTeX content to markdown, and then re-insert the code chunks into the markdown document.