RGH wrote:
Andrés Becerra Sandoval wrote:I'm not sure if there is a solution to this problem at present. I've seen this behavior myself, though, with other layouts, and thought there ought to be an equivalent to LaTeX's /numberwithin sort of command. I don't believe LyX has that yet, though. I'd be receptive to an enhancement request on bugzilla, though, if you want to file one. You can cc me on it, to make sure I see it. I'm guessing, in fact, that JMarc could do this pretty quickly.Hello,I have been fighting a little bit to create a layout for exam (http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=exam) So far I have a *small* layout with two styles, one for questions and another for solutions. In the jpg attached you can see the output generated by latex for the small example exam.lyx. As you can see in lyx, the numbering of the questions is reseted when a different style (solution) is inserted betwenn two questions, howeber the latex output is numbering correctly the questions. How can this be solved?
There's a way (in LyX 1.5.6), but the cure may be worse than the disease. The solution I found is:
(a) change the Question style from LatexType Command to LatexType Environment;
(b) change the Question style from LabelType Enumerate to LabelType Counter; (c) add 'LabelString \arabic{question}.' to the Question style; (d) copy Style --Separator-- from stdlayouts.inc into your layout;(e) when inserting a Solution, nest it under the Question it solves; and (here comes the painful part)
(f) insert a --Separator-- environment after each Question. I'm attaching hacked copies of the layout and .lyx files. /Paul
#% Do not delete the line below; configure depends on this # \DeclareLaTeXClass{exam} # exam textclass definition file. # Author : Andrés Becerra ([EMAIL PROTECTED]) # General textclass parameters Format 4 Columns 1 Sides 1 SecNumDepth -1 TocDepth -1 # Standard style definition Style Standard Margin Static LatexType Paragraph LatexName dummy ParIndent MM ParSkip 0.4 Align Block AlignPossible Block, Left, Right, Center LabelType No_Label End Input stdcounters.inc Counter Name question End Style Question Margin Dynamic # LatexType Command LatexType Environment LatexName question OptionalArgs 1 ParSkip 0.4 Align Block # LabelType Enumerate LabelType Counter LabelString \arabic{question}. LabelCounter question LabelFont Series Bold Color Blue EndFont End Style Solution Margin Dynamic LatexType Environment LatexName solution OptionalArgs 1 ParSkip 0.4 Align Block LabelType Static LabelString "solution:" LabelFont Series Bold EndFOnt End Style --Separator-- KeepEmpty 1 Margin Dynamic LatexType Paragraph LatexName dummy ParIndent MM Align Block AlignPossible Block LabelType Static LabelString "--- Separate Environment ---" LabelFont Family Roman Series Medium Size Normal Color Blue EndFont End
exam.lyx
Description: application/lyx