我该如何解决这个重叠文本行的问题?

我该如何解决这个重叠文本行的问题?
    \begin{table}
    \begin{center}
    \begin{tabular}{|p{0.5cm}|p{4cm}|p{4cm}|p{3cm}}
    \hline
    \multicolumn{4}{|c|}{Cost Breakdown} \\
    \hline
    No & Main Set & Cost Element & Unit costs  \\
    \hline
    \multirow{4}{*}{1} & \multirow{4}{*}{Raw Material} & Chemical Solution & 27.45 EUR/KG \\
     a & b \\ c & d \\ e & f \\
    \hline
    \end{tabular}
    \caption{\label{tab:table-name}Cost Breakdown of the Waste and Unit costs}
    \end{center}
    \end{table}

答案1

  • 所有列必须用 & 符号分隔
  • 对于表格,我将使用tabularray包(更短,更简单的代码,我认为更好的表格)
\documentclass[12pt]{report}
\usepackage{tabularray}

\begin{document}
    \begin{table}
    \centering
\begin{tblr}{hlines, vlines,
             colspec = {Q[c,m] X[l] X[l] Q[l,3cm]},
             row{1} = {font=\bfseries}
             }
\SetCell[c=4]{c}    Cost Breakdown      
    &           &                   &               \\
No. & Main Set  & Cost Element      & Unit costs    \\
\SetCell[r=4]{c}    1  
    & \SetCell[r=4]{l}    Raw Material
                & Chemical Solution & 27.45 EUR/KG  \\
    &           &   a               &   b           \\ 
    &           &   c               &   d           \\    
    &           &   e               &   f           \\
\end{tblr}
\caption{Cost Breakdown of the Waste and Unit costs}
\label{tab:table-name}
    \end{table}
\end{document}

在此处输入图片描述

答案2

我不完全确定您想要实现什么,但我认为您遗漏了& &表格的最后三行。

在此处输入图片描述

\documentclass{article}
\usepackage{multirow}
\begin{document}

\begin{table}[htbp]
\centering
\begin{tabular}{|p{0.5cm}|p{4cm}|p{4cm}|p{3cm}|}
\hline
\multicolumn{4}{|c|}{Cost Breakdown} \\
\hline
No & Main Set & Cost Element & Unit costs  \\
\hline
\multirow{4}{*}{1} & \multirow{4}{*}{Raw Material} 
   & Chemical Solution & 27.45 EUR/KG \\
 & & a & b \\ 
 & & c & d \\ 
 & & e & f \\
\hline
\end{tabular}
\caption{Cost Breakdown of the Waste and Unit costs} \label{tab:table-name}
\end{table}

\end{document} 

相关内容