使用模板,以便每个表的标题行具有紫色背景和白色文本

时间:2020-01-14 16:39:52

标签: latex markdown pandoc tex pdflatex

我希望所有文档中每个表格的第一行都具有紫色背景和白色文本。

我正在转换一堆Markdown文档,其中大多数包含表格。我一直在使用Pandoc将PDF与名为Eisvogel的TeX模板一起使用,该模板一直在进行修改。我相信Pandoc正在使用pdfTeX。 (我对所有这些都比较陌生,所以如果这个问题应该在其他地方,请提前原谅我!)

模板:https://github.com/Wandmalfarbe/pandoc-latex-template/blob/master/eisvogel.tex

我正在努力实现这一目标(用言语表达) Desired table format

这是相关的部分,我已经设法对其进行了一些修改,以使白色交替行排在第一位,并且我有规则变成紫色(请牢记我的话)。

% tables

$if(tables)$
\definecolor{table-head-color}{HTML}{551a55} % Purple for the header row
\definecolor{table-row-color}{HTML}{F5F5F5}
\definecolor{table-rule-color}{HTML}{551a55}

%\arrayrulecolor{black!40}
\arrayrulecolor{table-rule-color}     % color of \toprule, \midrule, \bottomrule
\setlength\arrayrulewidth{0ex} % thickness of midrule?
\setlength\heavyrulewidth{0ex}      % thickness of \toprule, \bottomrule
\renewcommand{\arraystretch}{1.3}     % spacing (padding)

$if(table-use-row-colors)$
\let\oldlongtable\longtable
\let\endoldlongtable\endlongtable
\renewenvironment{longtable}{
\rowcolors{3}{table-row-color!100}{}  % row color
% \rowcolor{table-head-color!100} % This produces an error
\oldlongtable} {
\endoldlongtable
\global\rownum=0\relax}
$endif$
$endif$

我的降价:

|Insert a | table | with | multiple | columns |
| --- |---|---|---|---|
|and some | content that will span several lines if possible because it's too large to fit | to go | with | it |
|This is | an | example | of such | A table |

导致:

enter image description here

有没有一种方法可以将表的第一行设置为具有上述属性?

我调查了Tabu,其中有\ taburowcolors可能有用吗?该文档使我头疼!

0 个答案:

没有答案