文献综述摘要使用 tabularray、biblatex 和 functional 进行表格自动化

文献综述摘要使用 tabularray、biblatex 和 functional 进行表格自动化

tabularray我想使用和自动生成下表functional

\begin{filecontents}[overwrite]{\jobname.bib}
@article{key1,
    author = {John Doe and Miles Marsh},
    year = {2012},
    title = {A example of article in biblatex},
}
@article{key2,
    author = {Martha Ackley and Rodrigo Rojas and Rodolph Cardo},
    year = {2015},
    title = {Another example of article in biblatex},
}
@article{key3,
    author = {Alan Doe},
    year = {2019},
    title = {Yet another example of article in biblatex},
}
\end{filecontents}
\documentclass{scrartcl}
\usepackage{tabularray}
    \UseTblrLibrary{functional}
\usepackage{lipsum}
\usepackage[style=apa]{biblatex}
\addbibresource{\jobname.bib}

\newcommand\ColNameauthor{Authors}
\newcommand\ColNameyear{Year}
\newcommand\ColNametitle{Title}
\newcommand\ColNameremark{Remarks}

\IgnoreSpacesOn
\prgNewFunction \RepeatCell {mmm}  {
    \tlSet \lTmpaTl {\intReplicate {\intEval{#1}} {#2 &}}
    \tlPutRight \lTmpaTl {#3\\}
    \tlUse \lTmpaTl
}
\IgnoreSpacesOff

\begin{document}
\begin{talltblr}[
    caption={How the table should look},
    ]{
    colspec = {cX[1]X[1.5]X[2.5]},
    width = \linewidth,
    hline{1,Z} = {solid,0.6pt},
    hline{2} = {solid,0.4pt},
    cell{2-Z}{1} = {c,cmd=\citeyear},
    cell{2-Z}{2} = {c,cmd=\citeauthor},
    cell{2-Z}{3} = {l,cmd=\citetitle},
    row{1} = {cmd={},font=\bfseries,c},
    }
    Year & Authors & Title & Remarks \\
    key1 & key1 & key1 & \lipsum[2][1-2] \\ 
    key2 & key2 & key2 & \lipsum[2][1-2] \\ 
    key3 & key3 & key3 & \lipsum[2][1-2] \\ 
\end{talltblr}

\vspace{5ex}

\begin{talltblr}[
    evaluate = \RepeatCell,
    caption  = {Table using functional},
    ]{
    colspec  = {cX[1]X[1.5]X[2.5]},
    width    = \linewidth,
    hline{1,Z} = {solid,0.6pt},
    hline{2} = {solid,0.4pt},
    cell{2-Z}{1} = {c,cmd=\citeyear},
    cell{2-Z}{2} = {c,cmd=\citeauthor},
    cell{2-Z}{3} = {l,cmd=\citetitle},
    row{1} = {cmd={},font=\bfseries,c},
    }
    \ColNameyear & \ColNameauthor & \ColNametitle & \ColNameremark \\
    \RepeatCell{3}{key1}{\lipsum[2][1-2]}
    \RepeatCell{3}{key2}{\lipsum[2][1-2]}
    \RepeatCell{3}{key3}{\lipsum[2][1-2]}
\end{talltblr}
\end{document}

输出如下:

表输出

我的问题是:

有没有更好的方法来存储字段名称?(列名)以及如果我想要一个像这样工作的环境,我的下一步应该是什么:

\begin{LitReviewTable}[year,author,title,remarks]
   \LiteratureItem{key1}{Remark contents}
   \LiteratureItem{key2}{Remark contents}
\end{LitReviewTable}

并且单元格应该自动重复可选参数中相同数量的字段。

相关内容