如何使用乳胶将 table 的长标题拆分为多行?

How to split the long headings of a table in multiple lines using latex?

如何使用乳胶创建 table 完全如下。 table 必须适合 2 列页面格式中的 1 列,但 table 标题太长,第一列中的内容也太长。所以,我想用粗体格式将第一列的列标题和内容拆分成多行。

不太清楚为什么 \makecell 不是 co-operating 用于加粗文本并设计一个实心边框,但这是我的乳胶代码:


\begin{table}[h]    
\begin{center}
\begin{tabularx}{\linewidth}{|L|L|L|L|L|}
\toprule

\makecell[lt]{Type} 
&\makecell[lt]{Financial \ benefit \ of the \users}
& \makecell[lt]{Financial\ loss of the \ users} 
&\makecell[lt]{Interruption \ of user’ \ daily activity}
&\makecell[lt]{Monetary \ reward \ for works}\

\midrule
\makecell[lt]{Category 1: \ Work in \ the retail \ sector}
 & \ding{51}
 & \ding{51}
 & 
 & \ding{51}\
 
\midrule
\makecell[lt]{Category 2: \ Work in \ the industry \ sector}
 & \ding{51}
 & \ding{51}
 & \ding{51}
 & \ding{51}\
 
\midrule
\makecell[lt]{Category 3: \ Work in \ the corporate \ sector}
 & \ding{51}
 & \ding{51}
 & \ding{51}
 & \ding{51}\
\bottomrule
\end{tabularx}
\end{center}
\end{table}

package array 为您提供了一种新的表格单元格类型

p={fixed width}

使用这种细胞类型,您可以定义两种新的细胞类型来满足您的比对要求:

\newcolumntype{F}[1]{%
    >{\raggedright\arraybackslash\hspace{0pt}}p{#1}}%
\newcolumntype{T}[1]{%
    >{\centering\arraybackslash\hspace{0pt}}p{#1}}%

完整代码:

\documentclass{article}

\usepackage{array}

\newcolumntype{F}[1]{%
    >{\raggedright\arraybackslash\hspace{0pt}}p{#1}}%
\newcolumntype{T}[1]{%
    >{\centering\arraybackslash\hspace{0pt}}p{#1}}%

\begin{document}

\begin{table}
\begin{tabular}{|F{0.2\textwidth}|T{0.2\textwidth}|T{0.2\textwidth}|T{0.2\textwidth}|T{0.2\textwidth}|}
\hline
\textbf{\hfil Type}&
\textbf{Financial benefit of the users}&
\textbf{Financial loss of the users }&
\textbf{Interruption of user daily activity}&
\textbf{Monetary reward for works}\ 
\hline
\textbf{Category 1: Work in  the retail  sector } &\textbf{v}&&v&v \
\hline
\textbf{Category 2: Work in  the industry  sector} &v&v&v&v \  
\hline
\textbf{Category 3: Work in  the corporate  sector}  &&v&v&v \
\hline
\end{tabular}
\end{table}

\end{document}