How to Deal with Formatting Issues in Rmarkdown



I’m having a real hard time trying to understand how Rmarkdown files interpret indented lists and how rchunks effect formatting within a PDF document. I do my HW using a LaTeX template and I answer a lot of my questions in the form of indented lists. For some reason R hates continuing an indented list after an R chunk. I’ve included two pictures below of what I’m talking about. Is there any extensive documentation about formatting with Markdown, LaTeX and Knitr?


I don’t know the answer to your question about documentation, but what happens in your example if you place another chunk (even an empty one) after list item (b)?


I would suggest enabling the keep_tex option for your output. That should let you see what knitr is producing and may give a hint to the problem.


This is interesting… It actually works. But that’s kind of a pain. haha


Good idea, I hadn’t thought of that.


I don’t think you’ll need a chunk after every item, just one at the end of the file. I don’t know why it works. I don’t use LaTex much, but I think the same thing happens when knitting to HTML. I usually have some kind of chunk at the very end of the notebook that writes out a file or something, and that seems to overcome whatever the issue is with elements not rendering as I expected.