[OS X TeX] arabic numbering with hebrew in babel

Art Werschulz agw at comcast.net
Mon Jun 8 23:51:42 CEST 2015


Hi.

I’m in the process of (co-)writing a textbook.  Said book will have a solutions manual, and so I’m using the answers package.  Chapters having exercises in the book begin with \chapterwithexercises, rather than \chapter.  This new control sequence is defined via

\usepackage{answers}
\Newassociation{soln}{solution}{answers}
\newcounter{chapterans}
\newcommand\chapterwithexercises[1]{
    \chapter{#1}
    \setcounter{chapterans}{\value{chapter}}
    \addtocounter{chapterans}{-1}
    \Writetofile{answers}{}
    \Writetofile{answers}{\protect\setcounter{chapter}{\arabic{chapterans}}}
    \Writetofile{answers}{\protect\chapter{#1}}
}

THe resulting file answers.tex has 

\setcounter{chapter}{0}
\chapter{Sets}
\begin{solution}{1.6.1}
      (a), (b), (d), (f) and~(h) are true.

      Note that (c) is false because the set $T$ is not contained in
      itself; (e) is false because there is no element in $T$ that is
      the set containing the elements $3,5, \text{and}~44$; (g) is
      false for a similar reason to (e) and (i) is false because $T =
      T$ and therefore cannot be a proper subset of itself.
    
\end{solution}

and suchlike.

This works fine, until I bring babel into the picture.  We’re going to have a few lines of Irish Gaelic and Hebrew in the book’s dedication.  

The file answers.tex now has material such as

\setcounter{chapter}{\@@number{1}}
\chapter{Sets}
\begin{solution}{\protect \beginL \protect \beginL 2\endL .\protect \beginL 6\endL \endL .\protect \beginL 1\endL }
      (a), (b), (d), (f) and~(h) are true.

      Note that (c) is false because the set $T$ is not contained in
      itself; (e) is false because there is no element in $T$ that is
      the set containing the elements $3,5, \text{and}~44$; (g) is
      false for a similar reason to (e) and (i) is false because $T =
      T$ and therefore cannot be a proper subset of itself.
    
\end{solution}

When I run this through pdflatex, I get the following

! Improper \spacefactor.
<recently read> \spacefactor 
                             
l.37 \setcounter{chapter}{\@@number{1}}
                                       
? 

! Package calc Error: `\@m ' invalid at this point.

See the calc package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.37 \setcounter{chapter}{\@@number{1}}
                                       
? 
[3]
Chapter 1.
! Improper \beginL.
<argument> Exercise \protect \beginL 
                                     \protect \beginL 2\endL .\protect \begi...
l.39 ...nL 6\endL \endL .\protect \beginL 1\endL }
                                                  
? 

after which I give up.

Suggestions on how to fix this?  Thanks!

Art Werschulz
agw at comcast.net






More information about the macostex-archives mailing list