2

I have a table with six tabular inside. They all belong to one problem and caption.

I positioned them with \hfill, which works ok, but there could be more space between the two rows of tabular. \hspace did not work.

How can I increase the space?

Here is my TeX

\documentclass{scrartcl}
\usepackage{float}
\usepackage[a4paper, top=3cm,bottom=3cm,left=2.5cm,right=2cm]{geometry} 
\usepackage{bm}
\begin{document}

\begin{table}[H]
    \centering
    \begin{tabular}{c|cccc}
      \bm{$K_0$} & $Q_0$ & $Q_0$ & $\bar Q_0$ & $\bar Q_0$ \\
      \hline
      $Q_1$      & X & 1 & X & X \\
      $\bar Q_1$ & 1 & 1 & X & X \\
      \hline
      & $Q_2$ & $\bar Q_2$ & $\bar Q_2$ & $ Q_2$ 
    \end{tabular}
    \hfill
    \begin{tabular}{c|cccc}
      \bm{$J_0$} & $Q_0$ & $Q_0$ & $\bar Q_0$ & $\bar Q_0$ \\
      \hline
      $Q_1$      & X & X & 1 & 0 \\
      $\bar Q_1$ & X & X & 1 & 1 \\
      \hline
      & $Q_2$ & $\bar Q_2$ & $\bar Q_2$ & $ Q_2$ 
    \end{tabular}
    \hfill
    \begin{tabular}{c|cccc}
      \bm{$K_1$}  & $Q_0$ & $Q_0$ & $\bar Q_0$ & $\bar Q_0$ \\
      \hline
      $Q_1$      & X & 1 & 0 & 1 \\
      $\bar Q_1$ & X & X & X & X \\
      \hline
      & $Q_2$ & $\bar Q_2$ & $\bar Q_2$ & $ Q_2$ 
    \end{tabular}
    \hfill
    \begin{tabular}{c|cccc}
      \bm{$J_1$}  & $Q_0$ & $Q_0$ & $\bar Q_0$ & $\bar Q_0$ \\
      \hline
      $Q_1$      & X & X & X & X \\
      $\bar Q_1$ & 1 & 1 & 0 & X \\
      \hline
      & $Q_2$ & $\bar Q_2$ & $\bar Q_2$ & $ Q_2$ 
    \end{tabular}
    \hfill
    \begin{tabular}{c|cccc}
      \bm{$K_2$}  & $Q_0$ & $Q_0$ & $\bar Q_0$ & $\bar Q_0$ \\
      \hline
      $Q_1$      & X & X & X & 1 \\
      $\bar Q_1$ & 0 & X & 0 & X \\
      \hline
      & $Q_2$ & $\bar Q_2$ & $\bar Q_2$ & $ Q_2$ 
    \end{tabular}
    \hfill
    \begin{tabular}{c|cccc}
      \bm{$J_2$}  & $Q_0$ & $Q_0$ & $\bar Q_0$ & $\bar Q_0$ \\
      \hline
      $Q_1$      & X & 1 & X & X \\
      $\bar Q_1$ & X & X & 0 & X \\
      \hline
      & $Q_2$ & $\bar Q_2$ & $\bar Q_2$ & $ Q_2$ 
    \end{tabular}
    \hfill
    \caption{Caption}
    \label{tab:my_label}
\end{table}
\end{document}

This is what it looks like Example of my tables

2
  • Replace the third \hfill directive with an all-blank line (to induce a paragraph break) followed by \bigskip before the next \begin{tabular}. Oh, and omit the \centering objective since it doesn't do anything in your setup.
    – Mico
    Sep 26, 2020 at 15:08
  • Thank you very much!
    – wit4r7
    Sep 26, 2020 at 15:21

1 Answer 1

4

(re-posting my earlier comment as an answer, so that this query can be considered to have received an "official" answer).

