1

I'm using tufte::tufte_handout in rmarkdown. I would like to preserve newlines in code blocks, but these seem to disappear. When I use usual pdf_document, the spaces are preserved. Is there any workaround, so that I can use tufte_handout but still have formatted code?

For example, when I compile this rmarkdown to pdf,

    ---
    title: "Test"
    output:
      #pdf_document
      tufte::tufte_handout:
        latex_engine: xelatex
    ---
    
    This is a test.
    
    ```{r}
    z <- expand.grid(
      x = seq(10),
      y = seq(10)
    )
    ```

the output puts entire expand.grid on a single line. If I compile using pdf_document instead, the newlines are preserved.

tufte_output

Krisrs1128
  • 311
  • 4
  • 8

0 Answers0