% Modified from kgk to use \include w/o directory names rph
% Chapters 
\def\dirn@me{ch}
\def\filn@me{ch}

\newcount\@chcnt \@chcnt\z@
\newif\if@chapter \@chapterfalse

\def\chf@me{\dirn@me\number\@chcnt/\filn@me\number\@chcnt.tex}
\def\chd@me{\dirn@me\number\@chcnt}


\def\test@ch{\advance\@chcnt by \@ne\test@@ch{\chf@me}}
\def\test@@ch#1{\openin1 #1
  \ifeof1 \@chapterfalse\else\closein1 \@chaptertrue\fi}

\def\chapters{\@chcnt\z@ \test@ch
  \if@chapter\@whilesw\if@chapter \fi{\include{\chd@me}\test@ch}\fi}

