Let's say I want another number directly below 6 but without it being counted as a new line (a line break). If my output was html_document, I could simply add <br> after 6. But since my output is pdf_document, that doesn't work. What is the equivalent for pdf_document?
Using RStudio IDE visual editor should help you write the correct markdown syntax from the visual edition of the table. Otherwise, you can use a R Package to create the table which should write the correct syntax for you
I want all my tables to be labeled and to be referencable. So I use this R code to name the table so it will show as "Table 1: Example Table" and I can reference it with @ref(tab:example) (If I'm using bookdown):
If I write tables that way, only pipe and multiline tables work, grid tables don't work. If I write the gridline tables in plain text, they will render properly. But if I do it the way I like to do it, in an R code block, it won't render properly. This is unfortunate because multiline tables are even more annoying to write than grid tables. I want to know how to write a grid table and also make it show "Table 1: Example Table" and make it possible to reference it.
You could use knitr::kable() to write the markdown for you from a table in R. It has a caption argument also. There are other R package for this too, that should also work with bookdown. See chapter in the cookbook linked above.
Also for writing markdown directly in R markdown, why do you need to cat() in a R chunk if the content is just markdown ? Can't you write just Markdown directly without the cat() ?
I am trying to understand the use case. From my current point of view, you encounter problem because of your specific workflow, but I may be missing something.
Also, did you try the visual editor to write Markdown table ?
I found an efficient way to make tables using kable and kableExtra. I can add line breaks too. I only have one issue with it, if I add a line break, the row color ends where the line break is. It's difficult to explain, so here is an image. As you can see, the color of the row should go to the very end, but it doesn't because of the line break. Do you know how I can fix this? Here is the code for this table: