csvsimple csvreader はオプションセパレーターを使用しません

csvsimple csvreader はオプションセパレーターを使用しません

私の 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:

csv自動表形式

\csvreaderタブ付きファイル:

タブ付き csvreader

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

(ファイル名を変更したので、元に戻してください。)

ここに画像の説明を入力してください

関連情報