On 2019-04-26, Paul A. Rubin wrote:
> On 4/26/19 4:16 PM, Paul Smith wrote:
>> Dear All,
>> Suppose that I have created a new enumerate-like enumerate, say
>> xenumerate. How can I use it from inside LyX without recourse to ERT?
>> Thanks in advance,
>> Paul
> A couple of possibilities come to mind. If you want to use the new
> version exclusively (and not use good old "enumerate"), you could
> redefine the enumerate environment itself. Assuming you want xenumerate
> to coexist with enumerate, you can define a layout for it, either in the
> Local Layout portion of the document settings (if you only want it for
> one document) or in a module file installed in your local layouts directory.
> Guessing that you want the last one (i.e., add this along side regular
> enumerations and make it available to any document that wants it), I
> would suggest looking at /usr/share/lyx/layouts/stdlists.inc for
> inspiration. (That's the Linux path; on other OSes, your path may
> differ.) Look for the section that begins "Style Enumerate" and copy it
> to your local module file (which will also need the proper header
> stuff). Change the first line of the style to "Style Xenumerate" (or
> whatever), change the LatexName entry to "xenumerate", and see if
> anything else needs tweaking (quite possibly not).
It may help to have a look a the "enumitem" module that enhances enumeration
environments.
The appended gm-lists.module requires and uses enumitem to define
additional list types. It is a bit dated, though.
> Help > Customization has lots of details about creating your own modules
> and paragraph styles. Note that you will have to expressly include the
> module in any document where you want to use the style. (You could hack
> stdlists.inc itself, but then you would need to repeat the hack any time
> an upgrade/reinstallation overwrote /usr/share/lyx/layouts.)
Günter
#\DeclareLyXModule{gmlists}
#DescriptionBegin
# Adds quoted-list and condensed list environments.
#DescriptionEnd
#Requires: enumitem
#Author: Günter Milde <[email protected]>
# date: 2008-12-04
# last update: 2016-07-21
Format 49
# Style Variants
# ==============
Style Enumerate-Alpha
CopyStyle Enumerate
LatexParam "[label=\emph{\alph*}),ref=\emph{\alph*},fullwidth,itemsep=1ex]"
Margin First_Dynamic
LeftMargin xxxx
LabelCounter enumi
LabelString "\alph{enumi})"
LabelFont
Series Medium
Shape Italic
EndFont
End
# Dense (condensed/compact) list environments
# ===========================================
Style Itemize-Compact
CopyStyle Itemize
Argument 1
LabelString "Enumerate Options"
Tooltip "Optional arguments for this list (see enumitem
manual)"
PresetArg noitemsep
EndArgument
ParSep 0
TopSep 0.4
BottomSep 0.4
End
Style Enumerate-Compact
CopyStyle Enumerate
Argument 1
LabelString "Enumerate Options"
Tooltip "Optional arguments for this list (see enumitem
manual)"
PresetArg noitemsep
EndArgument
ParSep 0
TopSep 0.4
BottomSep 0.4
End
Style Description-Compact
CopyStyle Description
Argument 1
LabelString "Enumerate Options"
Tooltip "Optional arguments for this list (see enumitem
manual)"
PresetArg noitemsep
EndArgument
ParSep 0
TopSep 0.4
BottomSep 0.4
End
# Indented compact LyX-List environment
Style Quoted-Labeling
CopyStyle Labeling
LatexName qlyxlist
ItemSep 0
ParSep 0
LabelIndent MMM
Preamble
% labeling-like list based on enumitem's description list with
% mandatory second argument (label-pattern) and indent of 2em:
\newenvironment{qlyxlist}[2][]%
{\settowidth{\lyxlabelwidth}{#2}
\addtolength{\lyxlabelwidth}{1.5em}
\description[font=,style=sameline,
leftmargin=\lyxlabelwidth,
noitemsep, labelindent=1.5em,
#1]}
{\enddescription}
EndPreamble
End
# Backwards compatibility aliases:
Style Compact-Itemize
ObsoletedBy Itemize-Compact
End
Style Itemize-Dense
ObsoletedBy Itemize-Compact
End
Style Compact-Enumerate
ObsoletedBy Enumerate-Compact
End
Style Enumerate-Dense
ObsoletedBy Enumerate-Compact
End
Style Compact-Description
ObsoletedBy Description-Compact
End
Style Description-Dense
ObsoletedBy Description-Compact
End
# Description with italic label was a failed experiment:
Style Description-Italic
ObsoletedBy Description
End
Style Quoted-List
ObsoletedBy Quoted-Labeling
End