0

I used the following code

\begin{table}[h]
\centering\setlength{\extrarowheight}{2pt}
\centering
\begin{tabular}{ |c|c|c|c|  }
\hline
\multicolumn{2}{|c|}{Binary Variables} & Index status & Output\\
\cline{1-2}                                            
$a_i$  &   $b_j$  &     &  \\
\hline
1 & 1 & $i=j$ & $\uparrow \uparrow$ \\
\hline    
1 & 0 & $i \neq j$ & $\uparrow -$ \\
\hline
0 & 1 & $i \neq j$ & $- \uparrow$ \\
\hline
0 & 0 & $i=j$ & $- -$ \\
\hline
\end{tabular}
\end{table}

to create the following table: enter image description here

I would like to have equal space in columns $a_i$ and $b_j$. How can I do this

1 Answer 1

2

You just have to use two p{..} columns ofthe relevant width. Here is a code:

\documentclass{article}
\usepackage{fourier}
\usepackage{array}
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{calc, multirow}
\newlength{\cellwd}
\setlength{\cellwd}{\widthof{Binary Variables}}

\begin{document}

\begin{table}[h]
\centering\setlength{\extrarowheight}{2pt}
\centering
\begin{tabular}{ |*{2}{>{\centering}p{0.5\cellwd}|}c|c| }
\hline
\multicolumn{2}{|c|}{Binary Variables} & \multirowcell{2}{Index status} & \multirowcell{2}{Output}\\
\cline{1-2}
$a_i$ & $b_j$ & & \\
\hline
1 & 1 & $i=j$ & $\uparrow \uparrow$ \\
\hline
1 & 0 & $i ≠ j$ & $\uparrow -$ \\
\hline
0 & 1 & $i ≠ j$ & $- \uparrow$ \\
\hline
0 & 0 & $i=j$ & $- -$ \\
\hline
\end{tabular}
\end{table}

\end{document} 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.