在所示表格中,我想删除第二行和第三行的灰色“标题栏”。我该怎么做?
\documentclass{beamer}
\usepackage{tcolorbox,csvsimple}
\begin{document}
\begin{filecontents*}[overwrite]{\jobname.csv}
{${{\lambda}= 2 l}$},{${f_{0} = 1\cdot {\dfrac{c}{2l}}}$}
{${{\lambda}= l}$},{${f_{1} =2\cdot {\dfrac{c}{2l}}}$}
{${{\lambda}= \dfrac23 \cdot l}$},{${f_{2} = 3 \cdot {\dfrac{c}{2l}}}$}
\end{filecontents*}
\tcbset{before=,after=,colback=white,height=5em,valign=center,colframe=gray}
\begin{frame}{Stehende Welle mit 2 festen Enden}
\csvreader[no head]{\jobname.csv}{}{
{\begin{tcolorbox}[width=.45\linewidth,left=1em,title={\csviffirstrow{Wellenlänge}}] \csvcoli \end{tcolorbox}}
{\begin{tcolorbox}[width=.45\linewidth,left=1em,title={\csviffirstrow{Frequenz}}] \csvcolii \end{tcolorbox}}}
\end{frame}
\end{document}
答案1
有必要使用 来将第一行与其他行区分开来\csviffirstrow
。
\documentclass{beamer}
\usepackage{csvsimple}
\usepackage[most]{tcolorbox}
\begin{document}
\begin{filecontents*}[overwrite]{\jobname.csv}
{${{\lambda}= 2 l}$},{${f_{0} = 1\cdot {\dfrac{c}{2l}}}$}
{${{\lambda}= l}$},{${f_{1} =2\cdot {\dfrac{c}{2l}}}$}
{${{\lambda}= \dfrac23 \cdot l}$},{${f_{2} = 3 \cdot {\dfrac{c}{2l}}}$}
\end{filecontents*}
\tcbset{
before=,
after=,
colback=white,
height=5em,
valign=center,
colframe=gray,
width=.45\linewidth,
left=1em,
raster columns=2,raster rows=1,
raster equal skip=1mm,
}
\begin{frame}{Stehende Welle mit 2 festen Enden}
\csvreader[no head]{\jobname.csv}{}{%
\csviffirstrow{%
\begin{tcbitemize}
\tcbitem[title=Wellenlänge] \csvcoli
\tcbitem[title= Frequenz] \csvcolii
\end{tcbitemize}
}{%
\begin{tcbitemize}
\tcbitem[title=] \csvcoli
\tcbitem[title=] \csvcolii
\end{tcbitemize}
}}
\end{frame}
\end{document}