latexr-markdownfootnotes

Adding footnote to latex table


Regarding the following latex table, I would like to add footnotes to define the * in the last column. For example, The * refers to Parametric Model, ** semi-parametric and *** non-parametric, and the distance between the table and the footnote is the minimum possible.

\noindent\begin{tblr}{
  colspec={@{}l|[white]Xc@{}},
  hline{1,Z}={wd=1.2pt},
  hline{2}={wd=0.4pt},
  cell{2-Z}{2}={mode=imath}
}
Number  &  Model & Type\\
Model 1 &  \text{BC\_WS} = \beta _0 + \beta _1\cdot {\text{M\_WS}} + \epsilon & *\\
Model 2 &  \text{BC\_WS} = \beta _0 + f(\text{M\_WS}) + \epsilon & *** \\
Model 3 &  \text{BC\_WS} = \beta _0 + \beta _1\cdot W\_WS+ \beta _2\cdot \text{\text{W\_Direction}}+  \beta _3\cdot \text{Temperature} + \beta _4\cdot \text{Pressure}  + \epsilon &  *\\
Model 4 &  \text{BC\_WS} = \beta _0 + f(\text{M\_WS})+  f(\text{W\_Direction})+ f(\text{Temperature}) + f(\text{Pressure})  + \epsilon & *** \\
Model 5 &  \text{BC\_WS} =\beta _0 + \beta _1\cdot (\text{M\_WS})+  f(\text{W\_Direction})+ f(\text{Temperature}) + f(\text{Pressure})  + \epsilon & **\\
Model 6 &  \text{BC\_WS} = \beta _0 + \beta _1\cdot \text{M\_V}+ \beta _2\cdot \text{M\_V}+  \beta _3\cdot \text{Temperature} + \beta _4\cdot \text{Pressure}  + \epsilon &  *\\
Model 7 &  \text{BC\_WS} = \beta _0 + f(\text{M\_V})+ f(\text{M\_V})+ f(\text{Temperature}) + f(\text{Pressure})  + \epsilon & ***\\
\end{tblr} 

enter image description here


Solution

  • Use long tables (longtblr environment) and for table-footnotes use note{} = {table note ....} option.


    ---
    title: "footnotes"
    output: pdf_document
    header-includes:
      - \usepackage{tabularray}
    ---
    
    
    ## R Markdown
    
    
    \noindent\begin{longtblr}[
      note{} = { * Parametric ** Semi-parametric *** Non-parametric}
    ]{
      colspec={@{}l|[white]Xc@{}},
      hline{1,Z}={wd=1.2pt},
      hline{2}={wd=0.4pt},
      cell{2-Z}{2}={mode=imath}
    }
    Number  &  Model & Type\\
    Model 1 &  \text{BC\_WS} = \beta _0 + \beta _1\cdot {\text{M\_WS}} + \epsilon & *\\
    Model 2 &  \text{BC\_WS} = \beta _0 + f(\text{M\_WS}) + \epsilon & *** \\
    Model 3 &  \text{BC\_WS} = \beta _0 + \beta _1\cdot W\_WS+ \beta _2\cdot \text{\text{W\_Direction}}+  \beta _3\cdot \text{Temperature} + \beta _4\cdot \text{Pressure}  + \epsilon &  *\\
    Model 4 &  \text{BC\_WS} = \beta _0 + f(\text{M\_WS})+  f(\text{W\_Direction})+ f(\text{Temperature}) + f(\text{Pressure})  + \epsilon & *** \\
    Model 5 &  \text{BC\_WS} =\beta _0 + \beta _1\cdot (\text{M\_WS})+  f(\text{W\_Direction})+ f(\text{Temperature}) + f(\text{Pressure})  + \epsilon & **\\
    Model 6 &  \text{BC\_WS} = \beta _0 + \beta _1\cdot \text{M\_V}+ \beta _2\cdot \text{M\_V}+  \beta _3\cdot \text{Temperature} + \beta _4\cdot \text{Pressure}  + \epsilon &  *\\
    Model 7 &  \text{BC\_WS} = \beta _0 + f(\text{M\_V})+ f(\text{M\_V})+ f(\text{Temperature}) + f(\text{Pressure})  + \epsilon & ***\\
    \end{longtblr}
    
    

    tabularray long table with table-notes


    See the chapter 4 of this tabularray documentation for more a complete example with many more options.