html-tabler-markdownbordercross-referencepander

Rmarkdown: table with cross-ref AND invisible borders?


I have writen a numbered equation (call it eq1) in Rmarkdown with bookdown::html_document2 output (for numbering and cross-ref) as follow:

\begin{equation} 
  a=b+c (\#eq:eq1)
\end{equation}

Then I would like to add a legend below this equation explaining each of the parameter/symbol appearing in it. I would like this legend to have two characteristics:

I know that I can create a table containing a cross-ref to eq2 with pander as follows:

Where:
```{r}
tbl<-data.frame(
  symbol=c(
    "$a$ :",
    "$b$ :",
    "$c$:"),
  meaning=c(
    "<p>The response</p>",
    "<p>A first parameter</p>",
    "A parameter that should be calculated as in equation \\@ref(eq:eq2)")
)
names(tbl) <- NULL
pander(tbl, style = 'grid')
```
\begin{equation} 
  c=d/e (\#eq:eq2)
\end{equation}

This produces the following output:

enter image description here

My problem is that I cannot find a way to remove the grey horizontal lines of the table (or make them invisible by setting zero line thickness or white color).

Can someone help to solve the border issue or suggest a different way to obtain a similar result ? Reminder: I work with html output. Many thanks.


Solution

  • Unset the border-top of td and th element using CSS.

    ---
    title: "Tables"
    output: bookdown::html_document2
    ---
    
    # R markdown
    
    ```{r setup, include=FALSE}
    knitr::opts_chunk$set(echo = FALSE)
    ```
    
    ```{css, echo=FALSE}
    
    .table td,
    .table th {
      border-top: unset !important;
    }
    
    ```
    
    ```{r}
    library(pander)
    
    tbl <- data.frame(
      symbol=c(
        "$a$ :",
        "$b$ :",
        "$c$:"),
      meaning=c(
        "<p>The response</p>",
        "<p>A first parameter</p>",
        "A parameter that should be calculated as in equation \\@ref(eq:eq2)")
    )
    
    names(tbl) <- NULL
    pander(tbl, style='grid')
    ```
    
    \begin{equation} 
      c=d/e (\#eq:eq2)
    \end{equation}
    

    pander tables without any grey border line