表格内的换行符-parbox 不起作用!

表格内的换行符-parbox 不起作用!

因此我尝试创建下表:

\begin{tabular}{*{5}{c}}
    \toprule
    \parbox{2cm}{Stringer/Web} & \parbox{2cm}{Area of Stringer [$m^2$]} &
    \parbox{2cm}{Bending Stress $\sigma$ [$MPa$]} &
    \parbox{2cm}{Shear Flow due to Bending $q_B$ [$N/m$]} & 
    \parbox{2cm}{Shear Stress $\tau$ [$MPa$]}
\end{tabular}

但是,结果看起来很糟糕,到处都是换行符,最终的文本看起来很糟糕。请帮忙?

梅威瑟:

\documentclass[a4paper]{article}
\usepackage{booktabs}
\usepackage{tabu}
\usepackage{multirow}
\usepackage{amsmath}
\numberwithin{equation}{section}
\usepackage{amsfonts}
\begin{document}
\begin{tabular}{*{5}{c}}
    \toprule
    \parbox{2cm}{Stringer/Web} & \parbox{2cm}{Area of Stringer [$m^2$]} &
    \parbox{2cm}{Bending Stress $\sigma$ [$MPa$]} &
    \parbox{2cm}{Shear Flow due to Bending $q_B$ [$N/m$]} & 
    \parbox{2cm}{Shear Stress $\tau$ [$MPa$]}
\end{tabular}
\end{document}

答案1

使用单位siunitx并拥有与文本宽度匹配的表格。

\documentclass{article}
\usepackage{showframe}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{siunitx}
\renewcommand{\tabularxcolumn}[1]{>{\raggedright}m{#1}}
\begin{document}
\noindent
\begin{tabularx}{\textwidth}{lXXXX}
    \toprule
    Stringer/Web & 
    Area of Stringer in \si{\meter\squared} &
    Bending Stress $\sigma$ in \si{\mega\pascal} &
    Shear Flow due to Bending $q_B$ in \si{\newton\per\meter} & 
    Shear Stress $\tau$ in \si{\mega\pascal} 
\end{tabularx}
\end{document}

相关内容