\stepcounter というものです
作成方法
\stepcounter{<counter>}
意味は ”Increments <counter> by 1”で 1個づつ 増加させるようです
もう一つ 使いかたが 良く理解できないのですが
では TeX ファイル (source code)を見てみます。
\documentclass[a5paper,12pt]{jarticle}
\newenvironment{exercise}[1]
{\par\noindent\textbf{Exercise(#1)}\begin{itshape}\par\noindent}
{\end{itshape}}
\begin{document}
\section{counter 1}
counter section:~\thesection
\subsection{exercise 1}
\begin{exercise}{An Example1}
This is a sample1.
\end{exercise}
\newcounter{exercise} % 新しく カウンタを 設定します。
\stepcounter{exercise} % 初期値は 零 なので これで 1 になるはずです。
counter exercise~\theexercise % カウンタ の中身を 表示します。
\subsection{exercise 2}
\begin{exercise}{An Example2}
This is a sample2.
\end{exercise}
\stepcounter{exercise} % 現在値は 1 なので これで 2 になるはずです。
counter exercise~\theexercise % カウンタ の中身を 表示します。
counter page:~\thepage
\newpage
\section{counter page2}
counter section:~\thesection
\section{exercise 3}
\begin{exercise}{An Example page2}
This is a sample on page2.
\end{exercise}
\stepcounter{exercise} % 現在値は 2 なので これで 3 になるはずです。
counter exercise~\theexercise
counter page:~\thepage
\end{document}
この結果の表示例です
画像は適宜 切り取り 拡大縮小をしていますが
1頁
2頁

自動的には 増加 しないのでしょうか? 使用方法を まちがっているのかも しれません。繁雑です。
にゃんたろう 拝!
2008年 8月 2日 (土) 21:00:28 JST 作成