如何实现整个表格的两列垂直对齐?

如何实现整个表格的两列垂直对齐?

平均能量损失

\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}

并显示:

enter image description here

我怎样才能使第一个表格与第二个表格对齐?

答案1

您可以使用\needspace来确保新部分和小页面(表格[H])适合同一列。或者只需\newpage在 之前添加\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}

答案2

您可以使用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}

enter image description here

相关内容