6

I am writing in IEEEtran double-column environment and have a table like the following. I need to increase the row height so the equations in the second column can fit in. I tried simply to use \renewcommand{\arraystretch}{2.5} where every thing can fit in but the vertical alignment is not very good. For example, the first row are not aligned and it seems that each cell is not perfectly vertically middle aligned if you look closely. They are very slightly a little higher or a little lower. My question is, besides increasing the row height, how do I make each cell perfectly middle align in the vertical direction?

The tables shown below are of \arraystretch 1 and 2.5, respectively.

enter image description here

The codes for producing the tables are

\begin{table} 
\caption{arraystretch = 1}

\renewcommand{\arraystretch}{1}
\centering{}%
\begin{tabular}{ccc}
\toprule 
\multirow{1}{*}{No.} & Equations & Current phasors\tabularnewline
\midrule
\multirow{2}{*}{1} & \multirow{2}{*}{$\begin{cases}
i_{A}=1\\
i_{B}=2\\
i_{C}=3
\end{cases}$} & 1, 2, 3\tabularnewline
\cmidrule{3-3} 
 &  & 4, 5, 6\tabularnewline
\midrule
\multirow{2}{*}{2} & \multirow{2}{*}{$\begin{cases}
i_{A}=4\\
i_{B}=5\\
i_{C}=6
\end{cases}$} & 1, 2, 3\tabularnewline
\cmidrule{3-3} 
 &  & 4, 5, 6\tabularnewline
\bottomrule
\end{tabular}
\end{table}

\begin{table}
\caption{arraystretch = 2.5}

\renewcommand{\arraystretch}{2.5}
\centering{}%
\begin{tabular}{ccc}
\toprule 
\multirow{1}{*}{No.} & Equations & Current phasors\tabularnewline
\midrule
\multirow{2}{*}{1} & \multirow{2}{*}{$\begin{cases}
i_{A}=1\\
i_{B}=2\\
i_{C}=3
\end{cases}$} & 1, 2, 3\tabularnewline
\cmidrule{3-3} 
 &  & 4, 5, 6\tabularnewline
\midrule
\multirow{2}{*}{2} & \multirow{2}{*}{$\begin{cases}
i_{A}=4\\
i_{B}=5\\
i_{C}=6
\end{cases}$} & 1, 2, 3\tabularnewline
\cmidrule{3-3} 
 &  & 4, 5, 6\tabularnewline
\bottomrule
\end{tabular}
\end{table}   
7

The structure of your table is sufficiently unusual to warrant typesetting the contents of each cell as a separate custom, vertically centered tabular environment in its own right.

In the following example, I define two such custom tabular-like environments:

  • \mytabC, if the width of the tabular is supposed to equal the natural width of the cell's contents, and

  • \mytabP, if the width of the tabular is supposed to be a fixed length -- say, the width of the contents of the corresponding header cell.

In the following screenshot, the upper row employs \mytabC for columns 1 and 2, and \mytabP for the third column. The lower row employs \mytabC for all 3 columns. I provide both types of solutions as it's not clear to me whether the \midrule is supposed to span the full width of the cell or if its width is supposed to be the natural width of the cell's contents.

enter image description here

\documentclass{IEEEtran}
\usepackage{booktabs,amsmath,array,ragged2e}
%% Some housekeeping:
\newlength\mylen
\newcolumntype{P}[1]{>{\Centering\arraybackslash}p{#1}}
%% Macros to generate two custom 'tabular' environments:
\newcommand\mytabC[1]{%
   \begin{tabular}[c]{@{} c @{}} #1 \end{tabular}}
\newcommand\mytabP[2]{\settowidth{\mylen}{#1}%
   \begin{tabular}[c]{@{} P{\mylen} @{}} #2 \end{tabular}}

\begin{document} 
\begin{table} 
\caption{arraystretch = 1}
\centering

\begin{tabular}{@{}ccc@{}}
\toprule 
No. & Equations & Current phasors\\
\midrule
\mytabC{1} & 
\mytabC{$\begin{cases} i_{A}=1\\i_{B}=2\\i_{C}=3 \end{cases}$} & 
\mytabP{Current phasors}{1, 2, 3\\ \midrule 4, 5, 6}\\
\midrule
\mytabC{2} & 
\mytabC{$\begin{cases} i_{D}=4\\i_{E}=5\\i_{F}=6 \end{cases}$} & 
\mytabC{7, 8, 9\\ \midrule 0, 1, 2}\\
\bottomrule
\end{tabular}
\end{table}
\end{document}
  • Thank you for the answer. In the last column, \midrule is supposed to span the full width of the cell. The cells "1, 2, 3" and "4, 5, 6" are not vertically centered, is there a way to center those? – nanjun May 7 at 16:05
  • @nanjun - Thanks for this clarification. (You screenshots didn't hint at you requirement for the contents of the final column.) Real quick: Should the midrule in the final column always be centered vertically within the cell, or might there be cases where this isn't the case? – Mico May 7 at 20:10
  • Thank you again. The midrule in the last column would always be centered vertically within the larger cell. The smaller cell above and below the midrule also need to be vertically centered. Right now the row " No. 1" in your answer looks good except that the two samller cells "1, 2, 3" and "4, 5, 6" are not vertically centered themselves. In other words, within each cell, no matter it is a small cell or large cell, the content are always meant to be vertically centered. – nanjun May 7 at 20:30
  • @nanjun - To solve your updated formatting requirements for the material in column 3, it would be really helpful to know what kind of material may be expected to occur in column 2. E.g., will this updated material always consist of a cases environment with exactly 3 rows? Please advise. – Mico May 8 at 13:10
  • Yes, @Mico. The 2nd column will always consist of a cases environment with exactly 3 rows. – nanjun May 8 at 15:03

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.