On Friday 15 May 2009, Helge Hafting wrote:
> obregonma...@gmail.com wrote:
> > I've gone through the docs, wikis and examples, and I need a helping hand.
> > 
> > I want to have a counter (experiment) that uses roman numerals and is 
> > sequential throughout the chapters. I figure that a module is the right way 
> > about this, so I have a module with the following counter:
> > 
> > Counter experimentCounter
> >     LabelString      "\Roman{experimentCounter}"
> >     Within           ""     
> > End
> > 
> > Now, what I want is a section heading  that would look like:
> > 
> > 3.2    <label expt:reading-ability> Experiment I: Effect of reading ability
> > 
> > and then later on:
> > 
> > 3.6   <label expt:age-predictor> Experiment II: Age as a predictor
> > 
> > and then ...
> > 
> > 4.2   <label expt:reading-aids> Experiment III: Reading aids
> > 
> > 
> > 
> > How can I use my "experimentCounter" in a section title, as well as assign 
> > a label to this experiment item (NOT the section number)? I imagine that it 
> > would require an ERT ... but with what LaTeX command? 
> > 
> 
> Basically, you create a new "experiment-section" that contains all the 
> stuff from a regular "section" ( copy it out of stdsections.inc, or use
> "CopyStyle Section" and take it from there.) And then you add the 
> necessary latex code, once. Instead of having to add it as ERT to
> every experiment in your text.
> 
> So when you start a new experiment, you use "experiment-section" instead
> of a regular section. I am not sure if you can get LyX to display the 
> experiment counter in the edit window, as incrementing two counters at 
> once is a bit unusual. But it should definitely work for output!

I can get LyX to display a modified section very nicely, but I cannot get latex 
to show me a modified experiment-section.

> As for the actual latex code needed to increment and display the 
> counter, I don't have time to look that up right now. Look for
> examples on the net, or borrow one of the recommended latex books at
> a library.

I am at a loss for the latex commands. I don't want to start learning the 
complexities of LaTeX macro writings just to modify a section title. I looked 
at the sectsty.sty and titlesec.sty documentation and found them not to be of 
help. One changes all sections and the other you have to know a lot of LaTex. I 
simply want something like this, so that I have both the normal section counter 
and my special experimentCounter counter:

Counter experimentCounter
        LabelString      "\Roman{experimentCounter}"
        Within           ""     
End

Style Experiment
        CopyStyle             Section
        LatexName             experiment-section
        LabelType             Counter
        LabelString           "Experiment \theexperimentCounter."
        LabelCounter          section, experimentCounter
        Font
                Series  Italic
                Size    Large
        EndFont
        Preamble
                \newcommand{\experiment-section}[1]{%
                        \section{Experiment \theexperimentCounter. #1}}
        EndPreamble
End

But, latex gives errors that I don't understand. 

Reply via email to