
私の csv はタブで区切られています。
\csvautotabular
オプションを使用してロードすると正常に動作します。ただし、ドキュメントの例のようseparator=tab
に でロードすると、最初のデータ行のみが出力されます。\csvreader
出力を確認するための写真は最後に添付されています。
タブ付きのファイル (table-data/parse_size_out.tsv):
benchmark num_post_packed_blocks num_clb
ch_intrinsics.v 295 65
diffeq1.v 299 36
diffeq2.v 198 29
mkPktMerge.v 509 27
raygentop.v 634 106
stereovision3.v 54 13
カンマで再フォーマット (table-data/parse_size_out_commas.csv):
benchmark,num_post_packed_blocks,num_clb
ch_intrinsics.v,295,65
diffeq1.v,299,36
diffeq2.v,198,29
mkPktMerge.v,509,27
raygentop.v,634,106
stereovision3.v,54,13
MWE:
\documentclass{article}
\usepackage{csvsimple}
\begin{document}
\csvautotabular[
separator=tab,
respect underscore=true
]{table-data/parse_size_out.tsv}
\vspace{1cm}
\begin{tabular}{|l|c|}\hline%
\bfseries Benchmark & \bfseries \#blocks
\csvreader[
separator=tab,
respect underscore=true,
head to column names
]{table-data/parse_size_out.tsv}{benchmark=\benchmark,num_post_packed_blocks=\numblocks}{%
\\\benchmark & \numblocks
}%
\\\hline
\end{tabular}
\vspace{1cm}
\begin{tabular}{|l|c|}\hline%
\bfseries Benchmark & \bfseries \#blocks
\csvreader[
respect underscore=true,
head to column names
]{table-data/parse_size_out_commas.csv}{benchmark=\benchmark,num_post_packed_blocks=\numblocks}{%
\\\benchmark & \numblocks
}%
\\\hline
\end{tabular}
\end{document}
\csvautotabular
:
\csvreader
タブ付きファイル:
\csvreader
カンマ付きのファイルの場合:
答え1
(メンテナンスされた)l3
バージョンをロードする必要があります。
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[l3]{csvsimple}
\begin{document}
\csvautotabular[
separator=tab,
respect underscore=true
]{a.tsv}
\vspace{1cm}
\begin{tabular}{|l|c|}\hline
\bfseries Benchmark & \bfseries \#blocks
\csvreader[
separator=tab,
respect underscore=true,
head to column names
]{a.tsv}{benchmark=\benchmark,num_post_packed_blocks=\numblocks}{%
\\\benchmark & \numblocks
}
\\\hline
\end{tabular}
\vspace{1cm}
\begin{tabular}{|l|c|}\hline
\bfseries Benchmark & \bfseries \#blocks
\csvreader[
respect underscore=true,
head to column names
]{b.csv}{benchmark=\benchmark,num_post_packed_blocks=\numblocks}{%
\\\benchmark & \numblocks
}
\\\hline
\end{tabular}
\end{document}
(ファイル名を変更したので、元に戻してください。)