4

I used the following code to generate a table, but I have faced the problem that clarifies in the attached picture. Any solutions?

\documentclass[11pt,journal,compsoc]{IEEEtran}
\usepackage{filecontents}
\usepackage [noadjust]{cite}
\usepackage{caption}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{enumitem}

\usepackage{multirow}
\usepackage{booktabs}

\usepackage{array}
\usepackage{graphicx}
\usepackage{lipsum}

%
\ifCLASSOPTIONcompsoc
  % IEEE Computer Society needs nocompress option
  % requires cite.sty v4.0 or later (November 2003)
 % \usepackage[nocompress]{cite}
\else
  % normal IEEE
  %\usepackage{cite}
\fi




% *** GRAPHICS RELATED PACKAGES ***
%
\ifCLASSINFOpdf
  % \usepackage[pdftex]{graphicx}
  % declare the path(s) where your graphic files are
  % \graphicspath{{../pdf/}{../jpeg/}}
  % and their extensions so you won't have to specify these with
  % every instance of \includegraphics
  % \DeclareGraphicsExtensions{.pdf,.jpeg,.png}
\else
  % or other class option (dvipsone, dvipdf, if not using dvips). graphicx
  % will default to the driver specified in the system graphics.cfg if no
  % driver is specified.
  % \usepackage[dvips]{graphicx}
  % declare the path(s) where your graphic files are
  % \graphicspath{{../eps/}}
  % and their extensions so you won't have to specify these with
  % every instance of \includegraphics
  % \DeclareGraphicsExtensions{.eps}
\fi


\newcommand\MYhyperrefoptions{bookmarks=true,bookmarksnumbered=true,
pdfpagemode={UseOutlines},plainpages=false,pdfpagelabels=true,
colorlinks=true,linkcolor={black},citecolor={black},urlcolor={black},
pdftitle={Bare Demo of IEEEtran.cls for Computer Society Journals},%<!CHANGE!
pdfsubject={Typesetting},%<!CHANGE!
pdfauthor={Michael D. Shell},%<!CHANGE!
pdfkeywords={Computer Society, IEEEtran, journal, LaTeX, paper,
             template}}%<^!CHANGE!




\begin{document}

    \begin{table*}[t]
    \begin{tabular}{|c|c|c|c|c|c|c|c|}
    \hline 
    Study ID & Study title & First author name  & Year & Source  & Usability Factors & Development Area  & No, of Citation \\ 
    \hline 
    S1 & Persuasion for stronger passwords: Motivation and pilot study & Alain Forget & 2008 & ACM & Memorability and  efficiency & User Authentication & 26 \\ 
    \hline 
    S2 & VibraPass - Secure Authentication Based on Shared Lies   & Alexander De Luca & 2008 & ACM & Memorability and easy to use  & User Authentication & 52 \\ 
    \hline 
    \end{tabular} 


\end{document} 

enter image description here

4
  • 2
    Your cell content is too long... Try p{4cm} instead of c column types where appropiate, e.g. in Study title
    – user31729
    Jan 1, 2015 at 22:32
  • 1
    The same for the 6th column.
    – Sigur
    Jan 1, 2015 at 22:34
  • 2
    And besides all: 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.
    – user31729
    Jan 1, 2015 at 22:35
  • In addition to the column changes... consider to remove at least the vertical lines and the the lower \hline statements
    – user31729
    Jan 1, 2015 at 23:00

3 Answers 3

6

Two principal ways to reduce (improve) the width of the table:

