<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.5848" name=GENERATOR></HEAD>
<BODY style="MARGIN: 4px 4px 1px; FONT: 10pt Tahoma">
<DIV>hi ross</DIV>
<DIV> </DIV>
<DIV>thanks so much. i'm still fairly new to this, so the little 'side-effects' aren't well known to me yet...</DIV>
<DIV> </DIV>
<DIV>i'll try this out tomorrow. very much appreciated!</DIV>
<DIV> </DIV>
<DIV>best</DIV>
<DIV> </DIV>
<DIV>k<BR><BR>>>> Ross Moore <ross@ics.mq.edu.au> 18/09/2009 5:44 pm >>><BR>Hello Karljürgen,<BR><BR>On 19/09/2009, at 4:02 AM, Karljurgen Feuerherm wrote:<BR><BR>> Hello all,<BR>><BR>> I have set up a counter and environment (using XeLaTeX) as follows:<BR>><BR>> \newcounter{examples}[chapter]<BR>><BR>> \newenvironment{examples}<BR>> {\begin{list}%<BR>> {\textsc{Example} \arabic{examples}.} %<BR>> {\setlength{\labelsep}{10pt} %<BR>> \setlength{\itemindent}{10pt} %<BR>> \setlength{\leftmargin}{0pt} %<BR>> \setlength{\labelwidth}{0pt} %<BR>> \usecounter{examples}%<BR>> } %<BR>> } %<BR>> {\end{list}}<BR>><BR>> The idea is to let the examples counter run through each chapter <BR>> and only reset at the next chapter. For some reason, it resets <BR>> itself in environment changes (for example after enumerates, at <BR>> each new section...).<BR><BR>No, it resets itself for every use of the {examples}<BR>environment.<BR>This is because of how \usecounter expands;<BR>viz.<BR><BR>\usecounter #1->\@nmbrlisttrue \def \@listctr {#1}\setcounter {#1}\z@<BR>#1<-examples<BR><BR><BR>That \setcounter {#1}\z@ is resetting to zero.<BR><BR>You'll need a second counter or macro to retain the<BR>value of your 'examples' counter at the end of each<BR>environment.<BR><BR><BR>e.g.<BR><BR>\newcounter{examples}[chapter]<BR>\newcounter{runningexample}[chapter]<BR><BR>\newenvironment{examples}{%<BR>\begin{list}%<BR>{\textsc{Example}~\arabic{examples}.}%<BR>{\usecounter{examples}%<BR>\setcounter{examples}{\value{runningexample}}%<BR>\setlength{\labelsep}{10pt}%<BR>\setlength{\itemindent}{10pt}%<BR>\setlength{\leftmargin}{0pt}%<BR>\setlength{\labelwidth}{0pt}%<BR>}%<BR>} %<BR>{\end{list}%<BR>\setcounter{runningexample}{\value{examples}}%<BR>}<BR><BR>Note also that I've suppressed the extra spaces after '}'<BR>that your coding was inserting (to no great harm though).<BR><BR><BR>><BR>> What am I doing wrong?<BR><BR>With the 'runningexample' counter as above,<BR>the following example works fine, so far as I can tell.<BR><BR><BR>\begin{document}<BR>%\maketitle<BR>\chapter{One}<BR><BR>\begin{examples}<BR>\item First example<BR>\item Second example<BR>\item Third example<BR>\end{examples}<BR><BR>\begin{enumerate}<BR>\item something else<BR>\end{enumerate}<BR><BR>\begin{examples}<BR>\item Another First example<BR>\item Another Second example<BR>\item Another Third example<BR>\end{examples}<BR><BR><BR>\chapter{Two}<BR><BR>\begin{examples}<BR>\item First example<BR>\item Second example<BR>\item Third example<BR>\end{examples}<BR><BR>\begin{enumerate}<BR>\item more other things<BR>\end{enumerate}<BR><BR>\begin{examples}<BR>\item Another First example<BR>\item Another Second example<BR>\item Another Third example<BR>\end{examples}<BR><BR><BR>\end{document}<BR><BR>><BR>> Thanks<BR>><BR>> K<BR>><BR>> Karljürgen G. Feuerherm, PhD<BR>> Department of Archaeology and Classical Studies<BR>> Wilfrid Laurier University<BR><BR><BR><BR>Hope this helps,<BR><BR>Ross<BR><BR>------------------------------------------------------------------------<BR>Ross Moore <U><A href="mailto:ross@maths.mq.edu.au">ross@maths.mq.edu.au</A></U> <BR>Mathematics Department office: E7A-419<BR>Macquarie University tel: +61 (0)2 9850 8955<BR>Sydney, Australia 2109 fax: +61 (0)2 9850 8114<BR>------------------------------------------------------------------------<BR><BR><BR><BR></DIV></BODY></HTML>