1

I have to make a table with nested columns in the first row.

\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
\multicolumn{14}{|c|}{Truth table}\\
\hline
\multicolumn{4}{|c|c|c|c}{Inputs} %error here
 & \multicolumn{10}{|c|c|c|c|c|c|c|c|c|c|}{Outputs}\\
\hline
$A_3$ & $A_2$ & $A_1$ & $A_0$ & $\bar{Y_0}$ & $\bar{Y_1}$ & $\bar{Y_2}$ & $\bar{Y_3}$ & $\bar{Y_4}$ & $\bar{Y_5}$ & $\bar{Y_6}$ & $\bar{Y_7}$ & $\bar{Y_8}$ & $\bar{Y_9}$\\
\hline 
\end{tabular}
\end{solution}

When trying to compile, it's throwing me the following error on the fifth line of the code showed earlier.

Missing \endgroup inserted

I have closed the curly brackets. What am I missing?

  • Your example ends with \end{array} but starts with \begin{tabular}. While tabular is an array effectively this might cause the error; however, your example is a fragment only, we don't know how solution is defined – user31729 Dec 4 '17 at 15:23
  • ... and with \end{solution} – user121799 Dec 4 '17 at 15:23
  • @ChristianHupfer, that's an older version, it's tabular now, but i still have the same error. – Cornul11 Dec 4 '17 at 15:25
  • @marmot, that's from a block started earlier. – Cornul11 Dec 4 '17 at 15:25
  • @Cornul11: Well, you should post the code that you're using right from the start, not something that were used 'ages' ago ;-) Also post complete documents, not just fragments – user31729 Dec 4 '17 at 15:26
2

Try this:

 \documentclass{article}
    \usepackage{array}
    \setlength{\extrarowheight}{2pt}
    \begin{document}
    \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
    \hline
    \multicolumn{14}{|c|}{Truth table}\\
    \hline
    \multicolumn{4}{|c|}{Inputs} & \multicolumn{10}{c|}{Outputs}\\
    \hline
    $A_3$ & $A_2$ & $A_1$ & $A_0$ & $\bar{Y_0}$ & $\bar{Y_1}$ & $\bar{Y_2}$ & $\bar{Y_3}$ & $\bar{Y_4}$ & $\bar{Y_5}$ & $\bar{Y_6}$ & $\bar{Y_7}$ & $\bar{Y_8}$ & $\bar{Y_9}$\\
    \hline 
    \end{tabular}
    \end{document}
|improve this answer|||||
  • 1
    This seems to work now. Even after analyzing documentation for the \multicolumn command, i didn't notice that we have to mention the format for only one cell. – Cornul11 Dec 4 '17 at 15:29
  • 1
    With \multicolumn{4}{|c|}{text} you're creating a single cell spanning four columns, containing text aligned centered and the cell being preceded and followed by a |. Since it's a single cell, more than one alignment doesn't make sense. – Henk Metselaar Dec 4 '17 at 15:52
  • @HenkMetselaar, yes, now i get it. – Cornul11 Dec 4 '17 at 16:30

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.