Hi:
I have written a layout that is similar to book, but with a new environment,
called exemplo (example in English).
This environment has a "LabelType" of type "counter", and the counter works
nicely almost always, both in LyX screen as in output. I.e. each
new "exemplo" is numbered taking into account the previous "exemplos" and the
chapter.
But it fails when making a cross-reference of one "exemplo". In this case the
exemplo counter is ignored, and the reference is always "1".
Making layouts is not a easy thing, and after some days struggling with them I
am exhausted. So I would be very grateful if somebody explain what goes wrong
with my environment.
Thanks
Ramon
The layout is the following
====================================
livro.layout
#% Do not delete the line below; configure depends on this
# \DeclareLaTeXClass[book]{livro}
Format 2
Input stdclass.inc
Input numreport.inc
Sides 2
PageStyle Headings
NoStyle Abstract
Counter
Name exemplo
Within chapter
End
Style Exemplo
Margin First_Dynamic
LatexType Environment
LatexName exemplo
LabelSep xx
ParIndent MMM
ParSkip indent
ItemSep 0.2
TopSep 0.5
BottomSep 0.5
ParSep 0.3
Align Block
AlignPossible block, left, center, right
LabelType Counter
LabelCounter exemplo
LabelString "Exemplo \arabic{chapter}.\arabic{exemplo}."
LeftMargin MM
RightMargin MM
Font
Family Sans
Shape Upright
Series Medium
Size Small
EndFont
LabelFont
Family Sans
Shape Upright
Series Bold
Size Small
EndFont
Preamble
\newcounter{exemplo}
\setcounter{exemplo}{0}
\newenvironment{exemplo}
{
\begin{list}{}
{
\setlength{\leftmargin}{5mm}
\setlength{\rightmargin}{\leftmargin}
\setlength{\parindent}{0mm}
\upshape
\sffamily
\small
}
\item[]
\addtocounter{exemplo}{1}
\textbf{Exemplo \thechapter .\theexemplo}
}
{
\par
\end{list}
}
EndPreamble
End
Style Bibliography
TopSep 4
LabelString "Bibliography"
LabelFont
Series Bold
Size Huge
EndFont
End