2

I want to start two tables with different number of rows at the same height.

Basically, I want the horizontal lines to be at the same height.

This is the current code I have:

\adjustbox{valign=h}{
    \begin{tabular}{ c | c c } 
     NFA & 0 & 1 \\ 
     \hline
     $q_0$ & $[q_0q_1]$ & $q_0$ \\ 
     $q_1$ & $\varnothing$ & $q_2$ \\
     $q_2$ & $q_3$ & $q_3$ \\
     $q_3$ & $\varnothing$ & $\varnothing$ \\ 
    \end{tabular}
    \quad
    \begin{tabular}{ c | c c } 
     DFA & 0 & 1 \\ 
     \hline
     $q_0$ & $[q_0q_1]$ & $q_0$ \\ 
     $[q_0q_1]$ & $[q_0q_1]$ & $[q_0q_2]$ \\
     $[q_0q_2]$ & $[q_0q_1q_3]$ & $[q_0q_3]$ \\
     $[q_0q_1q_3]$ & $[q_0q_1]$ & $[q_0q_2]$ \\ 
     $[q_0q_3]$ & $[q_0q_1]$ & $[q_0q_1]$ \\
    \end{tabular}
    }
1
  • What's \adjustbox supposed to do? And valign=h is not a valid option.
    – egreg
    Commented Oct 31, 2015 at 21:42

1 Answer 1

3

If you add the optional argument [t] to each tabular they will be vertically aligned by the first line.

As egreg mentions in a comment, the \adjustbox likely doesn't have any effect, and valign=h is not a valid option for it anyway, so I removed it.

enter image description here

\documentclass{article}
\usepackage{amssymb}
\begin{document}
    \begin{tabular}[t]{ c | c c } 
     NFA & 0 & 1 \\ 
     \hline
     $q_0$ & $[q_0q_1]$ & $q_0$ \\ 
     $q_1$ & $\varnothing$ & $q_2$ \\
     $q_2$ & $q_3$ & $q_3$ \\
     $q_3$ & $\varnothing$ & $\varnothing$ \\ 
    \end{tabular}%
    \quad
    \begin{tabular}[t]{ c | c c } 
     DFA & 0 & 1 \\ 
     \hline
     $q_0$ & $[q_0q_1]$ & $q_0$ \\ 
     $[q_0q_1]$ & $[q_0q_1]$ & $[q_0q_2]$ \\
     $[q_0q_2]$ & $[q_0q_1q_3]$ & $[q_0q_3]$ \\
     $[q_0q_1q_3]$ & $[q_0q_1]$ & $[q_0q_2]$ \\ 
     $[q_0q_3]$ & $[q_0q_1]$ & $[q_0q_1]$ \\
    \end{tabular}
\end{document}
3
  • I'm not sure \adjustbox has any influence on the output (apart adding unwanted spaces at either end, because of missing %). By the way, valign=h doesn't seem to be a valid option.
    – egreg
    Commented Oct 31, 2015 at 21:40
  • @egreg I considered removing it, but I didn't know the context, so I left it. You are of course correct about h, so that's another argument for removing it altogether. Will edit, thanks. Commented Oct 31, 2015 at 21:54
  • You could also add a % in the line before \quad. ;-)
    – egreg
    Commented Oct 31, 2015 at 22:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .