2

How do you put two CSV files as a table next to each other? I have the sample effort:

\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}

I have these packages loaded:

\usepackage{graphicx}
\usepackage{longtable}
\usepackage{csvsimple}
\usepackage{pgf}
1
  • You can put the two minipages in a two-column tabular.
    – Sveinung
    Commented Jun 6, 2019 at 21:32

1 Answer 1

5

Put a % after each \end{minipage} and align the minipages at top by adding the optional [t] in the minipage setup:

\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}

enter image description here

Your code, modified:

\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}
2
  • I have information from a CSV which I have getting information, and I don't see CSV reader in it? Commented Jun 6, 2019 at 22:12
  • @EnlightenedFunky I could not compile your code, because you did not enclose the datafile. I have included your original code in my answer. Remember to always include a MWE, not only code fragments.
    – Sveinung
    Commented Jun 6, 2019 at 22:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .