[OS X TeX] Two issues -- need help

Morten Høgholm morten.hoegholm at gmail.com
Sun Aug 7 22:59:54 CEST 2005


On Sun, 07 Aug 2005 22:38:17 +0200, M. Tamer Özsu <tozsu at sympatico.ca>  
wrote:

> Thanks much. I can't believe I missed the \refstepcounter. However,  
> changing
> \stepcounter to \refstepcounter as follows gives an error:
>
> \newcounter{exmp}[chapter]
> \newcommand{\bex}{\renewcommand{\theexmp}{\refstepcounter{exmp}\thechapter.a
> rabic{exmp}}\vspace{11pt}\par\noindent{\bf Example
> \theexmp}\vspace{11pt}\par\noindent\begin{inpar}\parskip=2pt plus 0.5pt}
>
> However, if I do the following (pulling \refstepcounter{exmp} out of the
> definition of \renewcommand)
>
> \newcounter{exmp}[chapter]
> \newcommand{\bex}{\refstepcounter{exmp}\renewcommand{\theexmp}{\thechapter.\
> arabic{exmp}}\vspace{11pt}\par\noindent{\bf Example
> \theexmp}\vspace{11pt}\par\noindent\begin{inpar}\parskip=2pt plus 0.5pt}
>
> works without giving an error, assigns the correct example number, but  
> the
> first \ref gives only the value of the example number, without the  
> chapter
> prefix, i.e.,

\theexmp is supposed to give you the representation of the `exmp' counter.  
I think this is closer to what you want.

\newcounter{exmp}[chapter]
\renewcommand*\theexmp{\thechapter.\arabic{exmp}}
\newcommand*\bex{%
   \par \vspace{11pt}%
   \noindent
   \refstepcounter{exmp}%
   \textbf{Example \theexmp}%
   \par \vspace{11pt}%
   \noindent \begin{inpar}%
     \setlength\parskip{2pt plus 0.5pt}%
}

You may note that \bf has been obsolete for more than ten years.
-- 
Morten
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the macostex-archives mailing list