0

How can I create Table 1 and Table 2(see picture below) but with the following modifications:

  1. Without the parameter description column in Table 1.
  2. I don't want the darkened headings in Tables 1 and 2 and the "Figure 1-4" in Table 1.

Only the first column should be under parameters. The four remaining columns should be under numerical values. enter image description here


EDIT: From Zarko's answer, I tried for the first table but has some errors. I have also added in a third table with 20 rows that needs addressing since it is very long.

\documentclass{article}

\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}

\begin{document}
    \begin{center}
        \begin{tblr}{colspec = {*{1}{Q[l, mode=math] } *{4}{Q[c, si={table-format=1.2}]}},
                     row{1}   = {guard},
                     row{2-Z} = {rowsep=0.5pt},
                                     row{Z}   = {guard}
                    }
        \toprule
        &   \SetCell[c=1]{c}    Parameters 
                &       &   \SetCell[c=2]{c}    Numerical values    
                                &       \\
         \cmidrule[r]{1} \cmidrule[l]{2-5}
    a   & 0.00    &0.00   & 0.04  & 0.00  \\
    b   & 0.00    & 0.00   & 2.48  & 0.00     \\
    c  & 0.00    & 0.00   & 0.08  & 0.00     \\
    d   & 0.00    & 0.00   & 0.12  & 0.00     \\
    e   & 0.00    & 0.00   & 0.16  & 0.00     \\
    f   & 0.00    & 0.00   & 0.20  & 0.00     \\
    g   & 0.1    &0.2   & 0.24  & 0.00     \\
    h   &0.7    & 0.4   & 0.24  & 0.00     \\
    i   &0.00    & 0.00   & 0.24  & 0.6     \\
    j   &0.00    & 0.00   & 0.2  & 0.8     \\
    k   &0.4   & 0.00   & 0.24  & 0.00     \\
    l   &0.00    & 0.00   & 0.2  & 0.00     \\
    m  &0.00    & 0.00   & 0.24  & 0.00     \\
    n   &0.00    & 0.00   & 0.24  & 0.00     \\
    o   &0.00    & 0.00   & 0.24  & 0.00     \\
         \midrule[0.8pt]
        &       &       & Figure \textcolor{red}{1}
                                & Figure \textcolor{red}{2} \\
        \cmidrule[0.8pt]{2-5}
        \end{tblr}
    \end{center}

\begin{center}
    \begin{tblr}{colspec = {Q[l, mode=math] Q[c, si={table-format=-1.4}]},
                 row{1}  = {guard, mode=text},
                 row{odd[3-X]}={belowsep=2ex},
                }
    \toprule
Expression  &   Value   \\
     \toprule
a   & 0.00       \\
b  & 0.00      \\
c   & 0.00      \\
d   & 0.00       \\
e  & 0.00      \\
f  & 0.00      \\
g & 0.00      \\
    \bottomrule
    \end{tblr}
\end{center}
\begin{center}
    \begin{tblr}{colspec = {*{1}{Q[l, mode=math] } *{4}{Q[c, si={table-format=1.2}]}},
                 row{1}   = {guard},
                 row{2-Z} = {rowsep=0.5pt},
                                 row{Z}   = {guard}
                }
    \toprule
    &   \SetCell[c=1]{c}    Parameters 
            &       &   \SetCell[c=2]{c}    Numerical values    
                            &       \\
     \cmidrule[r]{1} \cmidrule[l]{2-5}
a   & 0.00    &0.00   & 0.04  & 0.00  \\
b   & 0.00    & 0.00   & 2.48  & 0.00     \\
c   & 0.2   & 0.3   & 0.8  & 0.2     \\
d   & 0.00    & 0.00  & 0.08  & 0.00     \\
e   & 0.00    & 0.00   & 0.08  & 0.00     \\
f   & 0.00    & 0.00   & 0.12  & 0.00    \\
g   & 0.00    & 0.00   & 0.16  & 0.00     \\
h   & 0.00    &0.00   & 0.24  & 0.00     \\
i   &0.00    & 0.00   & 0.24  & 0.00     \\
j   &0.00    & 0.00   & 0.24  & 0.00    \\
k   &0.00    & 0.00   & 0.24  & 0.00     \\
l   & 0.00    & 0.00   & 0.20  & 0.00     \\
m   &0.00    & 0.00   & 0.24  & 0.00\\
n  &0.00    & 0.00   & 0.24  & 0.00     \\
o   &0.00    & 0.00   & 0.24  & 0.00     \\
p   &0.00    & 0.00   & 0.24  & 0.00     \\
q   &0.00   & 0.00   & 0.24  & 0.00     \\
r   &0.00    & 0.00   & 0.24  & 0.00     \\
s  &0.00    & 0.00   & 0.24  & 0.00    \\
t   &0.00   & 0.00   & 0.24  & 0.00     \\
     \midrule[0.8pt]
    &       &       & Figure \textcolor{red}{1}
                            & Figure \textcolor{red}{2} \\
    \cmidrule[0.8pt]{2-5}
    \end{tblr}
