如何将两个 CSV 文件并排放在一个表格中?我有以下示例:
\begin{table}[!htb]
\begin{minipage}{2 in}
\begin{tabular}{1|c}
\bfseries Terahertz (THz) & \bfseries Absorbance % specify t able head
\csvreader[head to column names]{TEST1(.25).csv}{}% use head of csv as column names
{\\\hline\csvcoli&\csvcolii}% specify your coloumns here
\end{tabular}
\end{minipage}
\begin{minipage}{2 in}
\begin{tabular}{1|c}
\bfseries Terahertz (THz) & \bfseries Absorbance % specify t able head
\csvreader[head to column names]{TEST1(.25).25.csv}{}% use head of csv as column names
{\\\hline\csvcoli&\csvcolii}% specify your coloumns here
\end{tabular}
\end{minipage}
\end{table}
我已经加载了以下包:
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{csvsimple}
\usepackage{pgf}
答案1
%
在每个小页面后面放置一个,并通过在小页面设置中\end{minipage}
添加可选项,将小页面排列在顶部:[t]
\documentclass{article}
\begin{document}
\begin{table}[!htb]
\small
\begin{minipage}[t]{2.2 in} %%% <--- Align at top
\begin{tabular}[t]{l|c}
\bfseries Terahertz (THz) & \bfseries Absorbance \\% specify t able head
\hline
Terahertz (THz) & Absorbance \\% specify t able head
Terahertz (THz) & Absorbance \\% specify t able head
\hline
\end{tabular}
\end{minipage}%
\begin{minipage}[t]{2.2 in} %%% <--- Align at top
\begin{tabular}[t]{l|c}
\bfseries Terahertz (THz) & \bfseries Absorbance \\% specify t able head
\hline
Terahertz (THz) & Absorbance \\% specify t able head
Terahertz (THz) & Absorbance \\% specify t able head
Terahertz (THz) & Absorbance \\% specify t able head
Terahertz (THz) & Absorbance \\% specify t able head
Terahertz (THz) & Absorbance \\% specify t able head
Terahertz (THz) & Absorbance \\% specify t able head
Terahertz (THz) & Absorbance \\% specify t able head
\hline
\end{tabular}
\end{minipage}%
\end{table}
\end{document}
您的代码,修改如下:
\documentclass{article}
\begin{document}
\begin{table}[!htb]
\begin{minipage}[t]{2 in} %%% <--- Align at top
\begin{tabular}{l|c} %%% <--- change this from 1 to l (figure 1 to letter l)
\bfseries Terahertz (THz) & \bfseries Absorbance
\csvreader[head to column names]{TEST1(.25).csv}{}
{\\\hline\csvcoli&\csvcolii}
\end{tabular}
\end{minipage}% %%% <--- Add per cent sign (%)
\begin{minipage}[t]{2 in} %%% <--- Align at top
\begin{tabular}{l|c} %%% <--- change this from 1 to l
\bfseries Terahertz (THz) & \bfseries Absorbance
\csvreader[head to column names]{TEST1(.25).25.csv}{}
{\\\hline\csvcoli&\csvcolii}
\end{tabular}
\end{minipage}% %%% <--- Add per cent sign (%)
\end{table}
\end{document}