2

How can I make this table look prettier and more elegant than this and do you think it's better to make it fit into one or two columns? I am also opened to making it span over two columns if you think this is better. enter image description here

\documentclass[10pt,conference]{IEEEtran} 
\IEEEoverridecommandlockouts


\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{algorithm}
\usepackage{graphicx}
\usepackage{changepage}


%\usepackage{algpseudocode} 
\usepackage{lipsum}
\usepackage{ctable}% http://ctan.org/pkg/ctable
\usepackage{color, colortbl}
\newcommand{\var}{\textit}
\newcommand{\proc}{\textbf}
\newcommand{\prop}{\texttt}
\newcommand{\plusplus}{{+}{+}}% Other options: 
\newcommand*\ita[1]{\textit{#1}}
%\usepackage{xcolor}                             % changed
\usepackage{array, booktabs, makecell, multirow}% new
\definecolor{Gray}{gray}{0.9}
\usepackage{textcomp}


\usepackage{booktabs}
\newcommand\mytab[1]{\begin{tabular}[t]{@{}c@{}} #1 \end{tabular}}
\newcommand\mc[2]{\multicolumn{#1}{c}{#2}}
\renewcommand{\algorithmiccomment}[1]{//#1}



\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
\begin{document}
\begin{table}[]
\caption{XCallers and XCallees for Methods in Figure}
\label{tab:XCallersXCalleesExample}
\begin{tabular}{|c|c|c|c|c|c|c|c|}
    \hline
    \textbf{Method\#} & \textbf{1-StartGPS} & \textbf{2-Start} & 
\textbf{\begin{tabular}[c]{@{}c@{}}3-Reserve\\ Seat\end{tabular}} & 
\textbf{\begin{tabular}[c]{@{}c@{}}4-Set\\ Passenger\\ Info\end{tabular}} & 
\textbf{5-Start} & \textbf{\begin{tabular}[c]{@{}c@{}}6-Book\\ 
 Ticket\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}7-Book\\ 
 Ticket\end{tabular}} \\ \hline
    \textbf{XCallers} & \begin{tabular}[c]{@{}c@{}}2-Start \\ 5- 
 Start\end{tabular} & Empty & \begin{tabular}[c]{@{}c@{}}6-BookTicket \\ 7- 
 BookTicket\end{tabular} & Empty & Empty & \begin{tabular}[c]{@{}c@{}}4- 
 Set\\ Passenger\\ Info\end{tabular} & \begin{tabular}[c]{@{}c@{}}4-Set\\ 
 Passenger\\ Info\end{tabular} \\ \hline
    \textbf{XCallees} & Empty & 1-StartGPS & Empty & \begin{tabular}[c] 
  {@{}c@{}}6-BookTicket \\ 7-BookTicket\end{tabular} & 1-StartGPS & 3- 
 ReserveSeat & 3-ReserveSeat \\ \hline
 \end{tabular}
 \end{table}
 \end{document}
4
  • 1
    Please make your code compilable by adding the documentclass and the relevant packages. Regarding "prettier", you might want to follow the suggestions by Mico (usage of less lines, usage of booktabs) on your previous question.
    – leandriis
    May 9, 2019 at 14:38
  • Common for beautiful(subjective) tables is that they have very few lines - certainly not vertical lines like that. tex.stackexchange.com/questions/112343/beautiful-table-samples May 9, 2019 at 14:55
  • Regarding the table being too wide for the column, you could play around with decreasing the font size and the \tabcolsep. However, I doubt, that the table will fit into a single column without applying some more changes. More methods can be found here: My table doesn't fit; what are my options?
    – leandriis
    May 9, 2019 at 14:55
  • 1
    yur table is far to wide to be fit in present form in one column. you have tow options: (i) set it over two columns (with ˙table*` float) or rewrite table on the way, that you interchange columns and rows.
    – Zarko
    May 9, 2019 at 15:13

3 Answers 3

5

what is nice looking table is personal opinion. apparently (as follows from accepted answers on your previous question) you don't like professional looking tables.

Anyway, as i told you in comment, your table is to wide that can be fit into one column as it is. so, according to my taste i suggest you to write it over two columns as follows:

\documentclass[10pt,conference]{IEEEtran}
\IEEEoverridecommandlockouts

\usepackage{textcomp}
\usepackage{booktabs, makecell, multirow, tabularx}
\renewcommand\theadfont{\small\bfseries}
\renewcommand\theadgape{}
\usepackage{stfloats}

\usepackage{lipsum}
\begin{document}
\lipsum[1]
    \begin{table*}[b]
    \centering
\caption{XCallers and XCallees for Methods in Figure}
\label{tab:XCallersXCalleesExample}
\begin{tabular}{>{\bfseries}l *{7}{c}}
    \toprule
\thead[bl]{Method \#}
    & \thead[b]{StartGPS}       & \thead[b]{Start}
    & \thead[b]{Reserve Seat}   & \thead[b]{Set\\ Passenger Info}
    & \thead[b]{Start}          & \thead[b]{Book Ticket}
    & \thead[b]{Book Ticket}                                \\
    & (1)   & (2)   & (3)   & (4)   & (5)   & (6)   & (7)   \\
    \midrule
XCallers
    & \makecell{2-Start\\
                5-Start}        & Empty
    & \makecell{6-BookTicket\\
                7-BookTicket}   & Empty
    & Empty                     & 4-Set Passenger Info
    & 4-Set Passenger Info                              \\
    \addlinespace
XCallees
    & Empty                     & 1-StartGPS
    & Empty                     & \makecell{6-BookTicket\\
                                            7-BookTicket}
    & 1-StartGPS                & 3-ReserveSeat
    & 3-ReserveSeat                                     \\
    \bottomrule
\end{tabular}
    \end{table*}
\lipsum
\end{document}

enter image description here

or consider the second possibilities: interchange rows and columns in your table:

enter image description here

\documentclass[10pt,conference]{IEEEtran}
\IEEEoverridecommandlockouts

\usepackage{textcomp}
\usepackage{booktabs, makecell, multirow, tabularx}
\setcellgapes{2pt}
\renewcommand\theadfont{\small\bfseries}
\renewcommand\theadgape{}
\usepackage{stfloats}

\usepackage{lipsum}
\begin{document}
\lipsum[1]
    \begin{table}[htb]
    \centering
    \makegapedcells
\caption{XCallers and XCallees for Methods in Figure}
\label{tab:XCallersXCalleesExample}
\begin{tabular}{>{\bfseries}l ll }
    \toprule
Method \#       & \thead{XCallers}      & \thead{XCallees}      \\
    \midrule
1-StartGPS      & \makecell[tl]{2-Start\\
                                5-Start}& Empty                 \\ 
2-Start         & Empty                 & 1-StartGPS            \\ 
3-Reserve Seat  & \makecell[tl]{6-BookTicket\\
                                4-Set Passenger Info}   
                                        & Empty                 \\
4-Start         & Empty                 & 4-Set Passenger Info  \\
5-Start         & Empty                 & 1-StartGPS            \\
6-Book Ticket   & 4-Set Passenger Info  & 3-ReserveSeat         \\
7-Book Ticket   & 4-Set Passenger Info  & 3-ReserveSeat         \\
    \bottomrule
\end{tabular}
    \end{table}
\lipsum
\end{document}
4
  • @user3406764 This is how professional, really nice tables look like. Classical, clean layout, no distracting clutter.
    – Sveinung
    May 9, 2019 at 19:02
  • @Sveinung, thank you for nice words!
    – Zarko
    May 9, 2019 at 19:07
  • In my opinion, the first table (over two columns) is the best, It blends very well to the page layout, and placing at the bottom of the page is a good choice. you may consider removing the side bearing by placing @{} in the beginning and end of the preamble.
    – Sveinung
    May 9, 2019 at 19:17
  • @Sveinung, you are right. in my first attempt i consider this, but letter i remove them, now don't know why. i will wait for while to op response and than correct table code as you suggest.
    – Zarko
    May 9, 2019 at 19:26
2

Here there is my simple proposal. With %<----adding you can see my changhes. The most important is the use the \resizebox to decrease the size of the table.

enter image description here

\documentclass[10pt,conference]{IEEEtran} 
\IEEEoverridecommandlockouts
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{algorithm}
\usepackage{graphicx}
\usepackage{changepage}

\usepackage{lipsum}%<-------------------adding

%\usepackage{algpseudocode} 
\usepackage{lipsum}
\usepackage{ctable}% http://ctan.org/pkg/ctable
\usepackage{color, colortbl}
\newcommand{\var}{\textit}
\newcommand{\proc}{\textbf}
\newcommand{\prop}{\texttt}
\newcommand{\plusplus}{{+}{+}}% Other options: 
\newcommand*\ita[1]{\textit{#1}}
%\usepackage{xcolor}                             % changed
\usepackage{array, booktabs, makecell, multirow}% new
\definecolor{Gray}{gray}{0.9}
\usepackage{textcomp}


\usepackage{booktabs}
\newcommand\mytab[1]{\begin{tabular}[t]{@{}c@{}} #1 \end{tabular}}
\newcommand\mc[2]{\multicolumn{#1}{c}{#2}}
\renewcommand{\algorithmiccomment}[1]{//#1}



\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}


\begin{document}


\lipsum[1]
\begin{table}[]
\centering%<-------------------adding
\caption{XCallers and XCallees for Methods in Figure}
\label{tab:XCallersXCalleesExample}
\resizebox{0.45\textwidth}{!}{\begin{tabular}{|c|c|c|c|c|c|c|c|}%<-------------------adding
    \hline
    \textbf{Method\#} & \textbf{1-StartGPS} & \textbf{2-Start} & 
\textbf{\begin{tabular}[c]{@{}c@{}}3-Reserve\\ Seat\end{tabular}} & 
\textbf{\begin{tabular}[c]{@{}c@{}}4-Set\\ Passenger\\ Info\end{tabular}} & 
\textbf{5-Start} & \textbf{\begin{tabular}[c]{@{}c@{}}6-Book\\ 
 Ticket\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}7-Book\\ 
 Ticket\end{tabular}} \\ \hline
    \textbf{XCallers} & \begin{tabular}[c]{@{}c@{}}2-Start \\ 5- 
 Start\end{tabular} & Empty & \begin{tabular}[c]{@{}c@{}}6-BookTicket \\ 7- 
 BookTicket\end{tabular} & Empty & Empty & \begin{tabular}[c]{@{}c@{}}4- 
 Set\\ Passenger\\ Info\end{tabular} & \begin{tabular}[c]{@{}c@{}}4-Set\\ 
 Passenger\\ Info\end{tabular} \\ \hline
    \textbf{XCallees} & Empty & 1-StartGPS & Empty & \begin{tabular}[c] 
  {@{}c@{}}6-BookTicket \\ 7-BookTicket\end{tabular} & 1-StartGPS & 3- 
 ReserveSeat & 3-ReserveSeat \\ \hline
 \end{tabular}}
 \end{table}
\lipsum[2-3]
\end{document}
4
  • 2
    Personally, I would not recommend using \resizebox in order to resize tables as this method will lead to inconsistent font sizes throughtout the document.
    – leandriis
    May 9, 2019 at 15:06
  • @leandriis I agree with you. However, it depends on the number of tables that are inserted in the document. If there are two or three, it could be a solution. Surely mine is just a proposal, and it certainly won't be the best :-)
    – Sebastiano
    May 9, 2019 at 15:08
  • 1
    @Sebastiano, do you see wiert.me/2014/04/03/… ? on web can find more similar presentation about table settings. in answers of Mico, Bernard (to name only a few) you can see many nice designed tables. they are worth to red. (i nullify dovn-wote).
    – Zarko
    May 9, 2019 at 16:20
  • @Zarko You're a very dear friend. I always thank you very much. I have tried to give my interpretation of the solution. :-)
    – Sebastiano
    May 9, 2019 at 20:56
2

Don't attempt to use \resizebox for tables, this a really bad advice to give to users because it will give very ugly results.

If you want to keep this layout (the clean layout from Zarko is much better) manually choose a smaller font size and reduce the inter column space:

\documentclass[10pt,conference]{IEEEtran} 
\IEEEoverridecommandlockouts


\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{algorithm}
\usepackage{graphicx}
\usepackage{changepage}


%\usepackage{algpseudocode} 
\usepackage{lipsum}
\usepackage{ctable}% http://ctan.org/pkg/ctable
\usepackage{color, colortbl}
\newcommand{\var}{\textit}
\newcommand{\proc}{\textbf}
\newcommand{\prop}{\texttt}
\newcommand{\plusplus}{{+}{+}}% Other options: 
\newcommand*\ita[1]{\textit{#1}}
%\usepackage{xcolor}                             % changed
\usepackage{array, booktabs, makecell, multirow}% new
\definecolor{Gray}{gray}{0.9}
\usepackage{textcomp}


\usepackage{booktabs}
\newcommand\mytab[1]{\begin{tabular}[t]{@{}c@{}} #1 \end{tabular}}
\newcommand\mc[2]{\multicolumn{#1}{c}{#2}}
\renewcommand{\algorithmiccomment}[1]{//#1}



\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
\begin{document}
\begin{table}[]
\caption{XCallers and XCallees for Methods in Figure}
\label{tab:XCallersXCalleesExample}
\tiny
\setlength{\tabcolsep}{2.7pt}
\begin{tabular}{|c|c|c|c|c|c|c|c|}
    \hline
    \textbf{Method\#} & \textbf{1-StartGPS} & \textbf{2-Start} & 
\textbf{\begin{tabular}[c]{@{}c@{}}3-Reserve\\ Seat\end{tabular}} & 
\textbf{\begin{tabular}[c]{@{}c@{}}4-Set\\ Passenger\\ Info\end{tabular}} & 
\textbf{5-Start} & \textbf{\begin{tabular}[c]{@{}c@{}}6-Book\\ 
 Ticket\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}7-Book\\ 
 Ticket\end{tabular}} \\ \hline
    \textbf{XCallers} & \begin{tabular}[c]{@{}c@{}}2-Start \\ 5- 
 Start\end{tabular} & Empty & \begin{tabular}[c]{@{}c@{}}6-BookTicket \\ 7- 
 BookTicket\end{tabular} & Empty & Empty & \begin{tabular}[c]{@{}c@{}}4- 
 Set\\ Passenger\\ Info\end{tabular} & \begin{tabular}[c]{@{}c@{}}4-Set\\ 
 Passenger\\ Info\end{tabular} \\ \hline
    \textbf{XCallees} & Empty & 1-StartGPS & Empty & \begin{tabular}[c] 
  {@{}c@{}}6-BookTicket \\ 7-BookTicket\end{tabular} & 1-StartGPS & 3- 
 ReserveSeat & 3-ReserveSeat \\ \hline
 \end{tabular}
 \end{table}
 \end{document}
1
  • personally is a bad business card of a user criticizing harshly the work of another. I have simply written my own thought.
    – Sebastiano
    May 9, 2019 at 20:52

You must log in to answer this question.

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