1

I have been trying to make this tabletable

but I have a problem with the first row, the text "P kanal" and "Q kanal" aren't in the center here is what I get

table 2

The code I used:

\begin{tabular}{c c c c}
\hline
\hline
\rowcolor[RGB]{77,77,77}\color{white}\multirow{1}{}{Modulacijska} & \color{white}\multirow{1}{}{Biti na izlazu} & \color{white}\multirow{2}{}{\emph{I} kanal} & \color{white}\multirow{2}{}{\emph{Q} kanal} \\ 
\rowcolor[RGB]{77,77,77}\color {white} tehnika & \color{white} kanalnog prepletača & & \\
\hline
\hline
BSPK & $x_{0}$ & $x_{0}$ & - \\
\end{tabular}
Werner
  • 603,163
Sabina
  • 45
  • 3

3 Answers3

5

No \multirow:

\documentclass{article}
\usepackage[table]{xcolor}

\newcommand{\splitcell}[1]{\begin{tabular}{@{}c@{}}#1\end{tabular}}

\begin{document}

\begin{tabular}{c c c c}
\hline\hline
\rowcolor[RGB]{77,77,77}\color{white}\splitcell{Modulacijska \\ tehnika} &
\color{white}\splitcell{Biti na izlazu \\ kanalnog prepletača} &
\color{white}\emph{I} kanal &
\color{white}\emph{Q} kanal \\
\hline \hline
BSPK & $x_{0}$ & $x_{0}$ & -
\end{tabular}

\end{document}

enter image description here

I'd remove the double \hline commands: the big gray bar just serves the purpose. Actually I'd avoid the big bar, but that's personal preference.

egreg
  • 1,121,712
  • Thank you for your advice – Sabina May 09 '20 at 16:59
  • I also prefer you solution over multirow. However, \makecell{} does the same and has particular features: it applies line spread found in regular paragraphs, and \makecell{} is not affected by arraystretch, which sometimes helps with visual distinction of cells containing group of data. I think it's not possible to do that with regular tabular, is it? – Celdor Jul 18 '22 at 12:13
2

Here is the corrected version of your code:

enter image description here

\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{multirow}
\begin{document}
\begin{tabular}{c c c c} 
\hline \hline 
\rowcolor[RGB]{77,77,77}
\color{white} Modulacijska 
  & \color{white} Biti na izlazu 
    & 
      &  \\ 
\rowcolor[RGB]{77,77,77}
\color{white} tehnika
  &\color{white} kanalnog prepletača 
    & \color{white}\multirow{-2}{*}{\emph{I} kanal} 
      & \color{white}\multirow{-2}{*}{\emph{Q} kanal}\\
      \hline \hline 
BSPK 
  & $x_{0}$ 
    & $x_{0}$ 
      & - \\ 
\end{tabular}
\end{document}
leandriis
  • 62,593
0

With {NiceTabular} of nicematrix (≥ 6.11).

\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{nicematrix}

\begin{document}

\doublerulesepcolor{white} \begin{NiceTabular}{cccc}[cell-space-limits=2pt] \hline\hline \RowStyle[color=white,rowcolor=[RGB]{77,77,77}]{} \Block{}{Modulacijska \ tehnika} & \Block{}{Biti na izlazu \ kanalnog prepletača} & \emph{I} kanal & \emph{Q} kanal \ \hline \hline BSPK & $x_{0}$ & $x_{0}$ & - \end{NiceTabular}

\end{document}

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

Output of the above code

F. Pantigny
  • 40,250