我的代码有问题。我是 Latex 新手,我使用表格编辑器为我生成代码。我想制作一个像下面这样的表格,但行最终重叠(也如下所示)。
\usepackage{graphicx}
\usepackage{multirow}
\begin{table*}
\centering
\caption{FMEA analysis on the possible failure modes of the fan blade.}
\label{tab:FMEA}
\resizebox{\linewidth}{!}{%
\begin{tabular}{clclcclc}
\hline
Failure Mode & \multicolumn{1}{c}{Effects} & S & \multicolumn{1}{c}{Causes} & P & D & \multicolumn{1}{c}{Design Considerations} & RPN \\
\hline
\multirow{2}{*}{Fatigue} & \multirow{2}{*}{\begin{tabular}[c]{@{}l@{}}1) Fan will be inoperable until fan blade replaced.\\ \\ 2) Failure during operation may \\ lead to injuries or damages\\ to other equipment. \\\end{tabular}} & \multirow{2}{*}{9} & \begin{tabular}[c]{@{}l@{}}Alternating load cycles \\ when RPM is decreased\\ or increased\end{tabular} & 8 & 6 & \begin{tabular}[c]{@{}l@{}}1)Reduce the frequency of RPM change and reduce deformation\\ during loading. \\\end{tabular} & 432 \\
& & & \begin{tabular}[c]{@{}l@{}}High temperature induces \\ propagation of microcracks\end{tabular} & 9 & 1 & \begin{tabular}[c]{@{}l@{}}2) Operating temperature (400 C) must not\\ be higher than 0.3$T_m$ of \\ selected material. \\\end{tabular} & 81 \\
\hline
\multirow{2}{*}{Corrosion} & \multirow{2}{*}{\begin{tabular}[c]{@{}l@{}}1) Surface imperfections caused by corrosion increase drag,\\ reducing the fan efficiency.\\ \\ 2) Reduces structural integrity\\ of the fan blades which increases\\ chances of premature failure.~\\\end{tabular}} & \multirow{2}{*}{6} & \begin{tabular}[c]{@{}l@{}}Abrasion and degradation\\ of anti-corrosion coating\end{tabular} & 10 & 2 & \begin{tabular}[c]{@{}l@{}}1) Select a more corrosion-resistant\\ material to reduce reliance\\ on anti-corrosion coatings.\end{tabular} & 120 \\
& & & Pitting corrosion & 7 & 6 & \begin{tabular}[c]{@{}l@{}}2) Avoid passive metals for the\\ construction of the blade.\end{tabular} & 252 \\
\hline
\multirow{2}{*}{Creep} & \multirow{2}{*}{\begin{tabular}[c]{@{}l@{}}1) May result in loss of performance\\ if blade is deformed,\\ or injuries if catastrophic\\ failure occurs. \\ 2) More frequent blade replacements\\ would increase operating costs \\\end{tabular}} & \multirow{2}{*}{9} & \begin{tabular}[c]{@{}l@{}}Constant loading of the\\ fan blades\end{tabular} & 9 & 4 & \begin{tabular}[c]{@{}l@{}}1) Finite element analysis may help\\ obtain the most optimal blade\\ geometry.\end{tabular} & 324 \\
& & & \begin{tabular}[c]{@{}l@{}}High temperature increases\\ dislocation mobility\end{tabular} & 9 & 1 & \begin{tabular}[c]{@{}l@{}}2) The operating temperature\\ (400 C) must not \\ exceed 0.5$T_m$ of the material\end{tabular} & 81 \\
\hline
Impact & \begin{tabular}[c]{@{}l@{}}1) Damage surface and reduce\\aerodynamic efficiency of the blade. \\ 2) A large object may cause deformation\\ or complete failure of the blade, deeming\\ the machine inoperable. \\\end{tabular} & 9 & \begin{tabular}[c]{@{}l@{}}Ingestion of solid objects\\ into the fan \end{tabular} & \multicolumn{1}{l}{10} & \multicolumn{1}{l}{2} & \begin{tabular}[c]{@{}l@{}}The blades must be inspected\\ frequently for surface damage\\ or any deformation. \end{tabular} & 180 \\
\hline
\end{tabular}
}
\end{table*}
答案1
我认为最好让 LaTeX 进行换行,因此使用p{...}
列来表示多行文本。这使得代码更加简单。其他列可以用 来定位\multirow
,但它们需要一些手动调整(使用其他列中的实际行数,如nrows
)\multirow
。所以这是我的解决方案。(我makecell
仅使用 来获得“gapes”。)
\documentclass{article}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{makecell}
\usepackage[paperwidth=30cm]{geometry}
\begin{document}
\begin{table*}
\centering
\caption{FMEA analysis on the possible failure modes of the fan blade.}
\label{tab:FMEA}
\setcellgapes{5pt}
\makegapedcells
\begin{tabular}{ccp{5cm}cp{4cm}ccp{6cm}c}
% 1 header
\toprule
1 & Failure mode & Effects & S & Causes & P & D & Design Considerations & RPN \\
\midrule
\multirow{2}{*}{2} & \multirow{7}{*}{Fatigue} & 1) Fan will be inoperable until fan blade replaced. & \multirow{7}{*}{9} & Alternating load cycles when RPM is decreased or increased & 8 & 6 & 1) Reduce the frequency of RPM change and reduce deformation during loading. & \multirow{2}{*}{432} \\
\multirow{3}{*}{3} & & 2) Failure during operation may lead to injuries or damages to other equipment. & & High temperature induces propagation of microcracks & 9 & 1 & 2) Operating temperature (400 C) must not be higher than 0.3$T_m$ of selected material. & \multirow{3}{*}{81} \\
\midrule
4 & \multirow{7}{*}{Corrosion} & 1) Surface imperfections caused by corrosion increase drag, reducing the fan efficiency. & \multirow{7}{*}{6} & Abrasion and degradation of anti-corrosion coating & 10 & 2 & 1) Select a more corrosion-resistant material to reduce reliance on anti-corrosion coatings. & 120 \\
5 & & 2) Reduces structural integrity of the fan blades which increases chances of premature failure. & & Pitting Corrosion & 7 & 6 & 2) Avoid passive metals for the construction of the blade. & 252 \\
\midrule
6 & \multirow{8}{*}{Creep} & 1) May result in loss of performance if blade is deformed, or injuries if catastrophic failure occurs. & \multirow{8}{*}{9} & Constant loading of the fan blades & 9 & 4 & 1) Finite element analysis may help obtain the most optimal blade geometry. & 324 \\
7 & & 2) More frequent blade replacements would increase operating costs & & High temperature increases dislocation mobility & 9 & 1 & 2) The operating temperature (400 C) must not exceed 0.5$T_m$ of the material & 81 \\
\midrule
\multirow{8}{*}{8} & \multirow{8}{*}{Impact} & 1) Damage surface and reduce aerodynamic efficiency of the blade. & \multirow{8}{*}{9} & \multirow{8}{=}{Ingestion of solid objects into the fan} & \multirow{8}{*}{10} & \multirow{8}{*}{2} & \multirow{8}{=}{The blades must be inspected frequently for surface damage or any deformation.} & \multirow{8}{*}{180} \\
& & 2) A large object may cause deformation or complete failure of the blade, deeming the machine inoperable. & & & & & & \\
\bottomrule
\end{tabular}
% }
\end{table*}
\end{document}
答案2
我已经更改了段落标题中的代码Corrosion
,并Creep
使用包,makecell
这比在表格环境中创建表格更好 - 看看 - 也使用包booktabs
和使用toprule
,,提供更好的间距 - 您可以对表格的其余部分进行相同的操作 - 将为您提供所需的结果midrule
bottomrule
\makecell[l]{1) Surface imperfections caused by corrosion increase drag,\\ reducing the fan efficiency.\\ 2) Reduces structural integrity\\ of the fan blades which increases\\ chances of premature failure.~\\}
部分代码已更改 MWE - 其余留给 OP
\documentclass{article}
\usepackage{subcaption}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{makecell}
\renewcommand\thesubfigure{1\alphalph{\value{subfigure}}}
\begin{document}
\begin{table*}
\centering
\caption{FMEA analysis on the possible failure modes of the fan blade.}
\label{tab:FMEA}
% \resizebox{\linewidth}{!}{%
\begin{tabular}{clclcclc}
\toprule
Failure Mode & \multicolumn{1}{c}{Effects} & S & \multicolumn{1}{c}{Causes} & P & D & \multicolumn{1}{c}{Design Considerations} & RPN \\
\midrule
\multirow{2}{*}{Fatigue} & \multirow{2}{*}{\begin{tabular}[c]{@{}l@{}}1) Fan will be inoperable until fan blade replaced.\\ \\ 2) Failure during operation may \\ lead to injuries or damages\\ to other equipment. \\\end{tabular}} & \multirow{2}{*}{9} & \begin{tabular}[c]{@{}l@{}}Alternating load cycles \\ when RPM is decreased\\ or increased\end{tabular} & 8 & 6 & \begin{tabular}[c]{@{}l@{}}1)Reduce the frequency of RPM change and reduce deformation\\ during loading. \\\end{tabular} & 432 \\
& & & \begin{tabular}[c]{@{}l@{}}High temperature induces \\ propagation of microcracks\end{tabular} & 9 & 1 & \begin{tabular}[c]{@{}l@{}}2) Operating temperature (400 C) must not\\ be higher than 0.3$T_m$ of \\ selected material. \\\end{tabular} & 81 \\
\midrule
\multirow{2}{*}{Corrosion} & \makecell[l]{1) Surface imperfections caused by corrosion increase drag,\\ reducing the fan efficiency.\\ 2) Reduces structural integrity\\ of the fan blades which increases\\ chances of premature failure.~\\} & \multirow{2}{*}{6} & \begin{tabular}[c]{@{}l@{}}Abrasion and degradation\\ of anti-corrosion coating\end{tabular} & 10 & 2 & \begin{tabular}[c]{@{}l@{}}1) Select a more corrosion-resistant\\ material to reduce reliance\\ on anti-corrosion coatings.\end{tabular} & 120 \\
& & & Pitting corrosion & 7 & 6 & \begin{tabular}[c]{@{}l@{}}2) Avoid passive metals for the\\ construction of the blade.\end{tabular} & 252 \\
\midrule
\multirow{2}{*}{Creep} & \makecell[l]{1) May result in loss of performance\\ if blade is deformed,\\ or injuries if catastrophic\\ failure occurs. \\ 2) More frequent blade replacements\\ would increase operating costs \\} & \multirow{2}{*}{9} & \begin{tabular}[c]{@{}l@{}}Constant loading of the\\ fan blades\end{tabular} & 9 & 4 & \begin{tabular}[c]{@{}l@{}}1) Finite element analysis may help\\ obtain the most optimal blade\\ geometry.\end{tabular} & 324 \\
& & & \begin{tabular}[c]{@{}l@{}}High temperature increases\\ dislocation mobility\end{tabular} & 9 & 1 & \begin{tabular}[c]{@{}l@{}}2) The operating temperature\\ (400 C) must not \\ exceed 0.5$T_m$ of the material\end{tabular} & 81 \\
\midrule
Impact & \begin{tabular}[c]{@{}l@{}}1) Damage surface and reduce\\aerodynamic efficiency of the blade. \\ 2) A large object may cause deformation\\ or complete failure of the blade, deeming\\ the machine inoperable. \\\end{tabular} & 9 & \begin{tabular}[c]{@{}l@{}}Ingestion of solid objects\\ into the fan \end{tabular} & \multicolumn{1}{l}{10} & \multicolumn{1}{l}{2} & \begin{tabular}[c]{@{}l@{}}The blades must be inspected\\ frequently for surface damage\\ or any deformation. \end{tabular} & 180 \\
\bottomrule
\end{tabular}
% }
\end{table*}
\end{document}