1

The following code:

\documentclass{article}


\begin{document}

\begin{table}[t]
\caption{Practically Used Deep CNN Networks}
\label{table1}
\begin{center}
\begin{tabular}{c|c|c|c|c}
NET_WIT_DATASET  &  CNN_layer  &  in_a_network  &  combining_from_2_networks  &  combining_from_3_networks
\\ \hline \\
LeNet   MNIST            &  conv1       &  20       &   15      &   15 \\
LeNet MNIST            &  conv2     &  50       &  59       &   59 \\
AlexNet CIFAR10 &conv1      &24     &15     &16 \\
AlexNet CIFAR10 &conv2      &96     &107        &107 \\
\end{tabular}
\end{center}
\label{table1}
\end{table}

\end{document}

reported the error:

Missing $ inserted. $ l.204 NET_ WIT_DATASET & CNN_layer &

3
  • 2
    Replace _ with \_.
    – leandriis
    Jun 14, 2020 at 20:04
  • 1
    Unrelated but in order to avoid additional vertical white space, you might also want to replace \begin{center} with \centering and remove \end{center}. Also a second orrucance of \label is not needed.
    – leandriis
    Jun 14, 2020 at 20:06
  • Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. Jun 14, 2020 at 20:12

1 Answer 1

1

I suggest you (a) encase the header strings that contain _ (underscore) characters in \url directives to "neuter" the meaning of the special characters, (b) employ a tabularx environment to permit automatic line breaking in the final two columns, and (c) load the xurl package to permit line-breaking in URL strings at arbitrary points.

Incidentally, are these underscore characters really required? Can you maybe make do without them? If you can dispense with them, there would be no need for the \url wrappers, greatly simplifying the typesetting task.

Oh, if your document loads the hyperref package, you should change \url to \nolinkurl (since the strings aren't "real" URL strings...).

enter image description here

\documentclass{article}
\usepackage{xurl,tabularx,ragged2e,booktabs}
\newcolumntype{C}{>{\Centering}X}
\begin{document}

\begin{table}[t]
\urlstyle{same}
\setlength\tabcolsep{4pt}
\caption{Practically Used Deep CNN Networks}
\label{table1}
\begin{tabularx}{\textwidth}{@{} llcCC @{}}
\toprule
\url{NET_WIT_DATASET}  &  
\url{CNN_layer}  &  
\url{in_a_network}  &  
\url{combining_from_2_networks}  &  
\url{combining_from_3_networks} \\ 
\midrule
LeNet MNIST     &  conv1    &  20   &  15   &  15 \\
LeNet MNIST     &  conv2    &  50   &  59   &  59 \\
AlexNet CIFAR10 &  conv1    &  24   &  15   &  16 \\
AlexNet CIFAR10 &  conv2    &  96   & 107   & 107 \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}

You must log in to answer this question.

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