Create a Tabular Table

tables

I would like to develop a tabular table like this.
enter image description here

However, when I use the reference code from https://www.overleaf.com/learn/latex/Tables#Creating_a_simple_table_in_LaTeX , with code:

\documentclass{article}
\usepackage{tabularx}
\begin{document}
\begin{tabularx}{0.8\textwidth} { 
  | >{\raggedright\arraybackslash}X 
  | >{\centering\arraybackslash}X 
  | >{\raggedleft\arraybackslash}X | }
 \hline
 Place/Transition & Explanation & Time  \\
 \hline
 T_1 and T_(2(n+1))  & Robot operation which relates to loadlocks. Transition T_1indicates that wafer unloading from the loadlocks and T_(2(n+1)) means that the robot loads the wafer to the loadlocks. & w \\
\hline
 item 31  & item 32  & item 33 \\

\hline
\end{tabularx}
\end{document}

The result is as follows.

enter image description here

Perhaps, does anyone have any other reference to create a tabular table that I want, please?

When I Replace \begin{tabularx}{0.8\textwidth} by \noindent\begin{tabularx}{\linewidth} , here is the result:

enter image description here
Thank you in advance.

Best Answer

The problem is, as stated in the comments, that you omit the necessary syntax for math mode. Because of this, TeX will at some point read a _ which is only a valid character in math mode. Hence, it will switch to math mode automatically, but since it does not know where the math mode should end, it keeps typesetting in math mode which results in this strange output.

It is very easy to solve this problem by using the correct syntax for math mode. Since you don't need pragraphs in columns one and three, you could also switch to another column defintion:

\documentclass{article}
\usepackage{tabularx}

\begin{document}
\begin{tabularx}{0.8\textwidth} { |
  l |
  >{\raggedright\arraybackslash}X |
  c |
}
  \hline
  Place/Transition & Explanation & Time  \\
  \hline
  $T_1$ and $T_{2(n+1)}$  & Robot operation which relates to loadlocks. Transition $T_1$ indicates that wafer unloading from the loadlocks and $T_{2(n+1)}$ means that the robot loads the wafer to the loadlocks. & w \\
  \hline
  item 31 & item 32 & item 33 \\
  \hline
\end{tabularx}
\end{document}

enter image description here

An alternative solution could be created with the help of the booktabs package, which can help you reduce the amount of borders between cells:

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

\begin{document}
\renewcommand{\arraystretch}{1.25}
\begin{tabularx}{0.8\textwidth} { 
  l 
  >{\raggedright\arraybackslash}X 
  c 
}
  \toprule
  Place/Transition & Explanation & Time  \\
  \midrule
  $T_1$ and $T_{2(n+1)}$  & Robot operation which relates to loadlocks. Transition $T_1$ indicates that wafer unloading from the loadlocks and $T_{2(n+1)}$ means that the robot loads the wafer to the loadlocks. & w \\
  item 31 & item 32 & item 33 \\
  \bottomrule
\end{tabularx}
\end{document}

enter image description here


Note that you might want to replace 0.8\textwidth by \linewidth if you want to extend the table to the width of a text column in a two-column layout:

\documentclass[journal]{IEEEtran}
\usepackage{lipsum}
\usepackage{tabularx}

\begin{document}

\lipsum[1]

\noindent%
\begin{tabularx}{\linewidth} { |
  l |
  >{\raggedright\arraybackslash}X |
  c |
}
  \hline
  Place/Transition & Explanation & Time  \\
  \hline
  $T_1$ and $T_{2(n+1)}$  & Robot operation which relates to loadlocks. Transition $T_1$ indicates that wafer unloading from the loadlocks and $T_{2(n+1)}$ means that the robot loads the wafer to the loadlocks. & w \\
  \hline
  item 31 & item 32 & item 33 \\
  \hline
\end{tabularx}

\newpage

Right column

\end{document}

enter image description here

Related Question