To achieve your formatting objective, you should replace the third \hfill directive with an all-blank line (to induce a paragraph break) followed by \bigskip before the next instance of \begin{tabular}.

Some additional comments: (i) You may (actually, should) omit the \centering directive as it doesn't do anything in the your setup. (ii) The sixth and final \hfill directive should be deleted (or commented out). (iii) \bm (short for "bold math") should be employed only in math mode; hence, do replace \bm{$K_0$} with $\bm{K_0}$, \bm{$J_0$} with $\bm{J_0}$, etc. (iv) Using [H] to force the placement of the table "right here, damn it!" can actually be counterproductive; use [ht!] instead.

enter image description here

\documentclass{scrartcl}
\usepackage{float}
\usepackage[a4paper, vmargin=3cm, left=2.5cm, right=2cm]{geometry} 
\usepackage{bm}
\begin{document}

\begin{table}[H]
    %\centering % <-- not needed
    \begin{tabular}{c|cccc}
      $\bm{K_0}$ & $Q_0$ & $Q_0$ & $\bar Q_0$ & $\bar Q_0$ \\
      \hline
      $Q_1$      & X & 1 & X & X \\
      $\bar Q_1$ & 1 & 1 & X & X \\
      \hline
      & $Q_2$ & $\bar Q_2$ & $\bar Q_2$ & $ Q_2$ 
    \end{tabular}
    \hfill
    \begin{tabular}{c|cccc}
      $\bm{J_0}$ & $Q_0$ & $Q_0$ & $\bar Q_0$ & $\bar Q_0$ \\
      \hline
      $Q_1$      & X & X & 1 & 0 \\
      $\bar Q_1$ & X & X & 1 & 1 \\
      \hline
      & $Q_2$ & $\bar Q_2$ & $\bar Q_2$ & $ Q_2$ 
    \end{tabular}
    \hfill
    \begin{tabular}{c|cccc}
      $\bm{K_1}$  & $Q_0$ & $Q_0$ & $\bar Q_0$ & $\bar Q_0$ \\
      \hline
      $Q_1$      & X & 1 & 0 & 1 \\
      $\bar Q_1$ & X & X & X & X \\
      \hline
      & $Q_2$ & $\bar Q_2$ & $\bar Q_2$ & $ Q_2$ 
    \end{tabular}

    \bigskip % <-- new, in lieu of \hfill
    \begin{tabular}{c|cccc}
      $\bm{J_1}$  & $Q_0$ & $Q_0$ & $\bar Q_0$ & $\bar Q_0$ \\
      \hline
      $Q_1$      & X & X & X & X \\
      $\bar Q_1$ & 1 & 1 & 0 & X \\
      \hline
      & $Q_2$ & $\bar Q_2$ & $\bar Q_2$ & $ Q_2$ 
    \end{tabular}
    \hfill
    \begin{tabular}{c|cccc}
      $\bm{K_2}$  & $Q_0$ & $Q_0$ & $\bar Q_0$ & $\bar Q_0$ \\
      \hline
      $Q_1$      & X & X & X & 1 \\
      $\bar Q_1$ & 0 & X & 0 & X \\
      \hline
      & $Q_2$ & $\bar Q_2$ & $\bar Q_2$ & $ Q_2$ 
    \end{tabular}
    \hfill
    \begin{tabular}{c|cccc}
      $\bm{J_2}$  & $Q_0$ & $Q_0$ & $\bar Q_0$ & $\bar Q_0$ \\
      \hline
      $Q_1$      & X & 1 & X & X \\
      $\bar Q_1$ & X & X & 0 & X \\
      \hline 
      & $Q_2$ & $\bar Q_2$ & $\bar Q_2$ & $ Q_2$ 
    \end{tabular}
    %\hfill % <-- not needed either
    \caption{Caption}
    \label{tab:my_label}
\end{table}
\end{document}
1
  • 1
    Thanks. I really appreciate your afford here!
    – wit4r7
    Sep 27, 2020 at 11:42

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.