1

I have a problem with a table which I am using for a publication. The code is as follows:

\begin{table}[htbp]
    \centering
    \captionof{table}{Summary}
%    \begin{tabularx}{0.5\textwidth}{| c | X | X |}
\begin{tabularx}{0.5\textwidth}{| c |>{\centering\arraybackslash}X | >{\centering\arraybackslash}X |}
      \hline
        Reference     & Focus     & Relevance to Model     \\ \hline
        \rule{0pt}{4ex} [4]         & \tabitem Model\newline\tabitem  peformance benchmarks        & Relevant         \\ \hline
         \rule{0pt}{4ex} [5]         & \tabitem Deployment Algorithms \newline \tabitem Analysis of algorithmic efficiency        & Relevant         \\ \hline
    \end{tabularx}
\end{table}

Now this results in the output included in the attached image. I need a center alignment for the heading row, but for the remaining rows, I would like to choose a center alignment for the first column, and a left alignment for the rest. Also, it is evident from the image that the bullets are not aligned properly. I guess this has something to do with the \tabitem. I tried replacing it with itemize but that just made things worse. So I would really appreciate a workaround to this problem.

generated table

2

The OP left much undefined by providing snippets of code, rather than an MWE, so I improvised.

I redefined your \tabitem to exit vertical mode, and I placed the space following the bullet within the \llap itself. I also made the list raggedright. I added extra column space before the 2nd column, to offset the \llaped bullet.

Finally, I reduced the \rule height from 4ex to 2.5ex to reduce the overhead space in the row entries, and removed the space between the rule and the [4], [5] entries, to achieve true horizontal centering.

\documentclass{article}
\usepackage{caption,tabularx}
\newcommand{\tabitem}{\leavevmode\llap{\textbullet~}\raggedright}
\begin{document}
\begin{table}[htbp]
    \centering
    \captionof{table}{Summary}
    \begin{tabularx}{0.8\textwidth}{| c | @{\hspace{3ex}}X | X |}
      \hline
        Reference     & \hfil Focus\hfil     & \hfil Relevance to Model\hfil     \\ \hline
        \rule{0pt}{2.5ex}[4]         & \tabitem Model\newline\tabitem  peformance benchmarks        & Relevant         \\ \hline
         \rule{0pt}{2.5ex}[5]         & \tabitem Deployment Algorithms \newline \tabitem Analysis of algorithmic efficiency        & Relevant \\ \hline
    \end{tabularx}
\end{table}
\end{document}

enter image description here

In the comments, David suggests you use an actual list environment (like itemize). Below, I show how that might be done, though adjustments also have to be made here to allow for the extra space that such environments introduce.

\documentclass{article}
\usepackage{caption,tabularx}
\begin{document}
\begin{table}[htbp]
    \centering
    \captionof{table}{Summary}
    \begin{tabularx}{0.8\textwidth}{| c | X | X |}
      \hline
        Reference     & \hfil Focus\hfil     & \hfil Relevance to Model\hfil     \\ \hline
        \rule{0pt}{4ex}[4]         & 
\vspace{-17pt}\raggedright
\begin{itemize}\item Model\item  peformance benchmarks\end{itemize}        
& Relevant         \\ \hline
         \rule{0pt}{4ex}[5]         & 
\vspace{-17pt}\raggedright
\begin{itemize}\item Deployment Algorithms \item Analysis of algorithmic efficiency\end{itemize}
& Relevant \\ \hline
    \end{tabularx}
\end{table}
\end{document}

enter image description here

  • sorry about the inadequate code provided due to inexperience....and thank you immensely for the fully working solution....appreciate greatly your time... – Vinod Nov 4 '14 at 0:33
  • @Vinod Next time try to include a minimum working example that demonstrates the issue. It not only saves the time of those trying to help you, it often points directly to the actual problem. It also shows that you are serious about learning something rather than just saying "Can someone please do this for me..." Welcome to the site. Many fruitful returns! – Steven B. Segletes Nov 4 '14 at 0:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.