Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to have an itemize inside one of the columns in a tabularx, but when trying to compile this code:

\begin{table}
\begin{tabularx}{\linewidth}{>{\setlength\hsize{.2\hsize}}X|>{\setlength\hsize{1.8\hsize}}X|>{\setlength\hsize{0.3\hsize}}X}
\textbf{Req.} & \textbf{Description} & \textbf{Priority} \\ \hline \hline
\textbf{FR1} & \textbf{Starting application and logging in:}The user has to be able to start the application and authorize himself against an authorizing mechanism. & High \\ \hline
\textbf{FR2} & \textbf{Send a message to another user:}The user has to be able send a simple message via regular email protocols to a recipient of own choice. & High \\ \hline
\textbf{FR3} & \textbf{Browse received messages:} The user has to be able to browse all messages he has received. & High \\ \hline
\textbf{FR4} & \textbf{Browse sent messages:} The user has to be able to browse all messages he has sent, and see the status of a sent message, where the relevant statuses are “message delivered” and “message read”. & High \\ \hline
\textbf{FR5} & \textbf{Viewing address book:} The user has to be able to view the address book with all contacts, so that he is able to choose a recipient from a list when he wants to send a message. & High \\ \hline
\textbf{FR6} & \textbf{Marking messages with a grade of importance:}The user has to be able to set Security Label, Message Priority and Message Type on a message, so that the receiver of the message knows who the message is intended for, how important it is and in what environment it is is of interest. The Message Priority will decide how intrusive XOXOmail is, that is, how much ihe app takes over the phone in order to show the user that a message has arrived.  & High \\ \hline
\textbf{FR7} & \textbf{Sending and receiving message with attachments:}The user has to be able to add an attachment to the message, so that the recipient gets the attachment as well as the message. By opening the message, the attachments will also show. & Medium \\ \hline
\textbf{FR8} & \textbf{Answer, delete and forward messages:}The user has to be able to, by clicking on a message, choose if he wants to answer, delete or forward the message, and be brought to the correct screen for doing the selected action. & Medium \\ \hline
\textbf{FR9} & \textbf{Send instant message:}The user has to be able to, via very few screen interactions, send an instant message with a predefined security label and priority, to a predefined list of recipients. & Medium \\ \hline
\textbf{FR10} & \textbf{Settings menu:}The user has to be able to alter the following settings: 
\begin{itemize}
\item{}Change default values of dropdown menus in the New Message window.
\item{}What the lowest security priority is before the message is sent via SMS
\item{}Setting text size in GUI, e.g. on received message text.
\end{itemize}  & Low
\end{tabularx}
\caption{Functional requirements} \label{tab:functionalreq}
\end{table}

I'll get this error message:

! LaTeX Error: Something's wrong--perhaps a missing \item.

I would really appreciate some help!

share|improve this question
    
I think it works fine: Source, Output. –  Silex Oct 9 '12 at 11:06
    
Also works fine for me. Please provide a full minimal working example and which engine you use on what OS. –  Tom Bombadil Oct 9 '12 at 11:28
    
No, I think, it is not fine. The table is too long, see the page number inside the table (in the itemize list). I would suggest to swich to longtable. –  Kurt Oct 9 '12 at 11:32
    
@Kurt: you are right, but that is easily fixed. See the links in my previous comment. Also: it's not the error he was looking for. –  Silex Oct 9 '12 at 12:06

3 Answers 3

It seems, the itemize environment only recognizes the original \hsize calculated by tabularx and ignores the local redefinition in the column description.

It works correctly, if you specify the column width manually (by using p-columns) or if you use only one X-column:

\documentclass[a4paper]{scrartcl}

\usepackage{tabularx}

