<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>&nbsp;</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>&nbsp;</DIV>
<DIV>i'll try this out tomorrow. very much appreciated!</DIV>
<DIV>&nbsp;</DIV>
<DIV>best</DIV>
<DIV>&nbsp;</DIV>
<DIV>k<BR><BR>&gt;&gt;&gt; Ross Moore &lt;ross@ics.mq.edu.au&gt; 18/09/2009 5:44 pm &gt;&gt;&gt;<BR>Hello Karljürgen,<BR><BR>On 19/09/2009, at 4:02 AM, Karljurgen Feuerherm wrote:<BR><BR>&gt; Hello all,<BR>&gt;<BR>&gt; I have set up a counter and environment (using XeLaTeX) as follows:<BR>&gt;<BR>&gt; \newcounter{examples}[chapter]<BR>&gt;<BR>&gt; \newenvironment{examples}<BR>&gt; {\begin{list}%<BR>&gt; {\textsc{Example} \arabic{examples}.} %<BR>&gt; {\setlength{\labelsep}{10pt} %<BR>&gt; \setlength{\itemindent}{10pt} %<BR>&gt; \setlength{\leftmargin}{0pt} %<BR>&gt; \setlength{\labelwidth}{0pt} %<BR>&gt; \usecounter{examples}%<BR>&gt; } %<BR>&gt; } %<BR>&gt; {\end{list}}<BR>&gt;<BR>&gt; The idea is to let the examples counter run through each chapter <BR>&gt; and only reset at the next chapter. For some reason, it resets <BR>&gt; itself in environment changes (for example after enumerates, at <BR>&gt; 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-&gt;\@nmbrlisttrue \def \@listctr {#1}\setcounter {#1}\z@<BR>#1&lt;-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>&gt;<BR>&gt; 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>&gt;<BR>&gt; Thanks<BR>&gt;<BR>&gt; K<BR>&gt;<BR>&gt; Karljürgen G. Feuerherm, PhD<BR>&gt; Department of Archaeology and Classical Studies<BR>&gt; 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>