Am Dienstag, 26. Februar 2019 01:35:52 CET schrieb Christian <cde...@gmail.com>:
> Sorry, but I don't see how this solves the problem. This solution
> assumes that the variable allocation is always fixed, so that loading
> the module would be equivalent to have a set of variables
> automatically allocated by "% some stuff to go in the preamble". This
> is not what I was aiming for. The idea is to create some LyX layout
> (environment, or similar, like "Author", or "Abstract"). Is it
> possible to do it?

It is exactly as Riki posted. Look for example in acmsiggraph-0-92.layout
Style "Copyright_year"

        Kornel

> On Fri, Feb 22, 2019 at 10:18 AM Richard Kimberly Heck <rikih...@lyx.org> 
> wrote:
> >
> > On 2/22/19 12:35 AM, Christian wrote:
> > > Hello,
> > >
> > > I am trying to code a module that allocates a variable in the
> > > preamble. More specifically, I am using a package that requires to
> > > allocate a variable in the preamble. For example, if the package is
> > > called "thepackage" and the variable is called "myvariable" my LaTeX
> > > code is:
> > >
> > > \documentclass{book}
> > > \makeatletter
> > > \usepackage{thepackage}
> > > \myvariable{Some stuff here}
> > > \makeatother
> > > \begin{document}
> > > \end{document}
> > >
> > > I know how to define an environment using a module, but that just
> > > includes the definition of the environment in the preamble. I also
> > > tried to use the option
> > >
> > > InPreamble 1
> > >
> > > but that doesn't seem to work.
> >
> > No, you don't want that.
> >
> >
> > > What I am looking for is a LyX
> > > layout/style where I can write "Some stuff here", and that this shows
> > > up in the preamble as \myvariable{Some stuff here}.
> >
> > Just put in your module:
> >
> > AddToPreamble
> >     % some stuff to go in the preamble.
> > EndPreamble
> >
> > Note that this does not go into any style or inset declaration but just
> > sits by itself.
> >
> > Alternatively, if this material is needed only if a certain style is
> > used, then you can put, within that style:
> >
> >     Preamble
> >         % stuff to add to preamble if this style is used
> >     EndPreamble
> >
> > The enumitem module uses both mechanisms, and many of the others use one
> > or the other.
> >
> > Riki
> >
> >
> > >
> > > Right now, I am doing this using ERT boxes and the "title and preamble
> > > hacks" module. I have more than one of those custom variables, so
> > > editing a large ERT box(es) becomes tedious in LyX. Any ideas?
> >
> >
> 

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to