0

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:

enter image description here

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

2

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
1

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}

enter image description here

  • 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

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.