我想使用行号突出显示特定行,csvsimple-l3
但我不知道该怎么做。例如,我需要加粗第 4 行,但我不想添加
row{4} = {font=\bfseries}
因为mycsvstyle
我会将这种样式用于其他表格。如何定义宏来使用行号设置我想要的行的样式?
\documentclass[12pt]{article}
\usepackage{tabularray}
\usepackage{xcolor}
\usepackage{pgfplotstable}
\usepackage{csvsimple-l3}
\begin{filecontents*}{report.csv}
"PRODUCT_CODE","PRODUCT_NAME","LIST_PRICE","DISCOUNT_PERCENT"
"sg","Gibson SG","2517","52"
"fg700s","Yamaha FG700S","489.99","39"
"rodriguez","Rodriguez Caballero 11","415","38"
"strat","Fender Stratocaster","699","30"
"les_paul","Gibson Les Paul","1299","30"
"ludwig","Ludwig 5-piece Drum Set with Cymbals","699.99","30"
"precision","Fender Precision","799.99","30"
"hofner","Hofner Icon","499.99","25"
"tama","Tama 5-Piece Drum Set with Cymbals","799.99","15"
"washburn","Washburn D10S","299","0"
\end{filecontents*}
\definecolor{codebgtable}{HTML}{F2F2F2}
\csvstyle{mycsvstyle}{
respect underscore,
before reading={\catcode`\"=9},
after reading={\catcode`\"=13},
no head,
tabularray = {
rowsep=5pt,colsep=9pt,
stretch=1.3,
%hlines,
vlines,
row{odd} = {codebgtable},
row{1} = {codebgtable, font=\bfseries, halign = c},
},
table head = {\hline},
table foot = {\hline},
late after first line = {\\\hline},
}
\begin{document}
\begin{table}[h!]
\centering
\resizebox{1.\textwidth}{!}{
\csvreader[mycsvstyle]{report.csv}{
%if \thecsvrow = 4 \setrow{\bfseries}
}{
\csvlinetotablerow
}
}
\end{table}
\end{document}