I am writing a report that outputs to html with R markdown. In this report I'm adding excel tables and one of them has a column with a list.
Here is the example
---
title: "Readme report"
author: "MM"
date: "`r Sys.Date()`"
output:
html_document:
toc: true
toc_float: true
number_sections: true
---
library(dplyr)
library(kableExtra)
df <- structure(list(id = c(1, 2, 3), justification = c(
"1. I want it too look like this \r\n 2. having numbers for each row \r\n 3. and well it still looks nice",
"1. here is where strangeness happens\r\n 2. what happens here \r\n 3. and here",
"1. but then I do this again and number one looks okay \r\n 2. but this looks like an outdented bullet \r\n - i put this indented bullet \r\n 3. and somehow end up like this when i get back to numbered"
)), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA,
-3L))
kable(df, format = "html")%>%
kable_styling(latex_options="scale_down")
The problem that I was having is that this part of the table there is great inconsistency in the output, the first row it looks fine, but everything breaks afterwards. the first line always turns out fine, but the second and third break looks like an outdented bullet. My question is how to make the format of this column uniform. I have read the tables section of R Markdown: The Definitive Guide and couldn't find any answers here, and have read other similar questions and their answers here this example is the most similar to my question, but as he is using pander and trying to export to pdf and word.
I have tried various formats, from removing the numbers and creating all bullet points and still I get the same indentation formatting. If I remove all numbers and don't put any - or * at the start of each line rmarkdown just treats like one whole column inconsistently. When I do a dput
I can see that the first 1.is but after that it gets inconsistent even when playing around with the \r\n
and haven't had any luck.