![为何我的小页面不起作用?](https://linux22.com/image/408372/%E4%B8%BA%E4%BD%95%E6%88%91%E7%9A%84%E5%B0%8F%E9%A1%B5%E9%9D%A2%E4%B8%8D%E8%B5%B7%E4%BD%9C%E7%94%A8%EF%BC%9F.png)
我就是无法让我的迷你页面工作。我想将两个表格并排放置 - 这是最简单的方法,因为我的 LateX 技能是“基础”。因此,我基本上遵循了有关如何创建迷你页面的说明。我只是不知道 longtable 是否在其中工作。此外,由于我在表格中使用的字体与文本中的字体不同,因此需要 sffamily。关于如何解决这个问题有什么想法吗?提前谢谢。
\begin{table}[!htb]
\caption{Global caption}
\begin{minipage}{.5\linewidth}
\caption{Caption of longtable}\\
\centering
\sffamily
\scriptsize
\begin{longtable}{lllll}
\hline
0 & 0 & 0 & 0 \\\\\hline
Example 1 & & & \\\\
1 & 2 & 3 & 4 \\\\
\\hline
\end{longtable}
}
\end{minipage}%
\begin{minipage}{.5\linewidth}
\caption{Caption for longtable}\\\\
\centering
\sffamily
\scriptsize
\begin{longtable}{lllll}
\hline
0 & 0 &0 & 0. \\\\\hline
Example 2 & & & \\\\
1 & 2 & 3 & 4 \\\\
\\hline
\end{longtable}
}
\end{minipage}
\end{table}
答案1
清理代码后,我得到以下结果:
(红线表示文字边框)
\documentclass{article}
\usepackage[skip=1ex,
labelfont=bf,font=small]{caption} % <--- new
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\begin{table}[!htb]
\caption{Global caption}
\begin{minipage}{.5\linewidth}
\caption{Caption of the left table}
\centering
\sffamily
\begin{tabular}{ll ll}
\hline
0 & 0 & 0 & 0 \\
\hline
Example 1 & & & \\
1 & 2 & 3 & 4 \\
\hline
\end{tabular}
\end{minipage}%
\begin{minipage}{.5\linewidth}
\caption{Caption of the right table}
\centering
\sffamily
\begin{tabular}{ll ll}
\hline
0 & 0 & 0 & 0. \\
\hline
Example 2 & & & \\
1 & 2 & 3 & 4 \\
\hline
\end{tabular}
\end{minipage}
\end{table}
\end{document}
不过,我怀疑你喜欢并行有两个子表:
\documentclass{article}
\usepackage[skip=1ex,
labelfont=bf,font=small]{caption} % <--- new
\usepackage{subcaption}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\begin{table}[!htb]
\caption{Global caption}
\begin{subtable}[t]{.5\linewidth}
\caption{Caption of the left table}
\centering
\sffamily
\begin{tabular}{ll ll}
\hline
0 & 0 & 0 & 0 \\
\hline
Example 1 & & & \\
1 & 2 & 3 & 4 \\
\hline
\end{tabular}
\end{subtable}%
\begin{subtable}[t]{.5\linewidth}
\caption{Caption of the right table}
\centering
\sffamily
\begin{tabular}{ll ll}
\hline
0 & 0 & 0 & 0. \\
\hline
Example 2 & & & \\
1 & 2 & 3 & 4 \\
\hline
\end{tabular}
\end{subtable}
\end{table}
\end{document}