我是这个 latex 的新手,很难在同一页中调整表格和图像。我找到了一种在同一页中添加图像和表格的方法,但它会在生成的 pdf 中添加一些不必要的单词。如果有人能帮助我,我该如何从 PDF 中删除这些单词。这是我使用下面的方法生成的 pdf 的屏幕截图。
\phantom{~}\noindent
\begin{table}[H]
\begin{adjustbox}{max width=\textwidth}
\begin{tabular}{|l|l|l|l|l|l|}{p{0.2\textwidth}>{\centering}p{0.2\textwidth}>{\centering}p{0.2\textwidth}>{\centering\arraybackslash}p{0.2\textwidth}}
\hline
Feature Extraction & Feature selection & classifier & Accuracy & Precision & Recall \\ \hline
\multirow{7}{*}{400BY400} & \multirow{3}{*}{X} & SVM-RBF & 79 & 79 & 76 \\ \cline{3-6}
& & KNN & 79 & 81 & 69 \\ \cline{3-6}
& & Rf & 72 & 71 & 68 \\ \cline{2-6}
\multirow{7}{*}{} & \multirow{3}{*}{Test_trace} & SVM-RBF & 63 &61 & 52 \\ \cline{3-6}
& & KNN & 66 & 62 & 46 \\ \cline{3-6}
& & RF & 64 & 63 & 58 \\ \cline{2-6}
\multirow{7}{*}{} & \multirow{3}{*}{SVFS} & SVM-RBF & 78 &73 & 76 \\ \cline{3-6}
& & KNN &78 & 79 & 66 \\ \cline{3-6}
& & RF & 80 & 75 & 71 \\ \cline{2-6}
\multirow{7}{*}{} & \multirow{3}{*}{PCA} & SVM-RBF & 58 & 56 & 49 \\ \cline{3-6}
& & KNN & 59 & 56 & 56 \\ \cline{3-6}
& & RF & 56 & 51 & 59 \\ \cline{2-6}
\multirow{7}{*}{} & \multirow{3}{*}{Univariate selection} & SVM-RBF & 71 & 70 & 59 \\ \cline{3-6}
& & KNN & 71 & 72 & 55 \\ \cline{3-6}
& & RF & 70 & 67 & 63 \\ \hline
\end{tabular}
%\caption{$8080$ Image size }
%\label{CH2-beta-ij}
\end{adjustbox}
\end{table}
\begin{figure}[H]
\centering
\includegraphics[height=6cm,width=.9\textwidth]{pic5.JPG}
\caption{$$}
\label{Smooth}
\end{figure}
答案1
我假设您想实现这样的目标:
(红线表示页面布局)
\documentclass{article}
\usepackage{array, multirow}
\usepackage{graphicx}
\usepackage[skip=1ex]{caption}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}
\begin{document}
\begin{table}[htb]
\centering
\caption{$8080$ Image size }
\label{tab:CH2-beta-ij}
\begin{tabular}{|>{\raggedright}m{5em}|
>{\raggedright}m{5em}|l|l|l|l|}
\hline
Feature Extraction
& Feature selection
& classifier
& Accuracy
& Precision
& Recall \\ \hline
\multirow{13}{*}{400BY400}
& \multirow{3}{*}{X}
& SVM-RBF & 79 & 79 & 76 \\ \cline{3-6}
& & KNN & 79 & 81 & 69 \\ \cline{3-6}
& & Rf & 72 & 71 & 68 \\ \cline{2-6}
& \multirow{3}{*}{ some text}
& KNN & 66 & 62 & 46 \\ \cline{3-6}
& & RF & 64 & 63 & 58 \\ \cline{2-6}
& \multirow{3}{*}{SVFS}
& SVM-RBF & 78 & 73 & 76 \\ \cline{3-6}
& & KNN &78 & 79 & 66 \\ \cline{3-6}
& & RF & 80 & 75 & 71 \\ \cline{2-6}
& \multirow{3}{*}{PCA}
& SVM-RBF & 58 & 56 & 49 \\ \cline{3-6}
& & KNN & 59 & 56 & 56 \\ \cline{3-6}
& & RF & 56 & 51 & 59 \\ \cline{2-6}
\multirow{7}{*}{}
& \multirow{3}{=}{Univariate selection}
& SVM-RBF & 71 & 70 & 59 \\ \cline{3-6}
& & KNN & 71 & 72 & 55 \\ \cline{3-6}
& & RF & 70 & 67 & 63 \\ \hline
\end{tabular}
\vspace{2\baselineskip} % <---- or some other vertical space
\includegraphics[height=6cm,width=.9\textwidth]{example-image-duck}
\captionof{figure}{my beautiful duck}
\label{fig:Smooth}
\end{table}
\lipsum[66]
\end{document}
编辑:增加了表格和图像之间的更大空间