Quarto, scrbook output (PDF): how to set the width of console output?

Dear Community

I’m wondering how to set the width of console output in a scrbook compiled to PDF using Quarto. Here’s how this looks like:

I was able to get code in code chunks to wrap using the LaTeX package fvextra but no luck with console output. I’ve tried using the listings package as explained here by adding it to my _quarto.yml:

pdf:
    documentclass: scrbook
    classoption: [paper=6in:9in,pagesize=pdftex,headinclude=on,footinclude=on,12pt]
    pandoc_args: --listings
    include-in-header:
      text: |
        \usepackage{fvextra}
        \usepackage{listings}
        \DefineVerbatimEnvironment{Highlighting}{Verbatim}{breaklines,commandchars=\\\{\}}
        \areaset[0.50in]{4.5in}{8in}
        \lstset{
          breaklines=true
          }
    fig-pos: 'H'

but this doesn’t work (see the lines pandoc_args: --listings and \usepackage{listings}; with only pandoc_args I get an error, and then lstset{breaklines=true}).

I’ve tried looking online and tried some other things liking setting R.options = list("width"=60) in a chunk header, but no luck.

So what would be the way to achieve this? Many thanks.

Mickaël Canouil linked me this Github issue on Mastodon that gives the solution
Code folding in PDF output? · quarto-dev/quarto-cli · Discussion #4121 · GitHub

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.