Wrap output of sessioninfo::session_info() or sessionInfo() in rmarkdown pdf

I'd like to report my session information at the end of an rmarkdown PDF. However, the output goes off the page. How can I wrap this text?

I see the recommendation here to use the listings package, but this destroys the code formatting.

There must be an easy way to have the sessionInfo() output fit on a basic rmarkdown pdf output and preserve the nice formatting that's already built in....right?

Use the similarly named sessionInfo() (capital I)

Both functions return text that goes off the page.

Mine wraps on macOS. Some lines are so long that they couldn’t be shrunk and remain legible. I can help look further if you’re on Ubuntu. I’m not set up for Win

I'm on a mac as well...your code output wraps? Do you have to use a specific setting for that?

I've realized that a somewhat unsatisfying solution is to wrap sessionInfo() in toLatex() with the chunk setting results = 'asis'. This does not work though for the slightly better sessioninfo::session_info().



This would be a good feature request for the package sessioninfo as toLatex works on sessionInfo() because there is a method for that in utils package

Do you want to open one about adding a toLatex.session_info method in their package ?

Sure and done. thanks for the prompt.