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}
    }
  • What's \adjustbox supposed to do? And valign=h is not a valid option. – egreg Oct 31 '15 at 21:42
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}
  • 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 Oct 31 '15 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. – Torbjørn T. Oct 31 '15 at 21:54
  • You could also add a % in the line before \quad. ;-) – egreg Oct 31 '15 at 22:11

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.