![使文本适合单元格](https://linux22.com/image/356895/%E4%BD%BF%E6%96%87%E6%9C%AC%E9%80%82%E5%90%88%E5%8D%95%E5%85%83%E6%A0%BC.png)
我有一张 22 列 5 行的表格,我尝试过\small
垂直更改它,但没有成功,只能看到一部分,如何修复它,可能是让文本更小或者其他什么,这样它就可以工作了,我也尝试过更改单元格大小,但没有成功,这是我的代码
\newcolumntype{C}[1]{> {\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}} \begin{table} [!htbp] \small \centering \begin{sideways} \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|} \hline Summghtyary & Bh &C &Dyh &Ei &F &G &H &I& J& K&f L& Mk &N& O &P
& Q &Rr &S &Ty &Uh& V& Wj \\ \hline cc.CR (\%) & 52.75 &52.75 &21.25 &21.25 &55.02& 55.05& 63.85&
67.58& 85.45& 85.85& 62.50& 62.50& 76.54& 60.08& 55.05 & 65.04&
60.00& 57.50& 56.25 &60.00& 63.75& 65.00\\ \hline fgrt CR (\%) & 57.94 &35.25& 48.66 &47.43& 49.73& 55.29& 37.53&
52.94& 39.04& 47.59& 33.16 &38.50& 61.50& 38.50 &28.88& 53.36& 24.06& 23.43& 33.76& 43.32& 45.66& 55.87 \\
\hline Avtgrayhe CR (\%) & 55.85 &47.02& 54.96& 59.34& 55.37 &55.15& 50.59& 60.22& 45.90& 55.17& 47.83& 55.50& 65.05& 49.55& 41.94
&53.36& 48.03& 25.57& 44.78& 51.65& 56.51& 58.84 \\ \hline Rbhk & 5 & 7 & 6& 13& 9 &18& 11& 2 &19 &8& 16& 18 &1& 17& 21 & 7 &20& 29& 19& 17& 4& 3\\ \hline \end{tabular} \end{sideways} \caption{blah balabalalalalalzl} \label{table:10} \end{table}
By the way just a part of my table is displayed and the title does not even appear :(
编辑 1:这是我在评论中谈论的表格,我希望在这个表格中点赞,这样我的值就可以适合这个表格,它太长了,我无法完全捕捉到,但没关系
感谢您的时间和考虑..
答案1
您可以删除列之间的分隔并进一步减小字体大小。
\documentclass{article}
\usepackage{array,rotating}
\begin{document}
\begin{table}
\scriptsize
\centering
\begin{sideways}
\begin{tabular}{*{23}{|@{}c@{}}|}
\hline Summghtyary & Bh & C & Dyh & Ei & F & G & H & I & J & K & f L & Mk & N & O & P & Q & Rr & S & Ty & Uh & V & Wj \\
\hline cc.CR (\%) & 52.75 & 52.75 & 21.25 & 21.25 & 55.02 & 55.05 & 63.85 & 67.58 & 85.45 & 85.85 & 62.50 & 62.50 & 76.54 & 60.08 & 55.05 & 65.04 & 60.00 & 57.50 & 56.25 & 60.00 & 63.75 & 65.00 \\
\hline fgrt CR (\%) & 57.94 & 35.25 & 48.66 & 47.43 & 49.73 & 55.29 & 37.53 & 52.94 & 39.04 & 47.59 & 33.16 & 38.50 & 61.50 & 38.50 & 28.88 & 53.36 & 24.06 & 23.43 & 33.76 & 43.32 & 45.66 & 55.87 \\
\hline Avtgrayhe CR (\%) & 55.85 & 47.02 & 54.96 & 59.34 & 55.37 & 55.15 & 50.59 & 60.22 & 45.90 & 55.17 & 47.83 & 55.50 & 65.05 & 49.55 & 41.94 & 53.36 & 48.03 & 25.57 & 44.78 & 51.65 & 56.51 & 58.84 \\
\hline Rbhk & 5 & 7 & 6 & 13 & 9 & 18 & 11 & 2 & 19 & 8 & 16 & 18 & 1 & 17 & 21 & 7 & 20 & 29 & 19 & 17 & 4 & 3 \\
\hline
\end{tabular}
\end{sideways}
\caption{blah balabalalalalalzl}
\label{table:10}
\end{table}
\end{document}
答案2
我想说,把自己放在读者的位置,你想读那段文字吗?当然不想。排版完全是为了可读性。我建议重新格式化表格,没有人会责怪你做了正确的事情。以下设置有更好的改进,但现在这个想法更清晰了。
\documentclass{article}
\begin{document}
\begin{table} [!htbp]
\centering
\begin{tabular}{ |*6{c|} }\hline
Summghtyary & cc.CR (\%) & fgrt CR (\%) & Avtgrayhe CR (\%) & Rbhk \\ \hline
Bh & 52.75 & 57.94 & 55.85 & 5 \\ \hline
C & 52.75 & 35.25 & 47.02 & 7 \\ \hline
Dyh & 21.25 & 48.66 & 54.96 & 6 \\ \hline
Ei & 21.25 & 47.43 & 59.34 & 13 \\ \hline
F & 55.02 & 49.73 & 55.37 & 9 \\ \hline
G & 55.05 & 55.29 & 55.15 & 18 \\ \hline
H & 63.85 & 37.53 & 50.59 & 11 \\ \hline
I & 67.58 & 52.94 & 60.22 & 2 \\ \hline
J & 85.45 & 39.04 & 45.9 & 19 \\ \hline
K & 85.85 & 47.59 & 55.17 & 8 \\ \hline
fL & 62.5 & 33.16 & 47.83 & 16 \\ \hline
Mk & 62.5 & 38.5 & 55.5 & 18 \\ \hline
N & 76.54 & 61.5 & 65.05 & 1 \\ \hline
O & 60.08 & 38.5 & 49.55 & 17 \\ \hline
P & 55.05 & 28.88 & 41.94 & 21 \\ \hline
Q & 65.04 & 53.36 & 53.36 & 7 \\ \hline
Rr & 60 & 24.06 & 48.03 & 20 \\ \hline
S & 57.5 & 23.43 & 25.57 & 29 \\ \hline
Ty & 56.25 & 33.76 & 44.78 & 19 \\ \hline
Uh & 60 & 43.32 & 51.65 & 17 \\ \hline
V & 63.75 & 45.66 & 56.51 & 4 \\ \hline
Wj & 65 & 55.87 & 58.84 & 3 \\ \hline
\end{tabular}
\caption{blah balabalalalalalzl}
\label{table:10}
\end{table}
\end{document}
现在看看这个:
\documentclass{article}
\usepackage{siunitx,booktabs}
\begin{document}
\begin{table} [!htbp]
\centering
\begin{tabular}{@{}c
S[table-format=2.2]
S[table-format=2.2]
S[table-format=2.2]
S[table-format=2.0]@{}}
\toprule
\textbf{Summghtyary} & \textbf{cc.CR} & \textbf{fgrt CR} & \textbf{Avtgrayhe} & \textbf{Rbhk} \\
& \multicolumn{1}{c}{\textbf{(\%)}} & \multicolumn{1}{c}{\textbf{(\%)}} & \multicolumn{1}{c}{\textbf{CR (\%)}} \\ \midrule
Bh& 52.75 & 57.94 & 55.85 & 5 \\
C & 52.75 & 35.25 & 47.02 & 7 \\
Dyh& 21.25 & 48.66 & 54.96 & 6 \\
Ei& 21.25 & 47.43 & 59.34 & 13 \\
F & 55.02 & 49.73 & 55.37 & 9 \\
G & 55.05 & 55.29 & 55.15 & 18 \\
H & 63.85 & 37.53 & 50.59 & 11 \\
I & 67.58 & 52.94 & 60.22 & 2 \\
J & 85.45 & 39.04 & 45.9 & 19 \\
K & 85.85 & 47.59 & 55.17 & 8 \\
fL& 62.5 & 33.16 & 47.83 & 16 \\
Mk& 62.5 & 38.5 & 55.5 & 18 \\
N & 76.54 & 61.5 & 65.05 & 1 \\
O & 60.08 & 38.5 & 49.55 & 17 \\
P & 55.05 & 28.88 & 41.94 & 21 \\
Q & 65.04 & 53.36 & 53.36 & 7 \\
Rr& 60 & 24.06 & 48.03 & 20 \\
S & 57.5 & 23.43 & 25.57 & 29 \\
Ty& 56.25 & 33.76 & 44.78 & 19 \\
Uh& 60 & 43.32 & 51.65 & 17 \\
V & 63.75 & 45.66 & 56.51 & 4 \\
Wj& 65 & 55.87 & 58.84 & 3 \\ \bottomrule
\end{tabular}
\caption{blah balabalalalalalzl}
\label{table:10}
\end{table}
\end{document}
编辑:
以下是拆分表格同时仍保持高度可读性的一种方法:
\documentclass{article}
\usepackage{siunitx,booktabs}
\usepackage[margin=1cm]{geometry}
\begin{document}
\newcommand{\MC}[1]{\multicolumn{1}{c}{\bfseries#1}}
\newcommand{\ML}[1]{\multicolumn{1}{@{}l}{\bfseries#1}}
\begin{table} [!htbp]
\centering
\begin{tabular}{@{}l *8{S[table-format=2.2]} @{}}
\toprule
\ML{Summghtyary} &\MC{Bh}&\MC{C} &\MC{Dyh}&\MC{Ei} &\MC{F} &\MC{G} & \MC{H}&\MC{I} \\ \midrule
cc.CR (\%) & 52.75 & 52.75 & 21.25 & 21.25 & 55.02 & 55.05 & 63.85 & 67.58 \\
fgrt CR (\%) & 57.94 & 35.25 & 48.66 & 47.43 & 49.73 & 55.29 & 37.53 & 52.94 \\
Avtgrayhe CR (\%) & 55.85 & 47.02 & 54.96 & 59.34 & 55.37 & 55.15 & 50.59 & 60.22 \\
Rbhk & 5 & 7 & 6 & 13 & 9 & 18 & 11 & 2 \\ \addlinespace
%\end{tabular}
%\begin{tabular}{@{}l *8{S[table-format=2.2]} @{}}
\toprule
\ML{Summghtyary} &\MC{J} & \MC{K}&\MC{f L}&\MC{Mk}&\MC{N}&\MC{O} &\MC{P} &\MC{Q} \\ \midrule
cc.CR (\%) & 85.45 & 85.85 & 62.50 & 62.50 & 76.54 & 60.08 & 55.05 & 65.04 \\
fgrt CR (\%) & 39.04 & 47.59 & 33.16 & 38.50 & 61.50 & 38.50 & 28.88 & 53.36 \\
Avtgrayhe CR (\%) & 45.90 & 55.17 & 47.83 & 55.50 & 65.05 & 49.55 & 41.94 & 53.36 \\
Rbhk & 19 & 8 & 16 & 18 & 1 & 17 & 21 & 7 \\ \addlinespace
%\end{tabular}
%\begin{tabular}{@{}l *8{S[table-format=2.2]} @{}}
\toprule
\ML{Summghtyary} &\MC{Rr}&\MC{S} &\MC{Ty}&\MC{Uh}&\MC{V} &\MC{Wj}& & \\ \midrule
cc.CR (\%) & 60.00 & 57.50 & 56.25 & 60.00 & 63.75 & 65.00 & & \\
fgrt CR (\%) & 24.06 & 23.43 & 33.76 & 43.32 & 45.66 & 55.87 & & \\
Avtgrayhe CR (\%) & 48.03 & 25.57 & 44.78 & 51.65 & 56.51 & 58.84 & & \\
Rbhk & 20 & 29 & 19 & 17 & 4 & 3 & & \\ \bottomrule
\end{tabular}
\caption{blah balabalalalalalzl}
\label{table:10}
\end{table}
\end{document}