I am using an overridden table environment based on tabular
to get some custom cell coloring based on row alternation (similar to what rowcolors
does, but also allowing column color variation at the same time). This works well under the assumption that the new environment definition (which I provide to the Org document using \newenvironment
wrapped in a #BEGIN_EXPORT latex/#+END_EXPORT
) has only one argument (skeleton below):
\newenvironment{mytable}[1]
{%
%... some setup logic
%\begin{tabular}{!\myrowlogic #1}%
}%
{\end{tabular}}%
I can then apply this by leveraging the :environment
and :align
attributes:
#+ATTR_LATEX: :environment mytable :align Z{red!30}Z{green!30}
| foo | bar |
| baz | qux |
I would now like to modify the newenvironment
logic to allow an additional argument to be passed. I am a newcomer to LaTeX but did succeed in getting the shell of what I want by modifying the Org-exported LaTeX:
\newenvironment{mytable}[2][]
{%
%... some setup logic and tests for optional parameter #1
%\begin{tabular}{!\myrowlogic #2}%
}%
{\end{tabular}}%
and call it via
\begin{mytable}[some additional data]{Z{red!30}Z{green!30}}
Note that I am directly editing the environment in LaTeX, not exporting from Org (which I'd like to do). The missing piece is passing the additional optional argument using Org export with markup. So far I have been unsuccessful using #+ATTR_LATEX
. Is this achievable using that or some other mechanism?