下表为:
\documentclass{article}
\usepackage{multirow,rotating}
\begin{document}
\begin{sidewaystable}[]
\caption{Comparison of various models}
\label{tab:gr}
\bigskip
\centering\small\setlength\tabcolsep{2pt}
\hspace*{-1cm}\begin{tabular}{| l | c | c | c | c | c | c | }
\toprule
\textbf{Type} & \textbf{Bandwidth} & \textbf{$Q$ value} & \textbf{Source Resistance ($R_i$)} & \textbf{Load Resistance ($R_L$)} & \textbf{Power Efficiency} \\
\midrule
\textit{SS} & Low, at around \SI{10}{\kilo\hertz} & High, around 200. $Q$ for $f_-$ increases with increase in k, where as $Q$ for $f_-$ decreases with increase in k & High $R_i$ offers single peak resonance frequency component. Normally fixed at \SI{5.1}{\ohm} & Optimal at \SI{65}{\ohm} & offers high efficinecy compared to other three types of circuit models \\
\hline
\textit{SS1} & \blindtext & \blindtext & \blindtext & \blindtext & \blindtext\\
\hline
\textit{SS2} & 7.47 &1 & 1& 1&1\\
\hline
\textit{SS3} & 6.79 &1 & 1&1 &1\\
\bottomrule
\end{tabular}\hspace*{-1cm}
\end{sidewaystable}
\end{document}
我必须在第二、第三、第四和第五列的每个单元格中添加长文本。
我不知道要添加多少文本。所以我只希望乳胶能够智能地将文本换行到每个单元格内,并使整个表格换行到页边距内。当然,我不会在每个单元格内添加一页长度的文本,例如,它将是两行全长文本。
那么这能做到吗?
答案1
扩展@DavidCarlisle 的评论:
- 最简单的方法是使用新的列类型
- 你不应该像以前那样使用垂直线
booktabs
(我把它们留在那里是为了看问题) - MWE 应该始终是可编译的,我不得不添加一些包
\documentclass{article}
\usepackage{multirow,rotating,array,booktabs,siunitx,blindtext}
\newcolumntype{C}{>{\centering\arraybackslash}p}
\begin{document}
\begin{sidewaystable}[]
\caption{Comparison of various models}
\label{tab:gr}
\bigskip
\centering\small\setlength\tabcolsep{2pt}
\hspace*{-1cm}\begin{tabular}{| l | C{.13\textwidth} | C{.13\textwidth} | C{.13\textwidth} | C{.13\textwidth} | C{.13\textwidth} | C{.13\textwidth} | }
\toprule
\textbf{Type} & \textbf{Bandwidth} & \textbf{$Q$ value} & \textbf{Source Resistance ($R_i$)} & \textbf{Load Resistance ($R_L$)} & \textbf{Power Efficiency} \\
\midrule
\textit{SS} & Low, at around \SI{10}{\kilo\hertz} & High, around 200. $Q$ for $f_-$ increases with increase in k, where as $Q$ for $f_-$ decreases with increase in k & High $R_i$ offers single peak resonance frequency component. Normally fixed at \SI{5.1}{\ohm} & Optimal at \SI{65}{\ohm} & offers high efficinecy compared to other three types of circuit models \\
%\hline
%\textit{SS1} & \blindtext & \blindtext & \blindtext & \blindtext & \blindtext\\
\hline
\textit{SS2} & 7.47 &1 & 1& 1&1\\
\hline
\textit{SS3} & 6.79 &1 & 1&1 &1\\
\bottomrule
\end{tabular}\hspace*{-1cm}
\end{sidewaystable}
\end{document}