Search code examples
rr-markdownmarkdownbookdown

Left-aligned array in unordered list using bookdown


I want a left aligned array in my unorderd list but everything I used doesn't work. I tried it with ..., $$ ... $$, $ ... $, \left[ ... \rigth] and \[ ... \] - for the three dots I putted in the array.

Can you please give me a hint how I can solve this issue? Many thanks in advance!

My code (to render it use bookdown::render_book("C:/YourPath/index.Rmd")):

---
title: "Alignment of array in unordered  list"
output: bookdown::gitbook
---


# First header

  - First point of unordered list
  - 
    \begin{array}{l l l l}
        text_1 &        &           &        \\
               & text_2 &           &        \\
               &        & text_{31} &        \\
               &        & text_{32} &        \\
               &        &           & text_4 \\
    \end{array}

  - Some following points...

Solution

  • I think you might need to use inline math mode (i.e., single $) and put the LaTeX all on one line:

    ---
    title: "Alignment of array in unordered  list"
    output: bookdown::gitbook
    ---
    
    # First header
      
    - First point of unordered list
    - $\begin{array}{l l l} \\ text_1 & & \\ text_2 & & \\ & text_{31} & \\ & text_{32} & \\ & & text_4 \\ \end{array}$
    - Some following points...
    

    enter image description here

    Reprex files hosted with on GitHub