Either use p{...} columns or C{...} columns with a new column type (vertically and horizontally centered`.

Some lines are not wrapped, because I did not use hyphenation there.

The horizontal and vertical lines do not improve the readability of the table, but this is not the issue here....

\documentclass{article}

\usepackage{array}



\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}

\begin{document}



\begin{table*}[t]
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline 
Study ID & Study title & First author name  & Year & Source  & Usability Factors & Development Area  & No, of Citation \\ 
\hline 
S1 & Persuasion for stronger passwords: Motivation and pilot study & Alain Forget & 2008 & ACM & Memorability and  efficiency & User Authentication & 26 \\ 
\hline 
S2 & VibraPass - Secure Authentication Based on Shared Lies   & Alexander De Luca & 2008 & ACM & Memorability and easy to use  & User Authentication & 52 \\ 
\hline 
\end{tabular} 
\end{table*}


\begin{table*}[t]
\begin{tabular}{|C{1cm}|C{3cm}|C{1.5cm}|*{2}{C{1.0cm}|}C{1.5cm}|C{1.5cm}|C{1.0cm}|}
\hline 
Study ID & Study title & First author name  & Year & Source  & Usability Factors & Develop-ment Area  & No, of Citation \\ 
\hline 
S1 & Persuasion for stronger passwords: Motivation and pilot study & Alain Forget & 2008 & ACM & Memorability and  efficiency & User Authentication & 26 \\ 
\hline 
S2 & VibraPass - Secure Authentication Based on Shared Lies   & Alexander De Luca & 2008 & ACM & Memorability and easy to use  & User Authentication & 52 \\ 
\hline 
\end{tabular} 
\end{table*}


\begin{table*}[t]
\begin{tabular}{|p{1cm}|p{3cm}|p{1.5cm}|*{2}{p{1.0cm}|}p{1.5cm}|p{1.5cm}|p{1.0cm}|}
\hline 
Study ID & Study title & First author name  & Year & Source  & Usability Factors & Develop-ment Area  & No, of Citation \\ 
\hline 
S1 & Persuasion for stronger passwords: Motivation and pilot study & Alain Forget & 2008 & ACM & Memorability and  efficiency & User Authentication & 26 \\ 
\hline 
S2 & VibraPass - Secure Authentication Based on Shared Lies   & Alexander De Luca & 2008 & ACM & Memorability and easy to use  & User Authentication & 52 \\ 
\hline 
\end{tabular} 
\end{table*}


\end{document}

enter image description here

6

This version makes use of booktabs, tabularx and array.

  • array is used for commands to define some new column types.
    • C{width} defines a centred column of width width.
  • tabularx is used to make best use of the full width available for the table.
    • R is an 'expandable' column (like X) but with \raggedright alignment.
  • booktabs is used for nicer rules and better spacing.
    • Vertical lines between columns are dropped, in line with standard recommendations. See booktabs documentation for details.

Note that the use of caption is problematic: if used with this class, it issues warnings that it ought not be!

\documentclass[11pt,journal,compsoc]{IEEEtran}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{array}

\newcolumntype{R}{>{\raggedright\arraybackslash}X}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\begin{document}

  \begin{table*}[t]
    \begin{tabularx}{\linewidth}{cRC{.1\linewidth}*{2}{c}*{2}{C{.125\linewidth}}C{.065\linewidth}}
      \toprule
      Study ID & \multicolumn{1}{c}{Study title} & First author name  & Year & Source  & Usability  Factors & Development Area & No, of Citation \\
      \midrule
      S1 & Persuasion for stronger passwords: Motivation and pilot study & Alain Forget & 2008 & ACM & Memorability and  efficiency & User Authentication & 26 \\
      \cmidrule(lr){1-8}
      S2 & VibraPass - Secure Authentication Based on Shared Lies   & Alexander De Luca & 2008 & ACM & Memorability and easy to use  & User Authentication & 52 \\
      \bottomrule
    \end{tabularx}
  \end{table*}

\end{document}

adjusted tabular

6

A solution using \makecell, tabularx and cellspace:

\documentclass[11pt,journal,compsoc]{IEEEtran}
\usepackage{filecontents}
\usepackage [noadjust]{cite}
\usepackage{caption}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{enumitem}

\usepackage{multirow}
\usepackage{booktabs}

\usepackage{array}
\usepackage{graphicx}
\usepackage{lipsum}

%
\ifCLASSOPTIONcompsoc
% IEEE Computer Society needs nocompress option
% requires cite.sty v4.0 or later (November 2003)
% \usepackage[nocompress]{cite}
\else
% normal IEEE
%\usepackage{cite}
\fi




% *** GRAPHICS RELATED PACKAGES ***
%
\ifCLASSINFOpdf
% \usepackage[pdftex]{graphicx}
% declare the path(s) where your graphic files are
% \graphicspath{{../pdf/}{../jpeg/}}
% and their extensions so you won't have to specify these with
% every instance of \includegraphics
% \DeclareGraphicsExtensions{.pdf,.jpeg,.png}
\else
% or other class option (dvipsone, dvipdf, if not using dvips). graphicx
% will default to the driver specified in the system graphics.cfg if no
% driver is specified.
% \usepackage[dvips]{graphicx}
% declare the path(s) where your graphic files are
% \graphicspath{{../eps/}}
% and their extensions so you won't have to specify these with
% every instance of \includegraphics
% \DeclareGraphicsExtensions{.eps}
\fi


\newcommand\MYhyperrefoptions{bookmarks=true,bookmarksnumbered=true,
pdfpagemode={UseOutlines},plainpages=false,pdfpagelabels=true,
colorlinks=true,linkcolor={black},citecolor={black},urlcolor={black},
pdftitle={Bare Demo of IEEEtran.cls for Computer Society Journals},%<!CHANGE!
pdfsubject={Typesetting},%<!CHANGE!
pdfauthor={Michael D. Shell},%<!CHANGE!
pdfkeywords={Computer Society, IEEEtran, journal, LaTeX, paper,
         template}}%<^!CHANGE!
\usepackage{makecell}
\usepackage{cellspace}
\setlength\cellspacetoplimit{5pt}
\setlength\cellspacebottomlimit{5pt}
\addparagraphcolumntypes{X}
\usepackage{ragged2e}
\renewcommand{\tabularxcolumn}[1]{>{\RaggedRight}m{#1}}

\begin{document}

\begin{table*}[t]\setlength\tabcolsep{5pt}
\begin{tabularx}{\linewidth}{|c|S{X}|c|c|c|X|c|c|}
\hline
\thead{Study\\ ID} & \thead{Study title} & \thead{First author name} & \thead{Year} & \thead{Source} & \thead{Usability Factors} & \thead{Development Area} & \thead{No of \\ Citation} \\
\hline
S1 & Persuasion for stronger passwords: Motivation and pilot study & Alain Forget & 2008 & ACM & Memorability and efficiency & User Authentication & 26 \\
\hline
S2 & VibraPass -- Secure Authentication Based on Shared Lies & Alexander De Luca & 2008 & ACM & Memorability and easy to use & User Authentication & 52 \\
\hline
\end{tabularx}
\end{table*}
\end{document} 

enter image description here

You must log in to answer this question.

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