rr-markdownbulletedlist

Cannot reproduce with bullets as output of pdf document in RMarkdown


I am trying to reproduce same output for intended bullet list, which is reporoduced here

enter image description here

But unfortunately, I cannot reproduce the white bullet circled in red in my picture. With the code used below, I can obtain just some horizontal sticks.

---
title: "example"
author: "X"
date: "2023-09-23"
output: pdf_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

##Title

text:

* 2) text A: 
    + text B 


```{r cars}
summary(cars)

enter image description here

Can anyone help me understand why?


Solution

  • This is because article class defines the symbol used for the second level items in itemize environment as \newcommand\labelitemii {\labelitemfont \bfseries \textendash}. The class defines the default PDF style used in PDF rendering using Rmarkdown (and Quarto markdown .qmd). See the definition of article.cls.

    You can override this definition by writing \renewcommand\labelitemii{$\circ$} in header-includes of your Rmd's YAML section. This LaTeX command is applied to all bullet lists in the Rmd, and in this way, you are able to keep writing bullet list in Markdown notation, saving you from writing the lists with \begin{itemize}...\end{itemize} in your rmd.

    ---
    title: "example"
    author: "X"
    date: "2023-09-23"
    output: pdf_document
    header-includes:
      - |
        ```{=latex}
        \renewcommand\labelitemii{$\circ$}
        ```
    ---
    
    ```{r setup, include=FALSE}
    knitr::opts_chunk$set(echo = TRUE)
    ```
    
    ## Title
    
    text:
    
    * 2) text A: 
        + text B 
    
    
    ```{r cars}
    summary(cars)
    ```
    

    enter image description here