1

I would like to create a tabular table by using the following code.

\documentclass[journal]{IEEEtran}
\usepackage{tabularx}
\usepackage{booktabs}
\renewcommand{\arraystretch}{1.25}
\noindent\begin{tabularx}{\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}

Here is the result.

enter image description here

Questions: (1) How to make sure all the table fit in the two column template? (2) How can I add more row in the table?

Thank you.

  • 1
    You should replace \textwidth with \linewidth as I suggested in the other thread. The difference is that \textwidth returns the width of the text body spanning over both columns, while \linewidth returns the width of the current box (in this case a the relevant column). Do you want to break the tabular over several columns? – Jasper Habicht Mar 01 '23 at 09:31
  • I thought \columnwidth works too? – User23456234 Mar 01 '23 at 09:33
  • 2
    @User23456234 Yes, it does. \linewidth returns the width of the current outer box, therefore it would also work inside a \parbox. In this case, both should return the same value. – Jasper Habicht Mar 01 '23 at 09:35

1 Answers1

2

I suggest you (a) set the width of the tabularx environment to \columnwidth and (b) allow line-breaking in column 1 as well, by switching from an l to a p column type. To allow a line break in the header of column 1, I suggest you change Place/Transition to Place\slash Transition.

When working with the IEEEtran document class, I further suggest you employ a package, such as newtxmath, that provides a Times Roman math font. I would also try to give the table a more open and inviting "look", by getting rid of all vertical lines and creating fewer, but well-spaced horizontal rules

enter image description here

\documentclass[journal]{IEEEtran}
\usepackage{newtxtext,newtxmath} % Times Roman text and math fonts
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{ragged2e} % for \RaggedRight macro

\newlength\mylen \settowidth\mylen{Transition} % target width of column 1

\begin{document} %\renewcommand{\arraystretch}{1.25} % <-- I wouldn't do that

\noindent \begin{tabularx}{\columnwidth} {@{} >{\RaggedRight}p{\mylen} >{\RaggedRight}X c @{}} \toprule Place\slash 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$ \ \addlinespace item 31 & item 32 & item 33 \ \bottomrule \end{tabularx}

\end{document}

Mico
  • 506,678