1

I am having trouble formatting a wide table. Thanks to this answer my basic structure seems fine. But I find now that the text in one of the columns is too wide for the cell.

\documentclass{article}
\usepackage{booktabs,ragged2e,tabularx,geometry,amsfonts}
\begin{document}

\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}


\begin{table}[htbp]

    \caption{Lots of vertical rules}  \label{tab:a}
    \begin{tabularx}{\textwidth}{|*{7}{l|} *{3}{L|}}
        \hline
        Ref & \multicolumn{6}{c|}{Model Used}
        & Approach & Limitation & Goal \\
        \hline
        & MBTI & FFM & BFI & KTS & BTR & NEO-FFI 
        & \multicolumn{3}{l|}{} \\ 
        \hline
        [10] &  & &\checkmark & & & 
        & Interactive personality profiling approach 
        & Test were based on subjective evidences which may lead to uncertainty.
        & In order to propose a structure for effective software team structure. \\
        \hline

        [20] &  & & & & &\checkmark 
        & Quazi-Experiment 
        & This study is conducted with students which leads to ambiguity on difference in nature of students and software engineers.
        & In order to propose a structure for effective software team structure. \\
        \hline
        & & & & & & & & & \\ 
        \hline
    \end{tabularx}

\end{table}
\end{document}

The problem is that in the sell containing the text "Quazi-Experiment" the words are too long: they are sticking out past the right hand side of the cell. How can I prevent this?

9
  • this is the same question as your previous: tex.stackexchange.com/questions/429286/….
    – Zarko
    Commented Apr 30, 2018 at 9:00
  • apart from it being a duplicate, when asking questions please always post a complete example, not just a fragment, here for example the text may or may not be overfull depending how wide the table is which depends on \textwidth which you have not shown. Commented Apr 30, 2018 at 9:09
  • Thanks for your reply. but the text in my document is goint to the next cell. how can i resize my text in the cell. Commented Apr 30, 2018 at 9:10
  • @Zarko why is it a duplicate of that question? the original q used l columns, mico's answer there said to use X columns, and this question is using X but is a followup that line breaking is not right (it is probably a duplicate of a different question) Commented Apr 30, 2018 at 9:44
  • @DavidCarlisle, this question contain Mico answer from op previous question (which works.) regarding this, it is not duplicate. however, op ask for solving the same problem as in previous question (which is solved, however op had to consider preamble in Mico answer). now can be concluded, that is not clear what is the problem ...
    – Zarko
    Commented Apr 30, 2018 at 10:15

1 Answer 1

1

The following answer provides additional code in the setup of the L column type, to permit hyphenation of long words that occur at the very beginning of a cell.

enter image description here

\documentclass{article}
\usepackage{%geometry,
    tabularx, % for 'tabularx' env.
    ragged2e, % for '\RaggedRight' macro
    booktabs, % '\toprule' '\midrule', etc. 
    amssymb}  % for '\checkmark' macro
\newcolumntype{L}{>{\RaggedRight\arraybackslash\hspace{0pt}}X}
\usepackage[skip=0.333\baselineskip]{caption}

\begin{document}

\begin{table}[htbp]
\setlength\tabcolsep{3pt} % default value: 6pt
\caption{Lots of vertical rules}  \label{tab:a}
\begin{tabularx}{\textwidth}{ |l| *{6}{c|} *{3}{L|} }
    \hline
    Ref & \multicolumn{6}{c|}{Model Used}
    & Approach & Limitation & Goal \\
    \hline
    & MBTI & FFM & BFI & KTS & BTR & NEO- 
                    & \multicolumn{3}{l|}{} \\
    & & & & & & FFI & \multicolumn{3}{l|}{} \\
    \hline
    [10] & & & \checkmark & & &
    & Interactive personality profiling approach
    & Tests were based on subjective evidence, which may lead to uncertainty.
    & In order to propose a structure for effective software team structure. \\
    \hline
    [20] & & & & & & \checkmark
    & Quasi-\hspace{0pt}Experiment
    & This study is conducted with students which leads to ambiguity on difference in nature of students and software engineers.
    & In order to propose a structure for effective software team structure. \\
    \hline
    & & & & & & & & & \\
    \hline
\end{tabularx}
\end{table}
\end{document}

You must log in to answer this question.

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