我试图将图像放入多行单元格中,但图像对于单元格来说太大。我该如何调整单元格的大小以完全容纳图像?
我的代码是
\documentclass[11pt]{report}
\begin{landscape}
\begin{longtable}{|c|c|c|c|c|c|c|c|c|}
\caption{Table with transformation details}
\label{appendix:tableindicators}
\hline
\footnotesize Theme & \footnotesize Indicator & \footnotesize Method of Calculation & \footnotesize Transformation & \footnotesize Polarity & \footnotesize Type & \footnotesize Skewness & \footnotesize Kurtosis & \footnotesize Distributions \\ \hline
\multirow{8}{*}{\rotatebox[origin=c]{90}{Transportation}} &
\multirow{2}{*}{\footnotesize Train Station} & \multirow{2}{*}{\scriptsize Walking distance to nearest} & \multirow{2}{*}{\scriptsize \begin{tabular}[c]{@{}l@{}}1) Natural Logarithm(x)\\ 2) Winsorisation(6, 11)\end{tabular}} & \multirow{2}{*}{-} & \scriptsize Raw Data & 2.397 & 10.552 & \multirow{2}{*}{\includegraphics[width=50mm]{Images/dist/distributions_station1.png}} \\ \cline{6-8}
& & & & & \scriptsize Transformed & -0.528 & 2.469 & \\ \cline{2-9}
& \multirow{2}{*}{\footnotesize Bus Stop} & \multirow{2}{*}{\scriptsize Walking distance to nearest} & \multirow{2}{*}{\scriptsize 1) Winsorize(0, 1000)} & \multirow{2}{*}{-} & \scriptsize Raw Data & 3.871 & 37.268 & \multirow{2}{*}{\includegraphics[width=50mm]{Images/dist/distributions_bustop1.png}} \\ \cline{6-8}
& & & & & \scriptsize Transformed & -1.189 & 4.368 & \\ \cline{2-9}
& \multirow{2}{*}{\footnotesize \makecell{Bus Stop with\\ Frequent Services}} & \multirow{2}{*}{\scriptsize Walking distance to nearest} & \multirow{2}{*}{\scriptsize 1) Winsorize(0, 3500)} & \multirow{2}{*}{-} & \scriptsize Raw Data & 2.817 & 15.448 & \multirow{2}{*}{\includegraphics[width=50mm]{Images/dist/distributions_freqbusstop1.png}} \\ \cline{6-8}
& & & & & \scriptsize Transformed & -1.682 & 5.843 & \\ \cline{2-9}
& \multirow{2}{*}{\footnotesize Bikeability} & \multirow{2}{*}{\scriptsize \makecell{Total length of bikeable \\ paths/roads, divided by area}} & \multirow{2}{*}{\scriptsize \begin{tabular}[c]{@{}l@{}}1) Box-Cox ($\lambda=-2$) \\ 2) Winsorisation(-50, -25)\end{tabular}} & \multirow{2}{*}{+} & \scriptsize Raw Data & 1.560 & 7.246 & \multirow{2}{*}{\includegraphics[width=60mm]{Images/dist/distributions_bikeability1.png}} \\ \cline{6-8}
& & & & &\scriptsize Transformed & 0.576 & 3.431 & \\ \hline
\end{longtable}
\end{landscape}
\end{document}
谢谢你!
答案1
像这样?
longtblr
通过使用包可以获得更简单、更简洁的表格tabularray
代码- 表格很大,所以你可以考虑减少页面边框,这样表格就有更多空间,可以使用更大的字体大小,例如
\footnotesize
\documentclass[11pt]{report}
\usepackage[margin=25mm]{geometry} % or other suitable page layout
\usepackage[export]{adjustbox}
\usepackage{enumitem}
\usepackage{rotating}
\usepackage{makecell}
\usepackage{tabularray}
\UseTblrLibrary{siunitx,
varwidth}
\usepackage{pdflscape}
\begin{document}
\begin{landscape}
\begingroup
\setlist[enumerate]{nosep,
itemsep=0.5ex,
leftmargin=*}
\settowidth\rotheadsize{Transportation} % from makecell
\setkeys{Gin}{width=\linewidth}
\begin{longtblr}[
caption = {Table with transformation details},
label = {appendix:tableindicators}
]{hlines, vlines,
colsep = 4pt,
colspec = {c X[1.3, c, m]
X[1.5, c, m] X[2,l, m]
Q[c,m, mode=math]
Q[c,m]
Q[c, si={table-format=-1.3}]
Q[c, si={table-format= 2.3}]
X[2,c]
},
measure = vbox,
rows = {font=\footnotesize},
row{1} = {guard, font=\scriptsize\bfseries, c, mode=text},
cell{even[2]}{2-5,Z} = {r=2}{},
vspan = even,
stretch = -1,
rowhead = 1,
}
% columns headers
Theme & Indicator
& Method of Calculation
& Transformation
& Polarity
& Type
& Skewness
& Kurtosis
& Distributions \\
% table body
\SetCell[r=8]{c, cmd=\rothead} Transportation
& Train Station
& Walking distance to nearest
& \begin{enumerate}
\item Natural Logarithm(x)
\item Winsorisation(6, 11)
\end{enumerate}
& - & Raw Data
& 2.397
& 10.552
& \includegraphics{example-image-duck}
\\
& & & & & Transformed
& -0.528
& 2.469
& \\
& Bus Stop
& Walking distance to nearest
& \begin{enumerate}
\item Winsorize(0, 1000)
\end{enumerate}
& - & Raw Data
& 3.871
& 37.268
& \includegraphics{example-image-duck}
\\
& & & & & Transformed
& -1.189
& 4.368
& \\
& Bus Stop with Frequent Services
& Walking distance to nearest
& \begin{enumerate}
\item Winsorize(0, 3500)
\end{enumerate}
& - & Raw Data
& 2.817
& 15.448
& \includegraphics{example-image-duck}
\\
& & & & & Transformed
& -1.682
& 5.843
& \\
& Bikeability
& Total length of bikeable paths/roads, divided by area
& \begin{enumerate}
\item Box-Cox ($\lambda=-2$)
\item Winsorisation(-50, -25)
\end{enumerate}
& + & Raw Data
& 1.560
& 7.246
& \includegraphics{example-image-duck}
\\
& & & & & Transformed
& 0.576
& 3.431
& \\
\end{longtblr}
\endgroup
\end{landscape}
\end{document}
附录:
关于您的评论,您应该知道,表格只能在行之间分隔。这意味着,在您的情况下,处理多行单元格时可能会遇到问题:
- 为了在多行单元格之间正确进行表格拆分,请尝试使用 来终止插入图像的行
\\*
。这样可以防止表格在此行之后拆分。 - 您可以考虑将第一列变成带有表格部分“字幕”的行。
- 它也可能有助于降低图像的高度。
此类表格重新设计的一个例子是:
\documentclass[11pt]{report}
\usepackage[margin=25mm]{geometry} % or other suitable page layout
\usepackage[export]{adjustbox}
\usepackage{enumitem}
\usepackage{xcolor}
\usepackage{tabularray}
\UseTblrLibrary{booktabs,
siunitx,
varwidth}
\NewTableCommand\subtitle{%
\SetCell[r=2, c=8]{l, m, bg=gray!10,
font=\large\bfseries\itshape,
cmd=\rule[-1ex]{0pt}{4ex}
}
}
\usepackage{pdflscape}
\begin{document}
\begin{landscape}
\small
\setlist[enumerate]{nosep,
itemsep=0.5ex,
leftmargin=*}
\setkeys{Gin}{width=\linewidth, height=17mm}
\begin{longtblr}[
caption = {Table with transformation details},
label = {appendix:tableindicators}
]{hline{even[3]} = {dashed},
hline{Z} = {solid, \heavyrulewidth},
colsep = 4pt,
colspec = {@{}
X[1.3, l, m]
X[1.6, c, m]
X[2,l, m]
Q[c,m, mode=math, font=\Large]
Q[c]
Q[c, si={table-format=-1.3}]
Q[c, si={table-format= 2.3}]
X[2,c]
@{} },
measure = vbox,
rowsep = 3pt,
row{1} = {guard, font=\footnotesize\bfseries, c, mode=text},
cell{even[2]}{1-4,Z} = {r=2}{},
vspan = even,
stretch = -1,
rowhead = 1,
}
% columns headers
\toprule
Indicator
& Method of Calculation
& Transformation
& Polarity
& Type
& Skewness
& Kurtosis
& Distributions \\
% table body
\midrule
\subtitle Theme: Transportation
& & & & & & & \\*
& & & & & & & \\
Train Station
& Walking distance to nearest
& \begin{enumerate}
\item Natural Logarithm(x)
\item Winsorisation(6, 11)
\end{enumerate}
& - & Raw Data
& 2.397
& 10.552
& \includegraphics{example-image-duck}
\\*
& & & & Transformed
& -0.528
& 2.469
& \\
Bus Stop
& Walking distance to nearest
& \begin{enumerate}
\item Winsorize(0, 1000)
\end{enumerate}
& - & Raw Data
& 3.871
& 37.268
& \includegraphics{example-image-duck}
\\
& & & & Transformed
& -1.189
& 4.368
& \\
Bus Stop with Frequent Services
& Walking distance to nearest
& \begin{enumerate}
\item Winsorize(0, 3500)
\end{enumerate}
& - & Raw Data
& 2.817
& 15.448
& \includegraphics{example-image-duck}
\\
& & & & Transformed
& -1.682
& 5.843
& \\
Bikeability
& Total length of bikeable paths/roads, divided by area
& \begin{enumerate}
\item Box-Cox ($\lambda=-2$)
\item Winsorisation(-50, -25)
\end{enumerate}
& + & Raw Data
& 1.560
& 7.246
& \includegraphics{example-image-duck}
\\
& & & & Transformed
& 0.576
& 3.431
& \\
bla bla bla
& Total length of bikeable paths/roads, divided by area
& \begin{enumerate}
\item Box-Cox ($\lambda=-2$)
\item Winsorisation(-50, -25)
\end{enumerate}
& + & Raw Data
& 1.560
& 7.246
& \includegraphics{example-image-duck}
\\
& & & & Transformed
& 0.576
& 3.431
& \\
\subtitle Theme: Other transportation
& & & & & & & \\
& & & & & & & \\
Uber
& Total length of bikeable paths/roads, divided by area
& \begin{enumerate}
\item Box-Cox ($\lambda=-2$)
\item Winsorisation(-50, -25)
\end{enumerate}
& + & Raw Data
& 1.560
& 7.246
& \includegraphics{example-image-duck}
\\*
& & & & Transformed
& 0.576
& 3.431
& \\
Car Sharing
& Total length of bikeable paths/roads, divided by area
& \begin{enumerate}
\item Box-Cox ($\lambda=-2$)
\item Winsorisation(-50, -25)
\end{enumerate}
& + & Raw Data
& 1.560
& 7.246
& \includegraphics{example-image-duck}
\\*
& & & & Transformed
& 0.576
& 3.431
& \\
Bike Sharing
& Total length of bikeable paths/roads, divided by area
& \begin{enumerate}
\item Box-Cox ($\lambda=-2$)
\item Winsorisation(-50, -25)
\end{enumerate}
& + & Raw Data
& 1.560
& 7.246
& \includegraphics{example-image-duck}
\\*
& & & & Transformed
& 0.576
& 3.431
& \\
% \bottomrule
\end{longtblr}
\end{landscape}
\end{document}