We're getting close!

On Friday 15 May 2009, Guenter Milde wrote:
> On 2009-05-15, [email protected] wrote:
> > On Friday 15 May 2009, Helge Hafting wrote:
> >> [email protected] wrote:
> 
> >> > 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:

> >> > 3.2    <label expt:reading-ability> Experiment I: Effect of reading 
> >> > ability
> 
> > 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. 
> 
> In this case you might consider typing the Experiment number by hand...

I have considered this ... but I'm convinced that there is a better way, as I 
have 10 experiment to report and refer to throughout my long document.

> > Counter experimentCounter
> >     LabelString      "\Roman{experimentCounter}"
> >     Within           ""     
> > End
> 
> This sets up the Counter for LyX only, you need to set up a LaTex
> counter as well.

Ah! That explains a lot. 

> AddToPreamble
>         \newcounter{experiment}
>       \setcounter{experiment}{0}
> EndPreamble

Progress. :)

> Maybe this works, but it is untested:
>  
>  \newcommand{\experimentSection}[1]{%
>     \stepcounter{experiment}
>     \section{Experiment \Roman{experiment}. #1}%
>  }

Yes, the correct section label is generated by latex. And, I've modified the 
LyX Experiment style to show me something workable too ("\theexperimentCounter" 
below just gives me "??" in the document).

Style Experiment
        CopyStyle             Section
        LatexName             experimentSection
        LabelType             Counter
        LabelString           "\thesection  Experiment \theexperimentCounter."
        LabelCounter          section
        Font
                Shape   Italic
                Size    Large
        EndFont
        Preamble
                \newcommand{\experimentSection}[1]{%
                    \stepcounter{experiment}
                        \section{\textit{Experiment \Roman{experiment}. #1}}%
                         }
        EndPreamble
End

Now, I need a way to create a label in LyX that refers to value of the 
"experiment" counter. This way, I can refer to the different experiments in 
text by label (and page, etc).

Thanks Guenter for your help so far. I hope you have a solution for this 
question too.

Mateo.

Reply via email to