I am trying to create a list using this code in Rmarkdown:
```{r}
vars_col <- c(letters[1:5])
model_latent_vars <- c(LETTERS[1:5])
```
Variables list:
`r paste0(" - ", vars_col, " — ", model_latent_vars, collapse = " \\newline ")`
The result is not the desired one, I would like to obtain a bullet list, however with this solution only the first line gets the bullet.
If you use collapse=" \\newline"
, the generated tex code looks like,
\begin{itemize}
\tightlist
\item
a --- A\newline - b --- B\newline - c --- C\newline - d ---
D\newline - e --- E
\end{itemize}
Hence you are getting only one bullet point with rest of the content in a new line.
To get the desired output, you need to use collapse="\n"
instead.
```{r}
vars_col <- c(letters[1:5])
model_latent_vars <- c(LETTERS[1:5])
```
Variables list:
`r paste0(" - ", vars_col, " — ", model_latent_vars, collapse = "\n")`