On Wed, 13 Feb 2013 14:00:50 -0800
Jane Shevtsov <jane....@gmail.com> wrote:

> On Wed, Feb 13, 2013 at 12:01 PM, Steve Litt
> <sl...@troubleshooters.com>wrote:
> 
> > On Wed, 13 Feb 2013 10:00:04 -0800
> > Jane Shevtsov <jane....@gmail.com> wrote:
> >
> > > On Wed, Feb 13, 2013 at 1:35 AM, Steve Litt
> > > <sl...@troubleshooters.com>wrote:
> > >
> > > > On Tue, 12 Feb 2013 22:36:55 -0800
> > > > Jane Shevtsov <jane....@gmail.com> wrote:
> >
> > > > I understand that you don't want problems to continue the
> > > > numbering of the previous section, but if you reset them, reset
> > > > them to what? In your example, if you reset the major number to
> > > > 2, then numbered section 2 would be 3, which I doubt you want.
> > > >
> > >
> > > I'm not sure what you mean. I just want problem numbers within
> > > each section to start at 1.
> >
> > Ah-ha!
> >
> > Before we continue, I think you should send us a prototype of how
> > you *want* this to look. On prototype is worth a thousand words and
> > is much less prone to misunderstanding.
> >
> > You could do it with a text editor, using spaces for indentation,
> > showing how you'd like your MWE to look.
> >
> 
> Good idea! An example is attached. In the actual text, I put the
> exercises in boxes to get a shaded background, but the only issue
> right now is numbering. In my prototype, labs are numbered
> continuously throughout the book (Lab 1 rather than Lab 1.1); it
> would also be ok if they were numbered within chapters.

Cool!

This is going to be easier than I thought.

Now, keep in mind this one says exercise 1, exercise2, and the MWE had
Problem 1, problem 2, etc. So for this email I'll use Exercise, and
assume you have made an environment called Exercise that works on a
counter called exercise_counter. Make the environment so it increments
the counter. Now, for every containing environment, whether it be
Section and Section*, or Mysection and Lab, make sure that containing
environment resets the counter back to 1 (or 0 if your environment
pre-increments). That's it, you're done.

I don't remember the exact LaTeX, but as I remember you need a
\newcounter in the preamble, the enclosing Mysection and Lab
environments need a \setcounter, and the Exercise environment needs a
\addtocounter. Or, you can make it a list environment, and use
\usecounter, in which case I don't think you need to explicitly
increment the counter.

See http://www.personal.ceu.hu/tex/counters.htm

LaTeX is difficult and obstreperous, so I'd suggest you make a tiny
LaTeX file and compile it, then put your environments in there, and
keep tweaking it til it works. Then, knowing you have a working set of
environments, put them into a LyX layout file and use the layout file
in a trivial LyX file. Once that's working, put the environemnts in the
layout file for your book. Please remember, when you change your layout
file, in LyX you need to Tools->reconfigure and then restart LyX to
have your changes take hold.

This sounds like a lot of work, but I bet you can get it working in a
day, and that's a lot quicker and less hassle than if you try to just
jam them directly into LyX, and you'll be a lot more confident too.

Once you've gotten this all perfected, please post it to the list, as a
lot of us need to do similar things, and it's not trivial.

Thanks, and HTH,

SteveT

Reply via email to