LaTeX 混合图像和表格组

LaTeX 混合图像和表格组

下面的代码应该显示五幅图像、一张表格、另外五幅图像和一张表格。出于某种原因,LaTeX 首先显示图像(全部 10 幅),然后显示两张表格。解决这个问题的唯一方法是将它们分散到两页中,这样它们就可以正确显示,但我希望它们出现在同一页中。LaTeX 将它们单独合并在一起有什么原因吗?

\documentclass[a4paper,10pt]{scrartcl}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{graphicx}
\usepackage{fix-cm}
\usepackage[font=scriptsize]{caption}
\usepackage[margin=0.5in]{geometry}
\usepackage[normalem]{ulem}
\graphicspath{ {images/} }
\setlength{\tabcolsep}{2pt}

\begin{document}
\begin{figure}[!tbp]
\noindent\rule{18.9cm}{0.1pt}
\newline
\hspace{10em}\uline{\textsc{Group1}\hfill}
\break \break \break
\hfill
\begin{minipage}[b]{0.18\textwidth}
\includegraphics[width=\textwidth]{img1}
\caption*{img1}
\end{minipage}
\hfill
\begin{minipage}[b]{0.18\textwidth}
\includegraphics[width=\textwidth]{img2}
\caption*{img2}
\end{minipage}
\hfill
\begin{minipage}[b]{0.18\textwidth}
\includegraphics[width=\textwidth]{img3}
\caption*{img3}
\end{minipage}
\hfill
\begin{minipage}[b]{0.18\textwidth}
\includegraphics[width=\textwidth]{img4}
\caption*{img4}
\end{minipage}
\hfill
\begin{minipage}[b]{0.18\textwidth}
\includegraphics[width=\textwidth]{img5}
\caption*{img5}
\end{minipage}
\end{figure}
\begin{table}[ht]
\miniscule
\caption*{Group1}
\hspace*{-.5cm}
\scalebox{0.9}{
\begin{tabular}{p{2.5cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}}
\toprule
\field1 & \field2 & field3 & field4 & \textbf{6M} &  \textbf{3M}&  \textbf{1W} &  \textbf{5} &  \textbf{6} & \textbf{7} & \textbf{8} & \textbf{ROE} & \textbf{9} & \textbf{10} & \textbf{1} \\
\midrule
Estee & 88.56 & -9.14 & 8.13 & -5.08 & .19 & 1.32 & 33,068 & 29.93 & 1.36 & 19.23 & 30.90 & N/A & N/A & N/A
\\
\midrule
\end{tabular}}
\end{table}

\begin{figure}[!tbp]
\noindent\rule{18.9cm}{0.1pt}
\newline
\hspace{10em}\uline{\textsc{Group2}\hfill}
\break \break \break
\hfill
\begin{minipage}[b]{0.18\textwidth}
\includegraphics[width=\textwidth]{img6}
\caption*{img6}
\end{minipage}
\hfill
\begin{minipage}[b]{0.18\textwidth}
\includegraphics[width=\textwidth]{img7}
\caption*{img7}
\end{minipage}
\hfill
\begin{minipage}[b]{0.18\textwidth}
\includegraphics[width=\textwidth]{img8}
\caption*{img8}
\end{minipage}
\hfill
\begin{minipage}[b]{0.18\textwidth}
\includegraphics[width=\textwidth]{img9}
\caption*{img9}
\end{minipage}
\hfill
\begin{minipage}[b]{0.18\textwidth}
\includegraphics[width=\textwidth]{img10}
\caption*{img10}
\end{minipage}
\end{figure}
\begin{table}[ht]
\miniscule
\caption*{Group2}
\hspace*{-.5cm}
\scalebox{0.9}{
\begin{tabular}{p{2.5cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}}
\toprule
\field1 & \field2 & field3 & field4 & \textbf{6M} &  \textbf{3M}&  \textbf{1W} &  \textbf{5} &  \textbf{6} & \textbf{7} & \textbf{8} & \textbf{ROE} & \textbf{9} & \textbf{10} & \textbf{1} \\
\midrule
test & 155.26 & -40.39 & -27.10 & -16.73 & -5.89 & 2.32 & 1,975 & 23.33 & -- & 19.90 & 18.98 & N/A & N/A & N/A
\\
\midrule
test & 47.44 & -13.04 & -5.30 & -2.18 & .47 & 1.91 & 19,224 & 18.09 & 1.43 & 35.31 & 69.54 & N/A & N/A & N/A
\\
\midrule
Constellation & 166.49 & -1.29 & 28.07 & 10.61 & 7.77 & 1.43 & 33,963 & 33.42 & 0.96 & 32.81 & 17.74 & N/A & N/A & N/A
\\
\midrule
\end{tabular}}
\end{table}

\end{document}