\end{center}

    \end{document}

Can it be made to look professional? It will be used for publication.

Table 1 should look like this:

enter image description here

enter image description here

0

3 Answers 3

3
+50
  • Content of your table code fragment is not even close to shoed table, so the table below has only (last) two columns with numbers.
  • For table is used tblr of tabularray package
  • Last two columns are of S type, which enable to align numbers at decimal points (such numbers are in showed tables)

Edit (1):
Now, after editing of question, is more clear (to me), what you after. I must confess, that table code in original question, confuse me what is in table. Something like shows the first image, or what was written in the code of the table.

Hopefully now, the edited code gives what you after.

Edit (2):
It seems that we (OP and me) need more iteration for finalized this table. Still is not clear, how parameter looks like. I assumed that they should be in cells horizontally centered as is shown in the first image in question. Now is replaced original code with corrected one too ...

\documentclass{article}

\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}

\begin{document}
\begin{center}
    \begin{tblr}{colspec = {Q[c, mode=math]*{4}{Q[c, si={table-format=1.2}]}},
                 row{1}  = {guard, mode=text},
                 row{2-Z} = {rowsep=0pt},
                 row{odd[3-X]}={belowsep=0.5ex},
                 row{Z}  = {guard}
                }
    \toprule
Parameters
    &   \SetCell[c=4]{c}    Numerical values
            &       &       &       \\
     \cmidrule[r]{1-1} \cmidrule[l]{2-5}
A       & 0.00  & 0.00  & 0.04  & 0.00  \\
\mu_1   & 0.00  & 0.00  & 2.48  & 0.00  \\
\beta   & 0.00  & 0.00  & 0.08  & 0.00  \\
\gamma  & 0.00  & 0.00  & 0.12  & 0.00  \\
\mu_2   & 0.00  & 0.00  & 0.16  & 0.00  \\
f       & 0.00  & 0.00  & 0.20  & 0.00  \\
g       & 0.1   & 0.2   & 0.24  & 0.00  \\
h       & 0.7   & 0.4   & 0.24  & 0.00  \\
i       & 0.00  & 0.00  & 0.24  & 0.6   \\
j       & 0.00  & 0.00  & 0.2   & 0.8   \\
k       & 0.4   & 0.00  & 0.24  & 0.00  \\
l       & 0.00  & 0.00  & 0.2   & 0.00  \\
m       & 0.00  & 0.00  & 0.24  & 0.00  \\
n       & 0.00  & 0.00  & 0.24  & 0.00  \\
o       & 0.00  & 0.00  & 0.24  & 0.00  \\     
    \midrule[0.8pt]
    & Figure \textcolor{red}{1}       
            & Figure \textcolor{red}{2}       
                    & Figure \textcolor{red}{3}
                            & Figure \textcolor{red}{4} \\
    \cmidrule[0.8pt]{2-5}
    \end{tblr}
\end{center}
\end{document}

enter image description here

Edit (3):
I my gosh! You are not after professional looking table but for ordinary table with poor typography.

Well, I will make this changes, but this is my last edit/correction of my answer. I'm not willing to be your assistant for typing of tables. I'm to old for this, sorry.

\documentclass{article}

\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}

\begin{document}
\begin{center}
    \begin{tblr}{hlines, vlines,
                 colspec = {Q[c, mode=math]*{4}{Q[c, si={table-format=1.2}]}},
                 row{1}  = {guard, mode=text},
                 row{Z}  = {guard}
                }
Parameters
    &   \SetCell[c=4]{c}    Numerical values
            &       &       &       \\
