1

I want the positions of texts in the last row (2\pi and 4\pi) to be in the middle of the row. Everything else is fine and should be kept unchanged.

enter image description here

\usepackage{array,bm,amsmath}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}


\begin{table}
\caption{Comparisons between the 0-$\pi$ qubit and the non-compact transmon/CPB.}
  \centering
  \begin{tabular}{|P{3.5cm}|P{2.2cm}|P{2.2cm}|}
    \hline
     & \textbf{Qubit potential periodicity}          & \textbf{Gate potential periodicity} \\ \hline
    \textbf{The 0-}$\bm{\pi}$ \textbf{qubit [7,18]}                 & $\pi$ & $2\pi$   \\ \hline
    \textbf{The non-compact transmon/CPB}                      &  $2\pi$  & $4\pi$   \\ \hline
  \end{tabular}
  \label{table:compare}
  \end{table}

How can I do that?

2
  • 1
    try m instead of p in second line above code as m{#1} – js bibra Jan 14 '20 at 5:17
  • In case the answer meets your requirement please tick the check mark on the left side of the answer – js bibra Jan 14 '20 at 7:05
2

The m will vertically center the contents of the cell/column

enter image description here

\documentclass{article}

\usepackage{array}
\usepackage{booktabs}  

\usepackage{array,bm,amsmath}
\newcolumntype{P}[1]{>{\centering\arraybackslash}m{#1}}


\begin{document}  

\begin{table}
\caption{Comparisons between the 0-$\pi$ qubit and the non-compact transmon/CPB.}
  \centering
  \begin{tabular}{|P{3.5cm}|P{2.2cm}|P{2.2cm}|}
    \hline
     & \textbf{Qubit potential periodicity}          & \textbf{Gate potential periodicity} \\ \hline
    \textbf{The 0-}$\bm{\pi}$ \textbf{qubit [7,18]}                 & $\pi$ & $2\pi$   \\ \hline
    \textbf{The non-compact transmon/CPB}                      &  $2\pi$  & $4\pi$   \\ \hline
  \end{tabular}
  \label{table:compare}
  \end{table}
\end{document}

EDIT

Some prettifying added

enter image description here

\begin{table}
\caption{Comparisons between the 0-$\pi$ qubit and the non-compact transmon/CPB.}
  \centering
   \begin{tabular}{P{3.5cm}P{2.2cm}P{2.2cm}}
    \hline
     & \multicolumn{2}{c}{\textbf{Potential periodicity}}\\ \cline{2-3} 
     & \textbf{Qubit}          & \textbf{Gate} \\ \hline
    \textbf{The 0-}$\bm{\pi}$ \textbf{qubit [7,18]} & $\pi$ & $2\pi$   \\ \hline
    \textbf{The non-compact transmon/CPB}           &  $2\pi$  & $4\pi$   \\ \hline
  \end{tabular}
  \label{table:compare}
  \end{table}
\end{document}
1

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