
% \iffalse
%%% From File: counters.dtx
% \fi
%
%    \begin{macrocode}

%<*counters>
%    \end{macrocode}
%
% \subsection{Создание и настройка счетчиков}
%
% Максимальный уровень вложенности секций, помещаемых в оглавление
% (по умолчанию вносятся |\part|, |\chapter| и |\section|).
% \DescribeCounter{tocdepth}
%    \begin{macrocode}
\setcounter{tocdepth}{1}
%    \end{macrocode}
% Максимальный уровень вложенности нумеруемых секций
% (по умолчанию нумеруются |\part|, |\chapter|, |\section| и |\subsection|).
% \DescribeCounter{secnumdepth}
%    \begin{macrocode}
\setcounter{secnumdepth}{2}

%    \end{macrocode}
%
% \DescribeCounter{part}
% \DescribeCounter{chapter}
% \DescribeCounter{section}
% \DescribeCounter{subsection}
% \DescribeCounter{subsubsection}
% \DescribeCounter{paragraph}
% \DescribeCounter{subparagraph}
%    \begin{macrocode}
\newcounter{part}
\newcounter{chapter}
\newcounter{section}[chapter]
\newcounter{subsection}[section]
\newcounter{subsubsection}[subsection]
\newcounter{paragraph}[subsubsection]
\newcounter{subparagraph}[paragraph]

%    \end{macrocode}
%
% \DescribeCounter{figure}
% \DescribeCounter{table}
%    \begin{macrocode}
\newcounter{figure}[chapter]
\newcounter{table}[chapter]

%    \end{macrocode}
%
% Формат нумерации разделов документа в тексте.
% \DescribeMacro{\thepart}\index{Макросы!\verb*+\thepart+}
% \DescribeMacro{\thechapter}\index{Макросы!\verb*+\thechapter+}
% \DescribeMacro{\theappendix}\index{Макросы!\verb*+\theappendix+}
% \DescribeMacro{\thesection}\index{Макросы!\verb*+\thesection+}
% \DescribeMacro{\thesubsection}\index{Макросы!\verb*+\thesubsection+}
% \DescribeMacro{\thesubsubsection}\index{Макросы!\verb*+\thesubsubsection+}
% \DescribeMacro{\theparagraph}\index{Макросы!\verb*+\theparagraph+}
% \DescribeMacro{\thesubparagraph}\index{Макросы!\verb*+\thesubparagraph+}
%    \begin{macrocode}

\renewcommand\thepart{\Roman{part}}
\renewcommand\thechapter{\arabic{chapter}}
\newcommand\theappendix{\Asbuk{chapter}}
\renewcommand\thesection{%
\ifnum\c@chapter > \z@
  \thechapter.\arabic{section}%
\else\arabic{section}\fi}
\renewcommand\thesubsection{\thesection.\arabic{subsection}}
\renewcommand\thesubsubsection{\thesubsection.\arabic{subsubsection}}
\renewcommand\theparagraph{\arabic{paragraph}}
\renewcommand\thesubparagraph{\theparagraph.\arabic{subparagraph}}

%    \end{macrocode}
% Формат нумерации разделов документа в оглавлении.
% \DescribeMacro{\tocthepart}\index{Макросы!\verb*+\tocthepart+}
% \DescribeMacro{\tocthechapter}\index{Макросы!\verb*+\tocthechapter+}
% \DescribeMacro{\toctheappendix}\index{Макросы!\verb*+\toctheappendix+}
% \DescribeMacro{\tocthesection}\index{Макросы!\verb*+\tocthesection+}
% \DescribeMacro{\tocthesubsection}\index{Макросы!\verb*+\tocthesubsection+}
% \DescribeMacro{\tocthesubsubsection}\index{Макросы!\verb*+\tocthesubsubsection+}
% \DescribeMacro{\toctheparagraph}\index{Макросы!\verb*+\toctheparagraph+}
% \DescribeMacro{\tocthesubparagraph}\index{Макросы!\verb*+\tocthesubparagraph+}
%    \begin{macrocode}
\providecommand\tocthepart{\thepart}
\providecommand\tocthechapter{\thechapter}
\providecommand\toctheappendix{\theappendix}
\providecommand\tocthesection{\thesection}
\providecommand\tocthesubsection{\thesubsection}
\providecommand\tocthesubsubsection{\thesubsubsection}
\providecommand\toctheparagraph{\theparagraph}
\providecommand\tocthesubparagraph{\thesubparagraph}

%    \end{macrocode}
%
% Схема нумерации объектов по умолчанию.
% \DescribeMacro{\default@the}\index{Макросы!\verb*+\default"@the+}
%    \begin{macrocode}
\newcommand\default@the{%
%    \end{macrocode}
% Нумерация сносок и формул начинается заново в каждой главе.
%    \begin{macrocode}
  \@addtoreset{footnote}{chapter}
  \@addtoreset{equation}{chapter}

%    \end{macrocode}
% Формат номера формулы.
% \DescribeMacro{\theequation}\index{Макросы!\verb*+\theequation+}
%    \begin{macrocode}
  \renewcommand\theequation{%
    \ifnum\c@chapter > \z@\thechapter.\fi%
    \@arabic\c@equation}
%    \end{macrocode}
% Формат номера таблицы.
% \DescribeMacro{\thetable}\index{Макросы!\verb*+\thetable+}
%    \begin{macrocode}
  \renewcommand\thetable{%
    \ifnum \c@chapter>\z@\thechapter.\fi%
    \@arabic\c@table}
%    \end{macrocode}
% Формат номера рисунка.
% \DescribeMacro{\thefigure}\index{Макросы!\verb*+\thefigure+}
%    \begin{macrocode}
  \renewcommand\thefigure{%
    \ifnum \c@chapter>\z@\thechapter.\fi%
    \@arabic\c@figure}
}
%</counters>
%    \end{macrocode}
