[texhax] Recording options with pgfkeys
José Romildo Malaquias
j.romildo at gmail.com
Thu May 6 22:53:26 CEST 2010
On Wed, May 05, 2010 at 01:59:35PM +0100, Joseph Wright wrote:
> On 05/05/2010 13:16, José Romildo Malaquias wrote:
> > I want to define some options with pgfkeys in LaTeX. Some keys should be
> > stored in its own macro as well as in a collective macro that could be
> > used later to reuse those options when calling another macro.
> From the context, I don't see why you can't do this relatively easily.
Probably I was not clear about what I want to. Let me try again.
I am writing a LaTeX package to highlight surce code snippets in a LaTeX
document. An external program (Pygments) will be used to do the actual
So I have defined an environment that collects all the code snippets
(with the help of the fancyvrb package) and saves them in an auxiliary
Then the external program pygmentex (that I have written using the
Pygmentex Python module) should be run to process this auxiliary
file. Its results are saved in another file containing LaTeX code
suitable to be input in the original document. My package automatically
does that. Each highlighted source code snippet is saved in a macro .
Back to the LaTeX environment, after saving the original source code
snippet to the auxiliary file, it calls the macro containing the
highlighted source code snippet defined by the external program,
including it into the document.
The environment accepts many options that control the highlighting. Some
options are dealt with by the external program, while other options are
used in the generated LaTeX macro. I need to separate the options passed
to the environment into two sets: one for the external program and
another to the LaTeX macro.
So I want a mechanism to define the options using pgfkeys, and easily
recording them in a macro for future use.
I am attaching a small document as an example of what I want to do. But
it is not fully functional. It always uses the last key of the last
option defined, instead of the current option.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1847 bytes
Desc: not available
More information about the texhax