我制作了以下文档,包含 2 个表格,共 2 列:
代码:
\documentclass{article}
\usepackage[a5paper]{geometry}
\geometry{verbose,tmargin=1cm,bmargin=1.5cm,lmargin=0.7cm,rmargin=0.7cm}
\setlength{\parindent}{0cm}
\usepackage{multicol}
\begin{document}
\begin{centering}
\begin{multicols}{2}
\begin{tabular}{ | c | c|c|c| }
\hline
i & 1 & 2 & 3\\
\hline
$V$ & 10 & 8 & 12\\
\hline
\end{tabular}
\begin{table}[h!]
\begin{tabular}{ |c|c|c|c| }
\hline
i & 1 & 2 & 3\\
\hline
$N_2$ & 1 & 0 & 1\\
\hline
\end{tabular}
\end{table}
\end{multicols}
\par
\end{centering}
\end{document}
如何在每个标题下放置 \captions ,如下所示:
我尝试将 \tabular 包装到 \table 环境中,但是表格却消失了。
答案1
基于 Danie-Els 提供的代码相关问题,我想出了这个解决方案:
\documentclass[]{article}
\usepackage[a5paper]{geometry}
\usepackage{multicol}
\usepackage[english]{babel}
\usepackage{blindtext}
\begin{document}
\begin{table}
\centering
\makebox[0pt][c]{\parbox{0.9\textwidth}{%
\begin{minipage}[b]{0.45\textwidth}
\centering
\begin{tabular}{ | c | c|c|c| }
\hline
i & 1 & 2 & 3\\
\hline
$V$ & 10 & 8 & 12\\
\hline
\end{tabular}
\caption{xxx}
\label{tab:first}
\end{minipage}
\hfill
\begin{minipage}[b]{0.45\textwidth}
\centering
\begin{tabular}{ |c|c|c|c| }
\hline
i & 1 & 2 & 3\\
\hline
$N_2$ & 1 & 0 & 1\\
\hline
\end{tabular}
\caption{xxxx}
\label{tab:second}
\end{minipage}
}}
\end{table}
\begin{multicols}{2}
\blindtext[5]
\end{multicols}
\end{document}