Accents for characters from R Markdown to Microsoft Word - r

I'm trying to produce a word document with R markdown. Usually i'm creating pdf-files with no problems. I use Latex syntax to create accents for characters for normal text like:
$\'{e}\'{e}$n
And then it produces "één" correctly when i knit my pdf. But this doesn't seem to work when i knit a word document, it will just show "$\'{e}\'{e}$n". So no good. Does anyone know how to solve this problem? Thanks!

Related

Converting .Docx with images to Rmarkdown not working well

I have a word document with notes from a class. In this document there are images (screenshots from the lecture). I am hoping to make a book, hopefully in bookdown, to help me organize my notes and my R code. I used pandoc to convert the word document and extracted the images, but only some of the images are showing up when i knit the markdown output in RStudio. Any idea why some would show and some wouldnt? COuld it be because i'm changing the .md that pandoc gives to .rmd and they just dont play well together?

Word to R Markdown Conversion

I have received a file stored in Microsoft Word that includes formatted words (italics, bold). I would like to do some work with the file (extracting sections, inserting words, etc.) and was planning to do this work with R Markdown. I need to keep the formatting (italics, bold) from Word during this conversion. I know I can convert from Markdown to Word, but is the reverse conversion from Word to Markdown also possible? If not, does anyone have any suggestions of how to bring Word into Markdown (relatively) painlessly while maintaining the italics and bold formatting?
From the pandoc manual under "Demos": pandoc -s example30.docx -t markdown -o example35.md
For rmarkdown, please see this answer, Convert docx to Rmarkdown
You could use first pandoc, then RStudio.
In pandoc, pandoc -o output.md originFile.docx. In which, your
output is a markdown from a Word.
Open your RStudio, you can choose your type file at the bottom of the console, whether you select "markdown" or "Rmarkdown". You will be able to change your markdown file.
Also there is Writeage, from convert markdown to word. This is a pulgin in Word

Latex commands suddenly appearing in rmarkdown pdf

Facing a very weird problem when knitting my rmarkdown document to a pdf...
Everything comes out nicely but halfway through the document, rmarkdown seems to not recognise the latex commands and decides to print them out directly in the pdf, leading to my pdf having latex commands like:
\begin{figure}[H]
and this affect the rest of the document.
I am not sure if its because of some encoding issues -- how does one check this and is there a solution to this?
Have been struggling with this for hours!
Would appreciate any advice, thanks!
Found the problem finally! Its % sign in my figure caption!
Hope this might help anyone who is having trouble with latex.

Enabling R Markdown syntax highlighting in TextWrangler/BBEdit

I would like to enable syntax highlighting for R Markdown (.Rmd) highlighting in TextWrangler. I managed to get syntax highlighting for .R files using this R.plist file (direct link to file). R Markdown has similar highlighting, so I have that file as a starting point, as I cannot find a similar .plist file for .Rmd files.
The issue I am having is that in RMarkdown, the code is between a set of ``` (three backticks) and the text (which is what I'd like to demarcate as comments) are the remainder of the file.
I would like to tell TextWrangler to only highlight what it sees between a set of ``` - currently, it highlights the entire file (including my text sections).
I thought editing the values for keys
<key>Open Block Comments</key>
<string></string>
<key>Close Block Comments</key>
<string>```</string>
would be a workaround, but it doesn't seem to help.
Edit, here is the Rmd syntax:
here is some text that is whatever I want.
```
in here between the backticks is some code
```
here is some more exposition
The code I'd like to highlight with R syntax is between backticks, whereas the text I'd like to display as a comment/without highlighting (whichever is easiest) is not demarcated.

knitr html to Word docx using pandoc

I have been saving some example R markdown html output to Word using pandoc. I actually only do this so I can add some page breaks for easier printing:
system("pandoc -s Exercise1.html -o Exercise1.docx")
Although the output is acceptable I was wondering if there is a way to keep the original syntax highlighting of the R chunks (just as they are in the original knit HTML document)?
Also, I seem to be loosing all images in the conversion process and have to stick them into Word by hand. Is that normal?
Using the rmarkdown package (baked into RStudio Version 0.98.682, the current preview release) it's very simple to convert Rmd to docx, and code highlighting is included in the docx file.
You just need to include this at the top of your markdown text:
---
title: "Untitled" # obviously you can change this
output: word_document # specifies docx output
---
However, it seems that page breaks are still not supported in this conversion.
Why not convert the markdown directly to Word format?
Anyway, Pandoc does not support syntax highlighting in Word: "Currently, the only output formats that uses this information are HTML and LaTeX."
About the images: the Word file would definitely include those if you'd convert the markdown to Word directly. I am not sure about the HTML source, but I suppose you might have a path issue.

Resources