答案1

您已指定数字必须浮动,则它们不能放置在源中出现的位置([!tbp]),但相反,您已指定表格可以放在“此处”,但不能放在浮动页面上或页面底部([ht]

因此,在这种情况下,表格使用定位h,但图形浮动到页面顶部。所以您首先会获得全部 10 张图片。

没有可选参数的默认行为产生

在此处输入图片描述

\documentclass[a4paper,10pt]{scrartcl}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage[demo]{graphicx}
\usepackage{fix-cm}
\usepackage[font=scriptsize]{caption}
\usepackage[margin=0.5in]{geometry}
\usepackage[normalem]{ulem}
\graphicspath{ {images/} }
\setlength{\tabcolsep}{2pt}
\def\field{}
\def\miniscule{}


\begin{document}
\begin{figure}
\noindent\rule{18.9cm}{0.1pt}
\newline
\hspace{10em}\uline{\textsc{Group1}\hfill}
\break \break \break
\hfill
\begin{minipage}[b]{0.18\textwidth}
\includegraphics[width=\textwidth]{img1}
\caption*{img1}
\end{minipage}
\hfill
\begin{minipage}[b]{0.18\textwidth}
\includegraphics[width=\textwidth]{img2}
\caption*{img2}
\end{minipage}
\hfill
\begin{minipage}[b]{0.18\textwidth}
\includegraphics[width=\textwidth]{img3}
\caption*{img3}
\end{minipage}
\hfill
\begin{minipage}[b]{0.18\textwidth}
\includegraphics[width=\textwidth]{img4}
\caption*{img4}
\end{minipage}
\hfill
\begin{minipage}[b]{0.18\textwidth}
\includegraphics[width=\textwidth]{img5}
\caption*{img5}
\end{minipage}
\end{figure}
\begin{table}
\miniscule
\caption*{Group1}
\hspace*{-.5cm}
\scalebox{0.9}{%%%%%%%
\begin{tabular}{p{2.5cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}}
\toprule
\field1 & \field2 & field3 & field4 & \textbf{6M} &  \textbf{3M}&  \textbf{1W} &  \textbf{5} &  \textbf{6} & \textbf{7} & \textbf{8} & \textbf{ROE} & \textbf{9} & \textbf{10} & \textbf{1} \\
\midrule
Estee & 88.56 & -9.14 & 8.13 & -5.08 & .19 & 1.32 & 33,068 & 29.93 & 1.36 & 19.23 & 30.90 & N/A & N/A & N/A
\\
\midrule
\end{tabular}}
\end{table}

\begin{figure}
\noindent\rule{18.9cm}{0.1pt}
\newline
\hspace{10em}\uline{\textsc{Group2}\hfill}
\break \break \break
\hfill
\begin{minipage}[b]{0.18\textwidth}
\includegraphics[width=\textwidth]{img6}
\caption*{img6}
\end{minipage}
\hfill
\begin{minipage}[b]{0.18\textwidth}
\includegraphics[width=\textwidth]{img7}
\caption*{img7}
\end{minipage}
\hfill
\begin{minipage}[b]{0.18\textwidth}
\includegraphics[width=\textwidth]{img8}
\caption*{img8}
\end{minipage}
\hfill
\begin{minipage}[b]{0.18\textwidth}
\includegraphics[width=\textwidth]{img9}
\caption*{img9}
\end{minipage}
\hfill
\begin{minipage}[b]{0.18\textwidth}
\includegraphics[width=\textwidth]{img10}
\caption*{img10}
\end{minipage}
\end{figure}
\begin{table}
\miniscule
\caption*{Group2}
\hspace*{-.5cm}
\scalebox{0.9}{%%%%%%%%%
\begin{tabular}{p{2.5cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}}
\toprule
\field1 & \field2 & field3 & field4 & \textbf{6M} &  \textbf{3M}&  \textbf{1W} &  \textbf{5} &  \textbf{6} & \textbf{7} & \textbf{8} & \textbf{ROE} & \textbf{9} & \textbf{10} & \textbf{1} \\
\midrule
test & 155.26 & -40.39 & -27.10 & -16.73 & -5.89 & 2.32 & 1,975 & 23.33 & -- & 19.90 & 18.98 & N/A & N/A & N/A
\\
\midrule
test & 47.44 & -13.04 & -5.30 & -2.18 & .47 & 1.91 & 19,224 & 18.09 & 1.43 & 35.31 & 69.54 & N/A & N/A & N/A
\\
\midrule
Constellation & 166.49 & -1.29 & 28.07 & 10.61 & 7.77 & 1.43 & 33,963 & 33.42 & 0.96 & 32.81 & 17.74 & N/A & N/A & N/A
\\
\midrule
\end{tabular}}
\end{table}

\end{document}

相关内容