How to create a space (break) between output of code and next line when rendering to docx in quarto ?

I want to create a a space between output (of the first line of code in a chunk) and next, new line of code within the same chunk.
I found something here:
https://stackoverflow.com/questions/74575072/insert-pagebreak-for-output-after-code-chunk
but that solution is creating a break after code chunk so the output is on the next page.
How to adapt this to my needs, please or maybe a different solution exists ?
My apologies if that description is a bit complicated. Basically I want to create a space after the output of first line of code in a chunk and the next, new piece of code but within the same chunk in quarto in order not to rendered docx document looked like this:

My desired output:

Is it somehow doable ?

Pagination is hard. Doing it depends on the typesetting and engine and of course bumps by adding to or deleting the preceding output. So I’ll focus on the main easier problem about how to display an object.

It depends how on how an object dispatches to the print() function. Ideally you can render part one with heads() followed by a second check chunk on the same object with tail(). That works fine for a data frame, but maybe not so well for a regression model output. If there is no {broom} cleanser then you have do deconstruct and reassemble the object. Not fun.

The last possibility I have in mind is old fashion Linotype work arounds. Before 1991 when at the printer for prospectus work or proxy statements, usually overnight , grunt lawyers learned to be very cautious about doing anything to upset pagination because of the follow on dominos that breached the firewalls of extra space strategically scattered about. So, you cheat on margins and page breaks to make enough room.

The last resort is to use the LaTeX long table macro that displays continuations over one or more pages, like you planned for the tables to be just exactly there. Not for the faint hearted.

Thank you for responding and hints.
Is a Latex for pdf output only or can it be used for word docx output rendering/configuration as well ?

My second question would be how to remove that gray area in word that is connected to text when rendered from quarto to word ? Of course this is not ms office forum but that grey area is very difficult to remove preserving the formatting of the text in quarto rendered document. This is what is visible around text/code in my previous screenshots.

Rendering to LaTeX is, unfortunately almost a one way trip; to get into word you would have to OCR the pdf file.

It's been a long time since I've had to use Word and I've never tried to output Quarto or Rmarkdown and I'm unclear what is meant by the gray area. Ideally, the docx location has a defined style and the gray is just some errant manual formatting. There used to be a Word command to highlight a paragraph and apply the style, wiping out any manual styling, but I don't know how it is being done 15 years on from when I was using it.

Exactly that is it.

Thank you for your kind replies and help. I am very grateful.

This topic was automatically closed 42 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.