\begin{document}
\begin{table}
% calculate width of p-column manually:
% \begin{tabular}{p{0.1\linewidth}|p{0.78\linewidth}|p{0.1\linewidth}}
% or use only 1 X-column:
\begin{tabularx}{\linewidth}{c|X|l}
\textbf{Req.} & \textbf{Description} & \textbf{Priority} \\ \hline \hline
\textbf{FR1} & \textbf{Starting application and logging in:}The user has to be able to start the application and authorize himself against an authorizing mechanism. & High \\ \hline
\textbf{FR2} & \textbf{Send a message to another user:}The user has to be able send a simple message via regular email protocols to a recipient of own choice. & High \\ \hline
\textbf{FR3} & \textbf{Browse received messages:} The user has to be able to browse all messages he has received. & High \\ \hline
\textbf{FR4} & \textbf{Browse sent messages:} The user has to be able to browse all messages he has sent, and see the status of a sent message, where the relevant statuses are “message delivered” and “message read”. & High \\ \hline
\textbf{FR5} & \textbf{Viewing address book:} The user has to be able to view the address book with all contacts, so that he is able to choose a recipient from a list when he wants to send a message. & High \\ \hline
\textbf{FR6} & \textbf{Marking messages with a grade of importance:}The user has to be able to set Security Label, Message Priority and Message Type on a message, so that the receiver of the message knows who the message is intended for, how important it is and in what environment it is is of interest. The Message Priority will decide how intrusive XOXOmail is, that is, how much ihe app takes over the phone in order to show the user that a message has arrived.  & High \\ \hline
\textbf{FR7} & \textbf{Sending and receiving message with attachments:}The user has to be able to add an attachment to the message, so that the recipient gets the attachment as well as the message. By opening the message, the attachments will also show. & Medium \\ \hline
\textbf{FR8} & \textbf{Answer, delete and forward messages:}The user has to be able to, by clicking on a message, choose if he wants to answer, delete or forward the message, and be brought to the correct screen for doing the selected action. & Medium \\ \hline
\textbf{FR9} & \textbf{Send instant message:}The user has to be able to, via very few screen interactions, send an instant message with a predefined security label and priority, to a predefined list of recipients. & Medium \\ \hline
\textbf{FR10} & \textbf{Settings menu:}The user has to be able to alter the following settings: 
\begin{itemize}
\item{}Change default values of dropdown menus in the New Message window.
\item{}What the lowest security priority is before the message is sent via SMS
\item{}Setting text size in GUI, e.g. on received message text.
\end{itemize}  & Low
% \end{tabular}
\end{tabularx}
\caption{Functional requirements} \label{tab:functionalreq}
\end{table}
\end{document}

enter image description here

share|improve this answer
    
If you add a \usepackage{showframe} you will see that you do not have a real A4 paper (standard is, I guess, letter?). If I run the MWE with showframe the header of the table is outside the frame (I also got the corresponding warning). –  Kurt Oct 9 '12 at 12:01
    
