如何在 tabularx 里面有一个 itemize

如何在 tabularx 里面有一个 itemize

我试图itemize在 a 中的一列内放置一个tabularx,但是在尝试编译此代码时:

\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}

我会收到此错误消息:

!LaTeX 错误:出现错误 — — 可能缺少 \item。

我将非常感激您的帮助!

答案1

如果修改列宽,X则必须确保不改变总宽度,因此在这种情况下需要将其加起来3。此外,要使显示列表正常工作,您需要重置\linewidth以及\hsize

在此处输入图片描述

\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}

答案2

看起来,itemize 环境只识别原始的\hsize计算tabularx而忽略了列描述中的本地重新定义。

如果您手动指定列宽(通过使用 p 列)或者仅使用一个 X 列,它就可以正常工作:

\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}

在此处输入图片描述

相关内容