A       & 0.00  & 0.00  & 0.04  & 0.00  \\
\mu_1   & 0.00  & 0.00  & 2.48  & 0.00  \\
\beta   & 0.00  & 0.00  & 0.08  & 0.00  \\
\gamma  & 0.00  & 0.00  & 0.12  & 0.00  \\
\mu_2   & 0.00  & 0.00  & 0.16  & 0.00  \\
f       & 0.00  & 0.00  & 0.20  & 0.00  \\
g       & 0.1   & 0.2   & 0.24  & 0.00  \\
h       & 0.7   & 0.4   & 0.24  & 0.00  \\
i       & 0.00  & 0.00  & 0.24  & 0.6   \\
j       & 0.00  & 0.00  & 0.2   & 0.8   \\
k       & 0.4   & 0.00  & 0.24  & 0.00  \\
l       & 0.00  & 0.00  & 0.2   & 0.00  \\
m       & 0.00  & 0.00  & 0.24  & 0.00  \\
n       & 0.00  & 0.00  & 0.24  & 0.00  \\
o       & 0.00  & 0.00  & 0.24  & 0.00  \\     
    & Figure \textcolor{red}{1}       
            & Figure \textcolor{red}{2}       
                    & Figure \textcolor{red}{3}
                            & Figure \textcolor{red}{4} \\
    \end{tblr}
\end{center}
\end{document}

enter image description here

or with the following table's preamble

    \begin{tblr}{hline{1-Y} = solid,        hline{Z}   = {2-Z}{solid},
                 vline{1}   = {1-Y}{solid}, vline{2-Z} = {1-Z}{solid},
                 colspec = {Q[c, mode=math]*{4}{Q[c, si={table-format=1.2}]}},
                 row{1}  = {guard, mode=text},
                 row{Z}  = {guard}
                }

enter image description here

For the second table:

\documentclass{article}

\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}

\begin{document}
\begin{center}
    \begin{tblr}{ colspec = {Q[l, mode=math] Q[c, si={table-format=-1.4}]},
                  row{1}  = {guard, mode=text},
                 row{2-Z} = {rowsep=0pt},
                  row{2}  = {abovesep=2pt},
                 row{odd[3-Z]} = {belowsep=0.5ex},
                }
    \toprule
Expression  &   Value   \\
     \toprule
a^2 + b^2   & -1.2345       \\
a^2 + b^2   & -1.2345       \\
a^2 + b^2   & -1.2345       \\
a^2 + b^2   & -1.2345       \\
a^2 + b^2   & -1.2345       \\
    \bottomrule
    \end{tblr}
\end{center}
\end{document}

enter image description here

Note:
I liberate your table contents from jail of vertical and horizontal rules, use rules defined in tabularray package (it is load as Tblr library) and insert (for better readably) some vertical space between each two rows. By this, according to my opinion, tables have more "professional" looks.

However, if you for some reason more prefer to have all cells surrounded by lines, let me know, that I will write new tables preambles, which will enable this. Short example for second table is:

\documentclass{article}

\usepackage{tabularray}
\UseTblrLibrary{siunitx}

\begin{document}
\begin{center}
    \begin{tblr}{hline{1,2,Z} = 0.6pt, hline{2-Z} = solid, vlines,
                colspec = {Q[l, mode=math] Q[c, si={table-format=-1.4}]},
                row{1}  = {guard, mode=text},
                }
Expression  &   Value   \\
a^2 + b^2   & -1.2345       \\
a^2 + b^2   & -1.2345       \\
a^2 + b^2   & -1.2345       \\
a^2 + b^2   & -1.2345       \\
a^2 + b^2   & -1.2345       \\
a^2 + b^2   & -1.2345       \\
a^2 + b^2   & -1.2345       \\
    \end{tblr}
\end{center}
\end{document}

enter image description here

16
  • Good answer. However, in Table 1, only the first column should be parameters and the rest four columns should be numerical values(as in the photo shown) I hope you can fix this.
    – Math
    Jan 24, 2023 at 14:19
  • @Math, sorry, your question is not entirely clear... Of course I can fix this, but I'm not intend to rewrite table content from image of table. This is your job. In answer I used your MWE where are only two columns with numbers (In answer I complain about this) and add missing last row. If in example are some columns surplus or have wrong content, then please edit question and provide more realistic MWE. In this you can use in answer suggested solution.
    – Zarko
    Jan 24, 2023 at 14:36
  • I agree with Zarko, the question is unclear or at least, it is unclear why Zarko's answer isn't the correct one.
    – anis
    Jan 26, 2023 at 13:36
  • @Zarko what do you compile this with?
    – anis
    Jan 26, 2023 at 13:37
  • 1
    @anis, well, I wonder now, why I wanted to help OP. Maybe just to show how his (her?) table can be written, which, to my opinion of course, looks nice.
    – Zarko
    Jan 26, 2023 at 14:04
