lyx_mirror/lib/layouts/linguistics.module
Juergen Spitzmueller 91f5d90971 Fix label display in linguistic examples
Ideally, we would use a proper counter here, but this seems to be
impossible with the current counter mechanism.

What we would need is a counter that is incremented when either of the
layouts is used. Currently, the counter seems to be stepped only inside
one layout.

The current fix is a candidate for stable.
2016-10-14 11:45:32 +02:00

276 lines
6.7 KiB
Plaintext

#\DeclareLyXModule[covington.sty,enumitem.sty,forest.sty]{Linguistics}
#DescriptionBegin
#Defines some special environments useful for linguistics (numbered examples,
#glosses, semantic markup, tableau floats).
#See linguistics.lyx file in examples.
#DescriptionEnd
# Author: Jürgen Spitzmüller <spitz@lyx.org>
Format 60
# FIXME: It is currently not possible to share a
# counter in layouts with STATIC and ENUMERATE
# LabelType. The counters are not stepped properly.
Counter example
Within chapter
# LabelString "(\arabic{example})"
LabelString "Examples:"
End
Counter examplei
Within chapter
# LabelString "(\arabic{examplei})"
LabelString "Examples:"
End
Counter subexample
Within examplei
# LabelString "\theexamplei (\alph{subexample})"
LabelString "Subexample:"
End
Counter subexamplei
Within examplei
# LabelString "\theexamplei (\alph{subexamplei})"
LabelString "Subexample:"
End
# single numbered example with covington.sty
Style Numbered_Example_(multiline)
LatexType Environment
LatexName covexample
NextNoIndent 1
Margin Dynamic
LabelSep xx
ParSkip 0.0
ItemSep 0.2
TopSep 0.7
BottomSep 0.7
ParSep 0.3
Align Block
AlignPossible Block, Left
LabelType Static
# LabelCounter "example"
LabelString "Example:"
LabelFont
Shape Italic
Color Blue
EndFont
Requires covington
Preamble
% Backwards compatibility with covington < 1.1
% This code can be removed eventually
\@ifundefined{covexample}{%
\newenvironment{covexample}{\begin{example}}{\end{example}}%
}{}
EndPreamble
Category Linguistics
End
# multiple numbered examples with covington.sty
Style Numbered_Examples_(consecutive)
CopyStyle Numbered_Example_(multiline)
LatexType Item_Environment
LatexName covexamples
LabelType Enumerate
LabelCounter "example"
Argument item:1
LabelString "Custom Numbering|s"
Tooltip "Customize the numeration"
EndArgument
Preamble
% Backwards compatibility with covington < 1.1
% This code can be removed eventually
\@ifundefined{covexamples}{%
\newenvironment{covexamples}{\begin{examples}}{\end{examples}}%
}{}
EndPreamble
End
# multiple numbered example with covington.sty
Style Subexample
CopyStyle Numbered_Examples_(consecutive)
LatexName subexample
LabelCounter "subexample"
Requires covington,enumitem
Preamble
\newenvironment{subexample}{%
\begin{example}\begin{enumerate}[leftmargin=1.7em]
\renewcommand\theenumi{\alph{enumi}}
\renewcommand\labelenumi{(\theenumi)}
\renewcommand\p@enumi{\theequation\,}}%
{\end{enumerate}\end{example}}
EndPreamble
End
# glosse (2 lines) with covington.sty
InsetLayout Flex:Glosse
LyXType custom
LabelString Glosse
LatexType environment
LatexName linggloss
Decoration minimalistic
LabelFont
Size Small
EndFont
MultiPar true
CustomPars false
ForcePlain true
ParbreakIsNewline true
FreeSpacing true
Requires covington
Preamble
\def\glosstr{}
\@ifundefined{linggloss}{%
\newenvironment{linggloss}[2][]{
\def\glosstr{\glt #1}%
\gll #2}
{\glosstr\glend}}{}
EndPreamble
InToc true
ResetsFont true
Argument 1
Decoration conglomerate
LabelString "Translation"
MenuString "Glosse Translation|s"
Tooltip "Add a translation for the glosse"
EndArgument
End
# glosse (3 lines) with covington.sty
InsetLayout Flex:Tri-Glosse
LyXType custom
LabelString Tri-Glosse
LatexType environment
LatexName lingglosss
Decoration minimalistic
LabelFont
Size Small
EndFont
MultiPar true
CustomPars false
ForcePlain true
ParbreakIsNewline true
FreeSpacing true
InToc true
Requires covington
Preamble
\def\glosstr{}
\@ifundefined{lingglosss}{%
\newenvironment{lingglosss}[2][]{
\def\glosstr{\glt #1}%
\glll #2}
{\glosstr\glend}}{}
EndPreamble
ResetsFont true
Argument 1
Decoration conglomerate
LabelString "Translation"
MenuString "Glosse Translation|s"
Tooltip "Add a translation for the glosse"
EndArgument
End
# Structure trees via the forest package
InsetLayout Flex:Structure_Tree
LyXType custom
LabelString Tree
LatexType environment
LatexName forest
Decoration classic
LabelFont
Size Small
EndFont
MultiPar true
CustomPars false
ParbreakIsNewline true
FreeSpacing true
Requires forest
ResetsFont true
PassThruChars []
Preamble
% Load forest linguistics library, if available
\@ifpackagelater{forest}{2016/02/20}{%
\useforestlibrary*{linguistics}
}{}
EndPreamble
End
# Some semantik markup for Semantics
InsetLayout Flex:Expression
LyxType charstyle
LabelString expr.
LatexType command
LatexName lingexpr
Font
Shape Italic
EndFont
Preamble
\newcommand{\lingexpr}[1]{\emph{#1}}
EndPreamble
InToc true
ResetsFont true
End
InsetLayout Flex:Concepts
LyxType charstyle
LabelString concept
LatexType command
LatexName lingconcept
Font
Shape Smallcaps
EndFont
Preamble
\newcommand{\lingconcept}[1]{\textsc{#1}}
EndPreamble
InToc true
ResetsFont true
End
InsetLayout Flex:Meaning
LyxType charstyle
LabelString meaning
LatexType command
LatexName lingmeaning
Requires csquotes
Preamble
\newcommand{\lingmeaning}[1]{\enquote*{#1}}
EndPreamble
InToc true
ResetsFont true
End
# A helper to group words in Glosses
InsetLayout Flex:GroupGlossedWords
LyxType charstyle
LabelString Group
LeftDelim {
RightDelim }
ResetsFont true
End
# Tableaux for Optimality Theory
Float
Type tableau
GuiName Tableau
Placement tbp
Extension otl
NumberWithin none
Style plain
ListName "List of Tableaux"
IsPredefined false
UsesFloatPkg true
End