@Kurt I cannot reproduce your findings. My MWE shows the right A4 dimensions (atleast in Adobe's PDF reader). I get a "float too large" warning, though. But as far as I can tell, this caused by the table caption running out of the text frame. –  hakaze Oct 9 '12 at 12:57
    
I meant the warning, because the float is too large for A4. –  Kurt Oct 9 '12 at 17:36

If you modify the widths of X columns you must ensure that you don't change the total width, so it needs to add up to 3 in this case. Also for display lists to work you need to reset \linewidth as well as \hsize.

enter image description here

\documentclass{article}
\usepackage{tabularx}

\begin{document}

\begin{table}
\small
\noindent
\begin{tabularx}{\linewidth}{>{\setlength\hsize{.2\hsize}}X|>{\setlength\hsize{2.5\hsize}\setlength\linewidth{\hsize}}X|>{\setlength\hsize{.3\hsize}}X}
\textbf{Req.} & \textbf{Description} & \textbf{Priority} \\ \hline \hline
\textbf{FR1} & \textbf{Starting application and logging in:}The user has to be able to start the application and authorize himself against an authorizing mechanism. & High \\ \hline
\textbf{FR2} & \textbf{Send a message to another user:}The user has to be able send a simple message via regular email protocols to a recipient of own choice. & High \\ \hline
\textbf{FR3} & \textbf{Browse received messages:} The user has to be able to browse all messages he has received. & High \\ \hline
\textbf{FR4} & \textbf{Browse sent messages:} The user has to be able to browse all messages he has sent, and see the status of a sent message, where the relevant statuses are “message delivered” and “message read”. & High \\ \hline
\textbf{FR5} & \textbf{Viewing address book:} The user has to be able to view the address book with all contacts, so that he is able to choose a recipient from a list when he wants to send a message. & High \\ \hline
\textbf{FR6} & \textbf{Marking messages with a grade of importance:}The user has to be able to set Security Label, Message Priority and Message Type on a message, so that the receiver of the message knows who the message is intended for, how important it is and in what environment it is is of interest. The Message Priority will decide how intrusive XOXOmail is, that is, how much ihe app takes over the phone in order to show the user that a message has arrived.  & High \\ \hline
\textbf{FR7} & \textbf{Sending and receiving message with attachments:}The user has to be able to add an attachment to the message, so that the recipient gets the attachment as well as the message. By opening the message, the attachments will also show. & Medium \\ \hline
\textbf{FR8} & \textbf{Answer, delete and forward messages:}The user has to be able to, by clicking on a message, choose if he wants to answer, delete or forward the message, and be brought to the correct screen for doing the selected action. & Medium \\ \hline
\textbf{FR9} & \textbf{Send instant message:}The user has to be able to, via very few screen interactions, send an instant message with a predefined security label and priority, to a predefined list of recipients. & Medium \\ \hline
\textbf{FR10} & \textbf{Settings menu:}The user has to be able to alter the following settings: 
\begin{itemize}
\item{}Change default values of dropdown menus in the New Message window.
\item{}What the lowest security priority is before the message is sent via SMS
\item{}Setting text size in GUI, e.g. on received message text.
\end{itemize}  & Low
\end{tabularx}
\caption{Functional requirements} \label{tab:functionalreq}
\end{table}


\end{document}
share|improve this answer
    
If you add a \usepackage{showframe} you will see that you do not have a real A4 paper (standard is, I guess, letter?). If I run the MWE with showframe the header of the table is outside the frame (I also got the corresponding warning). Conclusion: table too long, perhaps switch to longtable? –  Kurt Oct 9 '12 at 11:59
    
@Kurt yes US letter is the standard size, but perhaps the OP wanted that rather than A4? The table was too long for either as posted which was why I added \small in my version. –  David Carlisle Oct 9 '12 at 12:02
    
I also think the table is too long. And we do not know the class the asker is using. My system (as a German) uses A4 which looks realy ugly with this table. I think it is important to show this point. For me I would suggest to switch the environment for the table to be safe. –  Kurt Oct 9 '12 at 12:13
    
But at the font sized use (\small) longtable wouldn't make it look much different (as it fits on a page anyway) and using X columns with longtable requires more extensive changes. –  David Carlisle Oct 9 '12 at 12:18

As usual, you can also use tabu:

\documentclass[DIV=14,font=12pt]{scrartcl}
\usepackage{tabu}

\begin{document}
\enlargethispage{3\baselineskip}

\extrarowsep=2pt
\tabulinesep=2pt
\noindent
\begin{table}
\small
\begin{tabu} to \linewidth {>{\bfseries}X[0.35l]|X[5l]|X[0.5l]}
\everyrow{\tabucline[.2pt]-}
\rowfont\bfseries
Req.  & Description & Priority \\  \hline
FR1   & \textbf{Starting application and logging in:}\ 
        The user has to be able to start the application
        and authorize himself against an authorizing
        mechanism.                                        & High \\ 
FR2  &  \textbf{Send a message to another user:}\ The user
        has to be able send a simple message via regular
        email protocols to a recipient of own choice.     & High \\ 
FR3  &  \textbf{Browse received messages:}\ The user 
        has to be able to browse all messages he has
        received.                                         & High \\ 
FR4  &  \textbf{Browse sent messages:}\ The user has 
        to be able to browse all messages he has 
        sent, and see the status of a sent message, 
        where the relevant statuses are “message 
        delivered” and “message read”.                   & High \\ 
FR5  &  \textbf{Viewing address book:}\ The user 
        has to be able to view the address book with 
        all contacts, so that he is able to choose a 
        recipient from a list when he wants to send 
        a message.                                       & High \\ 
FR6  &  \textbf{Marking messages with a grade of 
        importance:}\ The user has to be able to set 
        Security Label, Message Priority and Message 
        Type on a message, so that the receiver of the 
        message knows who the message is intended for, 
        how important it is and in what environment 
        it is is of interest. The Message Priority will 
        decide how intrusive XOXOmail is, that is, 
        how much the app takes over the phone in order 
        to show the user that a message has arrived.     & High \\ 
FR7 &   \textbf{Sending and receiving message with 
        attachments:}\ The user has to be able to add 
        an attachment to the message, so that the 
        recipient gets the attachment as well as the 
        message. By opening the message, the 
        attachments will also show.                     & Medium \\ 
FR8 &   \textbf{Answer, delete and forward messages:}\ 
        The user has to be able to, by clicking on a 
        message, choose if he wants to answer, delete
        or forward the message, and be brought  to the 
        correct screen for doing the selected action.   & Medium \\ 
FR9 &   \textbf{Send instant message:}\ The user has 
         to be able to, via very few screen 
         interactions, send an instant message with a 
         predefined security label and priority, to a
         predefined list of recipients.                 & Medium \\ 
FR10 &   \textbf{Settings menu:}\ The user has to be
         able to alter the following settings:
         \begin{itemize}
            \item Change default values of 
                  dropdown menus in the New Message 
                  window
            \item What the lowest security priority 
                  is before the message is sent via SMS
            \item Setting text size in GUI, e.g. on 
                  received message text.
         \end{itemize}                                   & Low 
\end{tabu}
\caption{Functional requirements} \label{tab:functionalreq}
\end{table}

\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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