77

I created a table in LaTeX, but there are some problems with the borders. The borders remain open whereas I want them closed. Also, in the last row, I want the vertical line gone, ie I want just one column in the last row. Can someone please fix it? Here are my code and my table:

\documentclass{article}
\usepackage{booktabs}

 \begin{document}

 \begin{table} [h!]
\begin{center}
\begin{tabular}{|l|c|c|c|c|}
\hline
Parameters  & \multicolumn{2}{c}{Model 1} & \multicolumn{2}{c}{Model 2}\\ 
    \midrule

&  Coefficient & 95\% CI
&   Coefficient & 95\% CI \\ 
    \midrule

   $\beta_{concern_2}$  &   $0.190^{\ast}$ & (0.113, 0.268) & 0.171 & (0.100, 0.241)\\
   $\beta_{concern_3}$   &  0.117 &  (0.043, 0.191)  & 0.117 & (0.050, 0.183)\\ 
    $\beta_{concern_4}$ & 0.210  &  (0.139, 0.281)  & 0.190 & (0.127, 0.253)\\ 
     $\beta_{concern_5}$ & 0.204 & (0.135, 0.273)   & 0.111 & ( 0.049, 0.173)\\  
    $\beta_{breath_2}$  &  0.157 & (0.07,8 0.236) & 0.208 & (0.136, 0.280) \\
     $\beta_{breath_3}$ & 0.115 & (0.041, 0.189) & 0.100 & (0.034, 0.166) \\
    $\beta_{breath_4}$ & 0.236 &  (0.160, 0.311) & 0.301 & ( 0.234, 0.368)\\  
    $\beta_{breath_5}$ & 0.092 & (0.020, 0.163) & 0.079 & (0.015, 0.144) \\
   $\beta_{weath_2}$  &   0.164 & ( 0.092, 0.236) & 0.137 & (0.071, 0.203) \\
    $\beta_{weath_3}$  & 0.160 &  (0.089, 0.231) & 0.199 & (0.135, 0.263) \\
   $\beta_{weath_4}$ &  0.141 & (0.067, 0.215) & 0.133 & (0.066, 0.199) \\
    $\beta_{weath_5}$ & 0.176 & (0.103, 0.249) &  0.257 & (0.191, 0.323)\\ 
    $\beta_{sleep_2}$  & 0.111 & (0.036, 0.187) & 0.135 & (0.068 0.203)  \\ 
    $\beta_{sleep_3}$  & 0.110 & (0.036 0.184) & 0.176 &  0.110 0.242 \\   
    $\beta_{sleep_4}$  &  0.131 & (0.056 0.205 & 0.162 & 0.095 0.229 \\  
    $\beta_{sleep_5}$  & 0.011 & (-0.064, 0.086) & 0.034 & (-0.033, 0.101) \\ 
    $\beta_{act_2}$ &  0.135 & (0.060, 0.209) & 0.033 & (-0.033, 0.100) \\
    $\beta_{act_3}  $ &0.195 & (0.121, 0.269) & 0.203 & ( 0.137, 0.268)\\  
    $\beta_{act_4}  $ & 0.214 & ( 0.139, 0.290) & 0.254 & (0.186 0.321) \\ 
    $\beta_{act_5}  $ & 0.224 & (0.154, 0.294) & 0.158 & (0.095, 0.221) \\
\hline
    & *statistically significant at 5\% level \\
\hline
\end{tabular}
\caption{Regression Coefficients of model 1 and model 2 }
\label{beta}
\end{center}
\end{table}

 \end{document}

4
  • 2
    Sorry, but shouldn't you add a | also in the \multicolums (i.e: \multicolumn{2}{c|}{Model 1} )? Commented Jan 2, 2013 at 10:57
  • 12
    The commands provided by booktabs work correctly only in absence of vertical rules. Remove them and your table will be better (use also \toprule and \bottomrule, though).
    – egreg
    Commented Jan 2, 2013 at 11:07
  • As the Indices are words you could do the follwing $\beta_{\text{concern}_2}$, to do that just add \usepackage{amsmath} to your preamble.
    – rtzll
    Commented Jan 2, 2013 at 11:20
  • This is not really a minimum working example. BTW did you read the booktabs documentation? It discourages \hline and |. Perhaps that's why the output looks so bad.
    – user10274
    Commented Jan 2, 2013 at 11:36

8 Answers 8

54

That's by design: the author of booktabs hates vertical rules in tables and I fully agree with him. You could act on spacing parameters, namely

  • \abovetopsep (0pt by default), used above a \toprule
  • \belowbottomsep (0pt by default), used below a \bottomrule
  • \aboverulesep (0.4ex by default), used above a \midrule, \cmidrule or \bottomrule
  • \belowrulesep (0.65ex by default), used below a \midrule, \cmidrule or \toprule

They are all rigid length (no plus or minus specifications are allowed and they wouldn't make sense anyway).

By (locally) setting these parameters to zero, the vertical rules will match, but it would simpler not to use booktabs commands at all: the heavier \toprule and \bottomrule would be completely out of place.

Don't use vertical rules and the appearance of your table will improve immediately.

\documentclass{article}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{array}
\newcolumntype{L}{>{$}l<{$}}
\newcolumntype{C}{>{$}c<{$}}
\newcolumntype{R}{>{$}r<{$}}
\newcommand{\nm}[1]{\textnormal{#1}}

\begin{document}

\begin{table} [h!]
\centering
\begin{tabular}{LCRCR}
\toprule
\multicolumn{1}{l}{Parameters} &
\multicolumn{2}{c}{Model 1}    &
\multicolumn{2}{c}{Model 2}    \\ 
\cmidrule(lr){2-3}
\cmidrule(lr){4-5}

&
\multicolumn{1}{c}{Coefficient} &
\multicolumn{1}{c}{95\% CI}     &
\multicolumn{1}{c}{Coefficient} &
\multicolumn{1}{c}{95\% CI}     \\
\midrule

\beta_{\nm{concern}_2} & 0.190\makebox[0pt][l]{$^{\ast}$} 
                               & ( 0.113, 0.268) & 0.171 & ( 0.100, 0.241) \\
\beta_{\nm{concern}_3} & 0.117 & ( 0.043, 0.191) & 0.117 & ( 0.050, 0.183) \\
\beta_{\nm{concern}_4} & 0.210 & ( 0.139, 0.281) & 0.190 & ( 0.127, 0.253) \\
\beta_{\nm{concern}_5} & 0.204 & ( 0.135, 0.273) & 0.111 & ( 0.049, 0.173) \\  
\beta_{\nm{breath}_2}  & 0.157 & ( 0.078, 0.236) & 0.208 & ( 0.136, 0.280) \\
\beta_{\nm{breath}_3}  & 0.115 & ( 0.041, 0.189) & 0.100 & ( 0.034, 0.166) \\
\beta_{\nm{breath}_4}  & 0.236 & ( 0.160, 0.311) & 0.301 & ( 0.234, 0.368) \\
\beta_{\nm{breath}_5}  & 0.092 & ( 0.020, 0.163) & 0.079 & ( 0.015, 0.144) \\
\beta_{\nm{weath}_2}   & 0.164 & ( 0.092, 0.236) & 0.137 & ( 0.071, 0.203) \\
\beta_{\nm{weath}_3}   & 0.160 & ( 0.089, 0.231) & 0.199 & ( 0.135, 0.263) \\
\beta_{\nm{weath}_4}   & 0.141 & ( 0.067, 0.215) & 0.133 & ( 0.066, 0.199) \\
\beta_{\nm{weath}_5}   & 0.176 & ( 0.103, 0.249) & 0.257 & ( 0.191, 0.323) \\
\beta_{\nm{sleep}_2}   & 0.111 & ( 0.036, 0.187) & 0.135 & ( 0.068, 0.203) \\ 
\beta_{\nm{sleep}_3}   & 0.110 & ( 0.036, 0.184) & 0.176 & ( 0.110, 0.242) \\   
\beta_{\nm{sleep}_4}   & 0.131 & ( 0.056, 0.205) & 0.162 & ( 0.095, 0.229) \\  
\beta_{\nm{sleep}_5}   & 0.011 & (-0.064, 0.086) & 0.034 & (-0.033, 0.101) \\ 
\beta_{\nm{act}_2}     & 0.135 & ( 0.060, 0.209) & 0.033 & (-0.033, 0.100) \\
\beta_{\nm{act}_3}     & 0.195 & ( 0.121, 0.269) & 0.203 & ( 0.137, 0.268) \\  
\beta_{\nm{act}_4}     & 0.214 & ( 0.139, 0.290) & 0.254 & ( 0.186, 0.321) \\ 
\beta_{\nm{act}_5}     & 0.224 & ( 0.154, 0.294) & 0.158 & ( 0.095, 0.221) \\
\midrule[\heavyrulewidth]
\multicolumn{5}{l}{\footnotesize$^*$ statistically significant at 5\% level} \\
\bottomrule
\end{tabular}
\caption{Regression Coefficients of model 1 and model 2}\label{beta}
\end{table}



\end{document}

I've made some notable changes.

  1. The subscripts are upright, being words

  2. The alignment is improved by using features of the table itself; for instance, the third and fifth column are right aligned because of the minus signs only in the first coordinate; it wouldn't be so if the minus sign appeared also in the second coordinate or the headers had been wider.

  3. With \cmidrule it's easier to show how the headers group the columns.

  4. A trick is used for avoiding the * to take up space.

  5. An array trick is used for setting all columns in math mode, ensuring that the minus signs are printed as such.

  6. \centering is used instead of the center environment (that adds vertical space).

enter image description here

If you need to change "95% CI" to "95% Bayesian Interval", the best is to split the long phrase into two lines: modify the block

\multicolumn{1}{c}{Coefficient} &
\multicolumn{1}{c}{95\% CI}     &
\multicolumn{1}{c}{Coefficient} &
\multicolumn{1}{c}{95\% CI}     \\
\midrule

into

\multicolumn{1}{c}{Coefficient} & \multicolumn{1}{c}{95\% Bayesian} &
\multicolumn{1}{c}{Coefficient} & \multicolumn{1}{c}{95\% Bayesian} \\
                                & Interval                          &
                                & Interval                          \\
\midrule
15
  • 56
    This does not answer the OP's question (nor mine). Commented Jan 23, 2016 at 6:23
  • 10
    Then OP asked the wrong question :) Commented Jan 23, 2016 at 20:06
  • 6
    I'd still really like to know how to fix the vertical line issue instead : / (Can you add a "If you really must do it." section? That would be great!) For me some lines don't hurt to separate content of tables. It sort of seems like many people are only justifying a lack of an easy way of doing that by saying "it looks better without". However, that's subjective. Commented Mar 11, 2016 at 21:33
  • 4
    @Zelphir Don't use the booktabs commands, but \hline
    – egreg
    Commented Mar 11, 2016 at 21:59
  • 12
    @egreg That's your opinion and I respect that, but I completely disagree. Besides, if a package claims to add functionality, it shouldn't be reliant on a subjective criterion such as "this way looks better". When somebody publishes a package, it is only reasonable to assume that their intention is for that particular package to help other people do what they need, and not what that particular person thinks is the "right way". That's the way companies like Microsoft do things, not free software people. Sadly I don't have the required ability, so I'll just not use it instead.
    – Francisco
    Commented Jun 8, 2018 at 16:28
86

I don't think the answer "Don't use vertical rules" is very constructive when the question is about making vertical lines look nice. So here is a solution if you only want to modify the width of horizontal lines and if you are willing to not use booktabs:

\documentclass{article}
\usepackage{array}

\begin{document}

\begin{table} [h!]
\centering
\begin{tabular}{|l|c|c|c|c|}
\hline
Parameters  & \multicolumn{2}{c}{Model 1} & \multicolumn{2}{c}{Model 2}\\ 
    \noalign{\hrule height 1.5pt}

&  Coefficient & 95\% CI
&   Coefficient & 95\% CI \\ 
    \noalign{\hrule height 1.5pt}

   $\beta_{concern_2}$  &   $0.190^{\ast}$ & (0.113, 0.268) & 0.171 & (0.100, 0.241)\\
   $\beta_{concern_3}$   &  0.117 &  (0.043, 0.191)  & 0.117 & (0.050, 0.183)\\ 
    $\beta_{concern_4}$ & 0.210  &  (0.139, 0.281)  & 0.190 & (0.127, 0.253)\\ 
     $\beta_{concern_5}$ & 0.204 & (0.135, 0.273)   & 0.111 & ( 0.049, 0.173)\\  
    $\beta_{breath_2}$  &  0.157 & (0.07,8 0.236) & 0.208 & (0.136, 0.280) \\
     $\beta_{breath_3}$ & 0.115 & (0.041, 0.189) & 0.100 & (0.034, 0.166) \\
    $\beta_{breath_4}$ & 0.236 &  (0.160, 0.311) & 0.301 & ( 0.234, 0.368)\\  
    $\beta_{breath_5}$ & 0.092 & (0.020, 0.163) & 0.079 & (0.015, 0.144) \\
   $\beta_{weath_2}$  &   0.164 & ( 0.092, 0.236) & 0.137 & (0.071, 0.203) \\
    $\beta_{weath_3}$  & 0.160 &  (0.089, 0.231) & 0.199 & (0.135, 0.263) \\
   $\beta_{weath_4}$ &  0.141 & (0.067, 0.215) & 0.133 & (0.066, 0.199) \\
    $\beta_{weath_5}$ & 0.176 & (0.103, 0.249) &  0.257 & (0.191, 0.323)\\ 
    $\beta_{sleep_2}$  & 0.111 & (0.036, 0.187) & 0.135 & (0.068 0.203)  \\ 
    $\beta_{sleep_3}$  & 0.110 & (0.036 0.184) & 0.176 &  0.110 0.242 \\   
    $\beta_{sleep_4}$  &  0.131 & (0.056 0.205 & 0.162 & 0.095 0.229 \\  
    $\beta_{sleep_5}$  & 0.011 & (-0.064, 0.086) & 0.034 & (-0.033, 0.101) \\ 
    $\beta_{act_2}$ &  0.135 & (0.060, 0.209) & 0.033 & (-0.033, 0.100) \\
    $\beta_{act_3}  $ &0.195 & (0.121, 0.269) & 0.203 & ( 0.137, 0.268)\\  
    $\beta_{act_4}  $ & 0.214 & ( 0.139, 0.290) & 0.254 & (0.186 0.321) \\ 
    $\beta_{act_5}  $ & 0.224 & (0.154, 0.294) & 0.158 & (0.095, 0.221) \\

\hline
    & *statistically significant at 5\% level \\
\hline
\end{tabular}
\caption{Regression Coefficients of model 1 and model 2 }
\label{beta}
\end{table}

\end{document}

\midrule , \toprule , and \bottomrule are replaced by \noalign{\hrule height 1.5pt} with the width that you want.

You can also set the width of vertical lines by using !{\vrule width 2pt} instead of | in the tabular parameters.

I understand that this solution is not optimal, but it can do the trick and I hope it would help.

1
  • Wow, I love this solution!! Doesn't require any importing of other library or defining of a new command.
    – Dan
    Commented Jul 14, 2023 at 18:51
28

As @Puck says in his answer, and as Brandon Kuczenski comments, the responses here are not constructive, neither the question is answered.

The way to use vertical lines with booktabs (despite it is discouraged), is to reduce the space above and below the midrule:

 \aboverulesep=0ex
 \belowrulesep=0ex

This will cramp your tables a little bit, so, to return to a regular table line height, you should stretch your array with:

\renewcommand{\arraystretch}{SF}

Where SF is the stretch factor (use SF>1.0).

Just in case, you should add those lines in the preamble.

Hope this does answer your question.

4
  • 4
    But using this solution makes using booktabs very pointless.
    – Johannes_B
    Commented Nov 5, 2017 at 10:41
  • 25
    But it answers the question ;)
    – user215982
    Commented Nov 6, 2017 at 8:40
  • 3
    And, BTW, it's not pointless as you can use \begin{tabular}{c|c} together with \cmidrule{2-2} if that's the way you want to do it.
    – user215982
    Commented Nov 6, 2017 at 8:45
  • 1
    It is also not pointless because it allows to use \toprule etc. as before, with the thickness that can make it nicer than \hline, but without the vertical line discontinuity and without using \noalign{\hrule height 1.5pt} at various places in the table.
    – Marijn
    Commented May 27 at 12:42
11

booktabs also offers the specialrule like so:

\specialrule{\cmidrulewidth}{0pt}{0pt}

which will produce a horizontal line with no spacing and the vertical lines will cross it neatly.

4

Vertical lines are always continuous with the rules of booktabs if you use tblr or talltblr or longtblr environment of tabularray package:

\documentclass{article}
\usepackage[a4paper,margin=2cm]{geometry}

\usepackage{xcolor,hyperref}
\hypersetup{colorlinks}

\usepackage{tabularray}
\UseTblrLibrary{booktabs}

\begin{document}

\section{First Solution with \texttt{tblr} Environment}

\begin{table}[h!]
\centering
\begin{tblr}{|l|c|c|c|c|}
\toprule
  Parameters & \SetCell[c=2]{c} Model 1 & & \SetCell[c=2]{c} Model 2 & \\ 
\midrule
             &  Coefficient & 95\% CI     &  Coefficient & 95\% CI \\ 
\midrule
   $\beta_{concern_2}$ & $0.190^{\ast}$ & (0.113, 0.268) & 0.171 & (0.100, 0.241)\\
   $\beta_{concern_3}$ & 0.117 &  (0.043, 0.191)  & 0.117 & (0.050, 0.183)\\ 
   $\beta_{concern_4}$ & 0.210 &  (0.139, 0.281)  & 0.190 & (0.127, 0.253)\\ 
   $\beta_{concern_5}$ & 0.204 & (0.135, 0.273)   & 0.111 & ( 0.049, 0.173)\\  
   $\beta_{breath_2}$  & 0.157 & (0.07,8 0.236) & 0.208 & (0.136, 0.280) \\
   $\beta_{breath_3}$  & 0.115 & (0.041, 0.189) & 0.100 & (0.034, 0.166) \\
\midrule
    & *Statistically significant at 5\% level \\
\bottomrule
\end{tblr}
\caption{Regression Coefficients of model 1 and model 2}
\label{alpha}
\end{table}

\section{Second Solution with \texttt{talltblr} Environment}

\begin{table}[h!]
\centering
\begin{talltblr}[
  caption = {Regression Coefficients of model 1 and model 2},
  label = {beta},
  note{*} = {Statistically significant at 5\% level.},
]{|l|c|c|c|c|}
\toprule
  Parameters & \SetCell[c=2]{c} Model 1 & & \SetCell[c=2]{c} Model 2 & \\ 
\midrule
             &  Coefficient & 95\% CI     &  Coefficient & 95\% CI \\ 
\midrule
   $\beta_{concern_2}$ & 0.190\rlap{\TblrNote{*}} & (0.113, 0.268) & 0.171 & (0.100, 0.241)\\
   $\beta_{concern_3}$ & 0.117 &  (0.043, 0.191)  & 0.117 & (0.050, 0.183)\\ 
   $\beta_{concern_4}$ & 0.210 &  (0.139, 0.281)  & 0.190 & (0.127, 0.253)\\ 
   $\beta_{concern_5}$ & 0.204 & (0.135, 0.273)   & 0.111 & ( 0.049, 0.173)\\  
   $\beta_{breath_2}$  & 0.157 & (0.07,8 0.236) & 0.208 & (0.136, 0.280) \\
   $\beta_{breath_3}$  & 0.115 & (0.041, 0.189) & 0.100 & (0.034, 0.166) \\
\bottomrule
\end{talltblr}
\end{table}

\end{document}

enter image description here

3

My solution was to follows user215982's suggestion of \aboverulesep=0ex and \belowrulesep=0ex. However, I wanted to avoid the gaps between table rows caused by \renewcommand{\arraystretch}{1.35}. Instead, to put back the required vertical spacing, I placed vertical struts \rule{0pt}{1.1EM} in the row for the column headings and in the 1st row of data in the table.

\documentclass{article}
\usepackage{booktabs}
%\renewcommand{\arraystretch}{1.35} % Not part of my solution
\begin{document}
\begin{table}\centering
   \aboverulesep=0ex % Solution part 1 of 3
   \belowrulesep=0ex % Solution part 1 of 3
   \caption{Example records from a data frame.}
   \begin{tabular}[t]{ccc|ccc}
   \toprule
       \rule{0pt}{1.1EM}% Solution part 2 of 3 (% is required)
       XXXX & XXX\_XXXX & XXXXXX & XXXX & XXX\_XXXX & XXXXXX \\
   \midrule
       \rule{0pt}{1.1EM}% Solution part 3 of 3 (% is required)
       XXXX & XXX       &  XXX   & XXXX & XXX       &  XXX   \\
       XXXX & XXX       &  XXX   & XXXX & XXX       & XXXX   \\
       XXXX & XXX       &  XXX   & XXXX & XXX       &  XXX   \\
       XXXX & XXX       &  XXX   \\
   \bottomrule
   \end{tabular}
\end{table}

% This just helps visualize the effect of \rule parameters
\rule{3mm}{.1pt}%
\rule[-1mm]{5mm}{1cm}%
\rule{3mm}{.1pt}%
\rule[1mm]{1cm}{5mm}%
\rule{3mm}{.1pt}%
\rule{1cm}{5mm}%
\rule{3mm}{.1pt}

\end{document}

The result is what I sought:

enter image description here

Please help improve this answer: My visual inspection seems to confirm that placing the commands \aboverulesep=0ex and \belowrulesep=0ex between \begin{table} and \end{table} keeps the commands local. It would help if those more familiar with LaTeX confirm this explicitly. Thanks.

0

I trimmed it a little, added small spaces between every 4th row, and used short forms for the titles, and right aligned the first column, to tighten it. cropped table

\documentclass{article}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{array}
\newcolumntype{L}{>{$}l<{$}}
\newcolumntype{C}{>{$}c<{$}}
\newcolumntype{R}{>{$}r<{$}}
\newcommand{\nm}[1]{\textnormal{#1}}

\begin{document}

\begin{table} [h!]
\centering
\begin{tabular}{@{}RCRCR@{}}
\toprule
%\multicolumn{1}{r}{Parameter} 
&
\multicolumn{2}{c}{Model 1}    &
\multicolumn{2}{c}{Model 2}    \\ 
\cmidrule(lr){2-3}
\cmidrule(lr){4-5}
\multicolumn{1}{r}{Param} 
&
\multicolumn{1}{c}{Coeff} &
\multicolumn{1}{c}{95\% CI}     &
\multicolumn{1}{c}{Coeff} &
\multicolumn{1}{c}{95\% CI}     \\
\midrule
\beta_{\nm{concern}_2} & 0.190\makebox[0pt][l]{$^{\ast}$} 
                           & ( 0.113, 0.268) & 0.171 & ( 0.100, 0.241) \\
\beta_{\nm{concern}_3} & 0.117 & ( 0.043, 0.191) & 0.117 & ( 0.050,0.183) \\ 
\beta_{\nm{concern}_4} & 0.210 & ( 0.139, 0.281) & 0.190 & ( 0.127, 0.253) \\ 
\beta_{\nm{concern}_5} & 0.204 & ( 0.135, 0.273) & 0.111 & ( 0.049, 0.173) \\[4pt]  
\beta_{\nm{breath}_2}  & 0.157 & ( 0.078, 0.236) & 0.208 & ( 0.136, 0.280) \\
\beta_{\nm{breath}_3}  & 0.115 & ( 0.041, 0.189) & 0.100 & ( 0.034, 0.166) \\
\beta_{\nm{breath}_4}  & 0.236 & ( 0.160, 0.311) & 0.301 & ( 0.234, 0.368) \\  
\beta_{\nm{breath}_5}  & 0.092 & ( 0.020, 0.163) & 0.079 & ( 0.015, 0.144) \\[4pt]
\beta_{\nm{weath}_2}   & 0.164 & ( 0.092, 0.236) & 0.137 & ( 0.071, 0.203) \\
\beta_{\nm{weath}_3}   & 0.160 & ( 0.089, 0.231) & 0.199 & ( 0.135, 0.263) \\
\beta_{\nm{weath}_4}   & 0.141 & ( 0.067, 0.215) & 0.133 & ( 0.066, 0.199) \\
\beta_{\nm{weath}_5}   & 0.176 & ( 0.103, 0.249) & 0.257 & ( 0.191, 0.323) \\[4pt] 
\beta_{\nm{sleep}_2}   & 0.111 & ( 0.036, 0.187) & 0.135 & ( 0.068, 0.203) \\ 
\beta_{\nm{sleep}_3}   & 0.110 & ( 0.036, 0.184) & 0.176 & ( 0.110, 0.242) \\   
\beta_{\nm{sleep}_4}   & 0.131 & ( 0.056, 0.205) & 0.162 & ( 0.095, 0.229) \\  
\beta_{\nm{sleep}_5}   & 0.011 & (-0.064, 0.086) & 0.034 & (-0.033, 0.101) \\[4pt] 
\beta_{\nm{act}_2}     & 0.135 & ( 0.060, 0.209) & 0.033 & (-0.033, 0.100) \\
\beta_{\nm{act}_3}     & 0.195 & ( 0.121, 0.269) & 0.203 & ( 0.137, 0.268) \\  
\beta_{\nm{act}_4}     & 0.214 & ( 0.139, 0.290) & 0.254 & ( 0.186, 0.321) \\ 
\beta_{\nm{act}_5}     & 0.224 & ( 0.154, 0.294) & 0.158 & ( 0.095, 0.221) \\

\midrule[\heavyrulewidth]
\multicolumn{5}{l}{\footnotesize$^*$ statistically significant at 5\% level} \\
\bottomrule
\end{tabular}
\caption{Regression Coefficients of model 1 and model 2}\label{beta}
\end{table}
\end{document}
0

If you actually want vertical rules compatible with the rules of booktabs (which is not at all in the spirit of booktabs), you should use {NiceTabular} of nicematrix.

\documentclass{article}
\usepackage{nicematrix}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{enumitem}

 \begin{document}

\begin{table} [h!]
\centering
\begin{NiceTabular}{|l|c|c|c|c|}
\toprule
Parameters  & \multicolumn{2}{c}{Model 1} & \multicolumn{2}{c}{Model 2}\\ 
\midrule

&  Coefficient & 95\% CI
&   Coefficient & 95\% CI \\ 
    \midrule

   $\beta_{concern_2}$  &   $0.190$\tabularnote{statistically significant at 5\% level}& (0.113, 0.268) & 0.171 & (0.100, 0.241)\\
   $\beta_{concern_3}$   &  0.117 &  (0.043, 0.191)  & 0.117 & (0.050, 0.183)\\ 
    $\beta_{concern_4}$ & 0.210  &  (0.139, 0.281)  & 0.190 & (0.127, 0.253)\\ 
     $\beta_{concern_5}$ & 0.204 & (0.135, 0.273)   & 0.111 & ( 0.049, 0.173)\\  
    $\beta_{breath_2}$  &  0.157 & (0.07,8 0.236) & 0.208 & (0.136, 0.280) \\
     $\beta_{breath_3}$ & 0.115 & (0.041, 0.189) & 0.100 & (0.034, 0.166) \\
    $\beta_{breath_4}$ & 0.236 &  (0.160, 0.311) & 0.301 & ( 0.234, 0.368)\\  
    $\beta_{breath_5}$ & 0.092 & (0.020, 0.163) & 0.079 & (0.015, 0.144) \\
   $\beta_{weath_2}$  &   0.164 & ( 0.092, 0.236) & 0.137 & (0.071, 0.203) \\
\bottomrule
\end{NiceTabular}
\caption{Regression Coefficients of model 1 and model 2 }
\label{beta}
\end{table}

\end{document}

You need several compilations (because nicematrix uses PGF/Tikz nodes under the hood).

Output of the above code

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .