# How can I do whole table vertical alignment in twocolumn?

MWE

\documentclass[a4paper,12pt]{book}
\usepackage{caption}
\usepackage{float}
\usepackage[color]{changebar}

\begin{document}

\newcommand{\greek}{
\begin{center}
\begin{table}[H]
\caption{Greek Alphabet}
\centering
\begin{tabular}{|c|}
\hline
\bf small\\
\hline
$\alpha$\\
$\beta$\\
$\gamma$\\
$\delta$\\
$\varepsilon$\\
$\zeta$\\
$\eta$\\
$\theta$\\
\textit{ı}\\
$\kappa$\\
$\lambda$\\
$\mu$\\
$\nu$\\
$\xi$\\
\textit{o}\\
$\pi$\\
$\rho$\\
$\sigma$\\
$\tau$\\
$\upsilon$\\
$\phi$\\
$\chi$\\
$\psi$ \\
$\omega$\\
\hline
\end{tabular}
\end{table}
\end{center}}

\twocolumn

\section{Greek}
\greek

\section{Table}
\greek

\end{document}


and it displayed:

How can I align the first table like the second table?

You can use \needspace to make sure the new section and minipage (table [H]) fit in the same column. Or just add a \newpage before \section.

\documentclass[a4paper,12pt]{book}
\usepackage{caption}
\usepackage{float}
\usepackage[color]{changebar}
\usepackage{needspace}

\begin{document}

\newcommand{\greek}{
\begin{center}
\begin{table}[H]
\caption{Greek Alphabet}
\centering
\begin{tabular}{|c|}
\hline
\bf small\\
\hline
$\alpha$\\
$\beta$\\
$\gamma$\\
$\delta$\\
$\varepsilon$\\
$\zeta$\\
$\eta$\\
$\theta$\\
\textit{ı}\\
$\kappa$\\
$\lambda$\\
$\mu$\\
$\nu$\\
$\xi$\\
\textit{o}\\
$\pi$\\
$\rho$\\
$\sigma$\\
$\tau$\\
$\upsilon$\\
$\phi$\\
$\chi$\\
$\psi$ \\
$\omega$\\
\hline
\end{tabular}
\end{table}
\end{center}}

\twocolumn

\section{Greek}
\greek

\setbox0=\vbox{%
\section{Table}
\greek}%
\needspace{\ht0}%
\unvbox0

\end{document}

• It's working. I also learned this package. – Özgür Sep 4 '18 at 14:52

You could use multicols:

\documentclass[a4paper,12pt]{book}
\usepackage{caption}
\usepackage{float}
\usepackage[color]{changebar}

\newcommand{\greek}{
\begin{center}
\begin{table}[H]
\caption{Greek Alphabet}
\centering
\begin{tabular}{|c|}
\hline
\bf small\\
\hline
$\alpha$\\
$\beta$\\
$\gamma$\\
$\delta$\\
$\varepsilon$\\
$\zeta$\\
$\eta$\\
$\theta$\\
\textit{ı}\\
$\kappa$\\
$\lambda$\\
$\mu$\\
$\nu$\\
$\xi$\\
\textit{o}\\
$\pi$\\
$\rho$\\
$\sigma$\\
$\tau$\\
$\upsilon$\\
$\phi$\\
$\chi$\\
$\psi$ \\
$\omega$\\
\hline
\end{tabular}
\end{table}
\end{center}}
\usepackage{multicol}

\begin{document}

\begin{multicols}{2}

\section{Greek}
\greek

\section{Table}
\greek

\end{multicols}
\end{document}


• my source code is not working. It's making the same mistake again. But your code is working. Nevertheless, I learned that it was such a solution. – Özgür Sep 4 '18 at 14:47