Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow an empty color parameter in \columncolor #58

Open
tro100 opened this issue Oct 25, 2024 · 0 comments
Open

Allow an empty color parameter in \columncolor #58

tro100 opened this issue Oct 25, 2024 · 0 comments

Comments

@tro100
Copy link

tro100 commented Oct 25, 2024

How about allowing for an empty color parameter to specify no column color.
This would be very useful for defining column types that may be colored, for instance
\newcolumntype{L}[1]{>{\columncolor{#2}}l}
which then can be used also for columns without coloring.
For the use of \columncolor without optional parameters this could be done by changing the definition of \CT@extract as follows (inserted lines marked as inserted)

\def\CT@extract#1\columncolor#2#3\@nil{%
	\if!\noexpand#2%
		\let\CT@column@color\@empty%
	\else%
		\if[\noexpand#2%
			\CT@extractb{#1}#3\@nil%
		\else%
			\if\relax\detokenize{#2}\relax% inserted
				\let\CT@column@color\@empty% inserted
			\else% inserted
				\def\CT@column@color{%
						\CT@color{#2}}%
			\fi% inserted
			\CT@extractd{#1}#3\@nil%
		\fi%
	\fi%
}%

For the use of \columncolor with optional parameters

\def\CT@extractb#1#2]#3{%
	\if\relax\detokenize{#2}\relax% inserted
		\let\CT@column@color\@empty% inserted
	\else% inserted
		\def\CT@column@color{%
			\CT@color[#2]{#3}}%
	\fi% inserted
	\CT@extractd{#1}%
}%

should do the trick (although I haven't tested this).

Best regards
Rene

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant