我正在写论文。我需要一点帮助。我的书中插入了一个比较表,但它在 pdf 上看起来太大,难以阅读。你能建议一种添加此表格的其他方法吗?正如您在附图中看到的那样,它在一页之间占用了太多空间。我希望得到我在表格中显示的东西,绿色,但颜色是黑白的。
对于下面的代码,生成的 pdf 显示在第二张图片中。要运行此代码,请打开 overleaf 并创建 main.tex 和 background 以及相关的 work.tex 文件,然后运行 main.tex 以复制内容。
主文本
\documentclass[a4paper,oneside,12pt]{book}
\usepackage{booktabs,xltabular,ragged2e,glossaries}
\newcolumntype{P}[1]{>{\RaggedRight}p{#1}}
\newcolumntype{L}{>{\RaggedRight}X}
\begin{document}
\pagenumbering{roman} \setcounter{page}{1} % to start with roman page numbering
\cleardoublepage
\tableofcontents
% Print list of abbreviations, list of tables and list of figures
\printnoidxglossary[nopostdot,nonumberlist,title=List of Abbreviations]
\listoftables
\listoffigures
% Includes the pdf of the paper. It will give an error if the pdf is not available.
\clearpage \pagenumbering{arabic}
\setcounter{page}{1}
\clearpage
\setlength{\textheight}{9in}
%start of main document
\input{background and related work}
\clearpage
\nocite{*}
\bibliographystyle{unsrt}
\addcontentsline{toc}{chapter}{Bibliography}
\bibliography{chapters/bibliography}
\end{document}
背景和相关工作.tex
\begin{xltabular}{\linewidth}{ @{}
P{.15\textwidth}
P{.15\textwidth}
L
P{.15\textwidth}
P{.15\textwidth}
@{} }
\caption{Related works on computer vision (Comparison table)}
\label{my-label}\\
\toprule
Topic & Goal & Idea & Technique & Use case\\
\midrule
\endfirsthead
\multicolumn{5}{@{}l}{Table \thetable, cont'd}\\[1ex]
\toprule
Topic & Goal & Technique & Idea & Use case\\
\midrule
\endhead
\bottomrule
\endlastfoot
Computer vision tasks & Localization & To perform localization is to define a bounding box enclosing the object in the image &To find the location of the objects in a set of images & Useful for creating dataset when combined with classifier where we need to crop images \\
Computer vision tasks & Object detection (Fast R-CNN, R-CNN, Faster R-CNN, Mask R-CNN, SSD, YOLO, Data Augmentation, Haar cascade, objects as points) & To define objects within images involving outputting of bounding boxes and labels for individual objects. Purpose is to find the object and classify a N number of objects in an image & To identify and locate objects in an image or video & Powerful in classifying several objects within a digital image at once. \\
\end{xltabular}%
答案1
- 你的问题实际上是重复的问题我的桌子不适合我有什么选择
- 请始终提供 MWE(最小工作示例),这是一个小但完整的文档,它可以重现您的问题(帮助我们帮助您)
- 你的表格很大,所以你应该考虑将其旋转为横向并使用较小的字体大小
- 结合使用
pdflscape
(用于使用landscape
环境)和表格tabularray
包装longtblr
,可能的 MWE 是:
\documentclass[a4paper,oneside,12pt]{book}
\usepackage{tabularray}
\usepackage{pdflscape}
\begin{document}
\begin{landscape}
%\mbox{}\vfil
\begin{longtblr}[
caption = {Related works on computer vision},
label = {tab:my-label},
]{hline{1,Z} = {1pt}, hline{2}={0.6pt},
colspec={X[1,l] X[2,l] X[3,l] X[2,l] X[2,l]},
colsep=3pt, rowsep=3pt,
rowhead=1,
rows={font=\small},
row{1} = {font=\small\bfseries},
}
% column headers
Topic
& Goal
& Idea
& Technique
& Use case \\
% table body
Computer vision tasks & Localization
& To perform localization is to define a bounding box enclosing the object in the image
& To find the location of the objects in a set of images
& Useful for creating dataset when combined with classifier where we need to crop images \\
Computer vision tasks
& Object detection (Fast R-CNN, R-CNN, Faster R-CNN, Mask R-CNN, SSD, YOLO, Data Augmentation, Haar cascade, objects as points)
& To define objects within images involving outputting of bounding boxes and labels for individual objects. Purpose is to find the object and classify a N number of objects in an image
& To identify and locate objects in an image or video
& Powerful in classifying several objects within a digital image at once. \\
\end{longtblr}
\end{landscape}
\end{document}