2
\documentclass{article}

\usepackage[table,dvipsnames]{xcolor}

\begin{document}
 \begin{center}
  \begin{tabular}{|c|c|c|c|c|}
   \hline
   \rowcolor{lightgray}
   Parameters & \multicolumn{4}{c|}{Numerical Values} \\
   \hline
   x & x & x & x & x \\
   \hline
   x & x & x & x & x \\
   \hline
   x & x & x & x & x \\
   \hline
   x & x & x & x & x \\
   \hline
   x & x & x & x & x \\
   \hline
   x & x & x & x & x \\
   \hline
   x & x & x & x & x \\
   \hline
   x & x & x & x & x \\
   \hline
   x & x & x & x & x \\
   \hline
   x & x & x & x & x \\
   \hline
   x & x & x & x & x \\
   \hline
   x & x & x & x & x \\
   \hline
   x & x & x & x & x \\
   \hline
   \multicolumn{1}{c|}{} & Fig 1 & Fig 2 & Fig 3 & Fig 4 \\
   \cline{2-5}
  \end{tabular}
 \end{center}
\end{document}
2

Here's another solution based on tabularray.

AFAIK double vertical lines don't work well with background colours because they introduce gaps which are not a part of cells hence do not gain colours. The workaround would be to create additional columns of very small width, which might be a bit cumbersome.

The two tables share the same theme. I am not sure if this is the case, though.

enter image description here

\documentclass{article}
\usepackage{xcolor}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}

\SetTblrInner{
  rows = {rowsep=2pt},
  row{1} = {bg=gray!35},
  cell{1}{1} = {bg=gray!20},
  hline{2}   = {1}{-}{wd=\heavyrulewidth},
  hline{2}   = {2}{-}{wd=\heavyrulewidth},
}


\begin{document}
\begin{table}[tbh]
  \centering
  \begin{tblr}{
      colspec = {*5{Q[c,mode=math]}},
      row{1,Z} = {mode=text},
      % Horizontal line specification
      hline{1,Y} = {wd=\heavyrulewidth},
      hline{3-X} = {wd=\cmidrulewidth},
      hline{Z}   = {2-Z}{wd=\heavyrulewidth},
      % Vertical line specification
      vline{1}   = {1-Y}{wd=\heavyrulewidth,abovepos=1,belowpos=1},
      vline{2}   = {wd=\heavyrulewidth},
      vline{3-Y} = {2-Z}{wd=\cmidrulewidth},
      vline{Z}   = {wd=\heavyrulewidth,abovepos=1,belowpos=1},
    }
    Parameters & \SetCell[c=4]{c} Numerical values & & & \\
    A          & 0.1      & 0.1      & 0.1      & 0.1 \\
    B          & 0.1      & 0.1      & 0.1      & 0.1 \\
    \mu_{1}    & 0.1      & 0.1      & 0.1      & 0.1 \\
    \alpha_{1} & 0.1      & 0.1      & 0.1      & 0.1 \\
    \beta      & 0.1      & 0.1      & 0.1      & 0.1 \\
               & Figure 1 & Figure 2 & Figure 3 & Figure 4
  \end{tblr}
\end{table}

\begin{table}[tbh]
  \centering
  \begin{tblr}{
      colspec = {*2{Q[c,mode=math]}},
      row{1} = {mode=text},
      % Horizontal line specification
      hline{1,Z} = {wd=\heavyrulewidth},
      hline{3-Y} = {wd=\cmidrulewidth},
      % Vertical line specification
      vline{1,Z} = {wd=\heavyrulewidth,abovepos=1,belowpos=1},
      vline{2}   = {wd=\heavyrulewidth},
    }
    Expression    & Value \\
    f(x) = x^2    & 0.111 \\
    a = b         & 0.222 \\
    c = d^3       & 0.444 \\
    e = x^2 + y^2 & 0.555 \\
  \end{tblr}
\end{table}
\end{document}

You must log in to answer this question.

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