# \heading not defined in creating table using tabularx

I am using a template given to me by the department. You can see the full template here.

I have used a package called tabularx, and in overleaf I get following error

I could not copy paste because many times doing Ctrl+C and Ctrl+V for error in overleaf I had cursor changing and I could not do a Ctrl+C , I could select the error by right click on touchpad and drag but when I do a right click to copy it did not give an option to copy to search in Google.

here the table code of latex thesis.tex file has following

\documentclass[twoside,mtp]{iiitg}

\usepackage{tabularx}
\usepackage{fancyhdr}
\fancyfoot{}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\chaptername \ \thechapter \ \ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection \ \ #1}}
\clearemptydoublepage
\input{texfiles/chapter2}


and in chapter 2 I have added this table

    \begin{table}[htbp]
\centering
\begin{tabularx}{\textwidth}{| X | X | X |}
\hline
0         & 2        & 4         \\ \hline
1         & 3        & 5         \\ \hline
\end{tabularx}


and as I could understand from the screenshot I posted above use of \heading is creating problems. In the github link of thesis template I gave above in thesis.tex they have not used \usepackage{tabularx} but I have added this line in tex file and then in the chapter2 I am doing this table manipulation. So in this case how can I get rid of these errors and warnings in this example.

• If you look at the error message, you will see that the command \heading is not defined. Comment out the first line of your tabular and see if the document compiles. May 6 '20 at 12:05
• Where you added is the wronag place. It should be loaded in document preamble. Where you define \heading?. Your code fragment work fine, if I define own \heading. So, problem is in part of your document hidden from us. Please (again) provide a MWE, which reproduce your problem. May 6 '20 at 12:11
• Where is defined heading? This is error which your receive from compiler. May 6 '20 at 12:17
• If you use thead from makcell instread your not defined heading your code work fine: \documentclass{article} \usepackage{makecell, tabularx} \begin{document} \begin{table}[ht] \begin{tabularx}{\textwidth}{| X | X | X |} \hline \thead{Alpha} & \thead{Beta} & \thead{Gamma} \\ \hline 0 & 2 & 4 \\ \hline 1 & 3 & 5 \\ \hline \end{tabularx} \end{table} \end{document} May 6 '20 at 12:19
• Error, which you mentioned in question title is not caused by your code fragment. SO please consider to change it since it is misleading. Your error is clearly reported: heading is not defined. May 6 '20 at 12:32

You have two problems:

• If you receive error as you stated in your question title, means that you not load the tabularx package.
• If you leaded the tabularx package, than question title is misleading. Please, consider to change it accordingly.
• Error, showed in question is clearly reported: \heading is not defined. This means, that you need to define it somewhere, the best place for this is document preamble that can be used anywhere in the document.
• It is unknown, what you expect from this command, but I guessing that something like this:

which is produced by the following MWE:

\documentclass{article}
\usepackage{makecell, tabularx}

\begin{document}
\begin{table}[ht]
\begin{tabularx}{\textwidth}{| X | X | X |}
\hline
0               & 2             & 4             \\ \hline
1               & 3             & 5             \\ \hline
\end{tabularx}
\end{table}
\end{document}


where thead command is define in the makecell package.

Finally, a general tip: load only those packages which you really need. Define new commands as few as possible.

Addendum: regarding vertical lines in table: many people here (including me) prefer tables without vertical lines. To our opinions they looks nicer and more "professional":

Above table is produced by:

documentclass{article}
\usepackage{booktabs, makecell, tabularx}

\begin{document}
\begin{table}[ht]
\begin{tabularx}{\textwidth}{ X X X }
\toprule
`