In the document I want to apply this to, I have a long glossary, formatted with the longheaderborder
style. Rows of all tables in the document have alternating background colors. I style the top row/header of each table with \rowcolor{headercolor}
. I just can't seem to get it to work with the glossary.
Below is a MWE (not really working though) of what I attempted. The colors used are not the colors I really want to use, but they are very noticeable for this example
I tried redefining the \glossaryheader
with the \rowcolor{blue}
I wanted to use. I also tried to color each cell separately with \cellcolor{red}
. As you may notice, no blue or red occur in the table, only yellow and green of \rowcolors{0}{yellow}{green}
, which I have included to demonstrate that xcolor at least has some effect on the glossary.
So: how can I change the background color of the top row of a glossary, styled with longheaderborder
?
The example:
\documentclass{article}
\usepackage[table]{xcolor}
\usepackage[automake,nogroupskip]{glossaries-extra}
\renewcommand*{\glossaryheader}{\rowcolor{blue} \bfseries Notation & \cellcolor{red} \bfseries Description\\\hline}
\makeglossaries
\newglossaryentry{MWE}{
name={MWE},
description={Minimal working example}
}
\newglossaryentry{ex}{
name={ex.},
description={example}
}
\newglossaryentry{I}{
name={I},
description={the author}
}
\begin{document}
This is a \gls{MWE}. It is an \gls{ex} of what \gls{I} want.
{
\rowcolors{0}{yellow}{green}
\printglossary[style=longheaderborder]
}
\end{document}
\renewcommand*{\glossaryheader}{ \bfseries Notationzzrtt & \cellcolor{red} \bfseries Description\\\hline}
with\renewcommand*\entryname{\cellcolor{blue} Name} \renewcommand*\descriptionname{\cellcolor{red} Description}
should work.\usepackage[english]{babel}
. Replacing\usepackage[automake,nogroupskip]{glossaries-extra}
with\usepackage[automake,nogroupskip,translate=false]{glossaries-extra}
does work, but if I want any translations of the terms, I have to provide them myself. That's fine for now!