\usemodule[latex]

\starttext

\chapter{Counter Playing}

\section{Some examples of counter referencing.}

\uselatexcounters

\newcounter{test}

\setcounter{test}{1}
First: \thetest.
\renewcommand{\thetest}{\Roman{test}}
Second: \thetest.
\renewcommand{\thetest}{\alph{test}}
Third: \thetest.
And some direct accesses: \arabic{test}, \roman{test}, \Alph{test}.

We repeat:
\renewcommand{\thetest}{\arabic{test}}
\addtocounter{test}{1}
First: \thetest.
\renewcommand{\thetest}{\Roman{test}}
Second: \thetest.
\renewcommand{\thetest}{\alph{test}}
Third: \thetest.
And some direct accesses: \arabic{test}, \roman{test}, \Alph{test}.

Some footnote characters:
\setcounter{test}{1}
\fnsymbol{test} \addtocounter{test}{1}
\fnsymbol{test} \addtocounter{test}{1}
\fnsymbol{test} \addtocounter{test}{1}
\fnsymbol{test} \addtocounter{test}{1}
\fnsymbol{test} \addtocounter{test}{1}
\fnsymbol{test} \addtocounter{test}{1}
\fnsymbol{test} \addtocounter{test}{1}
\fnsymbol{test} \addtocounter{test}{1}
\fnsymbol{test}


\section{Section Two}

\subsection{Two point one.}

So, what happens to \ConTeXt\ sections if we try them in \LaTeX-counter mode?

\subsection{Two point two.}

\section{Section Three}

Apparently they work just fine.  Interesting, that.

\subsection{Three point one.}

However, we find that \type{\placeformula} doesn't work correctly with \LaTeX\ counters in place, and we have to revert to \ConTeXt\ counters.

\usecontextcounters
\placeformula
\startformula
a^2 = b^2 + c^2
\stopformula


\chapter{Itemization and Enumeration}
\uselatexitemize

A line of text.

\begin{enumerate}
\item test
  \begin{enumerate}
  \item test
    \begin{enumerate}
    \item test
      \begin{enumerate}
      \item test
      \item test
      \end{enumerate}
    \item test
    \end{enumerate}
  \item test
  \end{enumerate}
  \item test
\end{enumerate}

We put in a paragraph here that's long enough to wrap around and continue on the next line, thereby visually establishing the left-hand margin.

\begin{itemize}
\item test
  \begin{itemize}
  \item test
    \begin{itemize}
    \item test
      \begin{itemize}
      \item test
      \item test
      \end{itemize}
    \item test
    \end{itemize}
  \item test
  \end{itemize}
  \item test
\end{itemize}

We put in a paragraph here that's long enough to wrap around and continue on the next line, thereby visually establishing the left-hand margin.

\renewcommand\labelenumii{\theenumi.\theenumii}

\begin{enumerate}
\item test
\item test
  \begin{enumerate}
  \item test
  \item test
  \end{enumerate}
\item test
  \begin{enumerate}
  \item test
  \item test
  \end{enumerate}
\item test
\end{enumerate}


\chapter{Environment Tests.}


\def\starthello%
 {\grabuntil{stophello}\dohello}
\def\dohello#1{``#1''}

\def\stophello{(This shouldn't ever be printed!)}

\def\startsimple{``}
\def\stopsimple{''}

Some various environment tests, which indicate that the various versions all produce identical results, as expected.  The first batch tests the environments individually; the second tests them when nested.

I say, ``Hello world!''\ here.  (direct)

I say, \startsimple Hello world!\stopsimple\ here.  (\type{\startsimple})

I say, \begin{simple}Hello world!\end{simple}\ here.  (\type{\begin{simple}})

I say, \starthello Hello world!\stophello\ here.  (\type{\starthello})

I say, \begin{hello}Hello world!\end{hello}\ here.  (\type{\begin{hello}})

And then:

I also say, ``Hello ``test'' world!''\ there.
  (direct)

I also say, \begin{hello}Hello \begin{hello}test\end{hello} world!\end{hello}\ there.
  (\type{\begin{hello}} \type{\begin{hello}})
  
I also say, \starthello Hello \begin{hello}test\end{hello} world!\stophello\ there.
  (\type{\type{\starthello} \begin{hello}})
  
I also say, \begin{hello}Hello \starthello test\stophello\ world!\end{hello}\ there.
  (\type{\begin{hello}} \type{\starthello})

I also say, \begin{simple}Hello \starthello test\stophello\ world!\end{simple}\ there.
  (\type{\begin{simple}} \type{\starthello})

I also say, ``Hello ``test'' world!''\ there.
  (direct)


\def\starthelloarg#1{(#1:}
\def\stophelloarg{)}

And then we start an argument: \starthelloarg{1}Like this\stophelloarg.

And then we start an argument: \begin{helloarg}{1}Like this\end{helloarg}.



Some tests of \type{array}:

\usecontextcounters

\placeformula
\startformula
A_1 = 
 \left( \startarray{cc}1 & 2 \\ 3 & 4 \stoparray \right)
\stopformula

\placeformula
\startformula
A_1 = 
 \left( \startarray{rcl}1 & 2 & 3 \\
                        x^2 & 0 & \dfrac{y}{2x} \\
                          3 & x^2 + y^2 - z_0^2 & \sum_{n=0}^\infty x^{-an} \stoparray \right)
\stopformula


A random command: \LaTeXe.

%\newcommand{\LaTeXe}{test}


\newcommand{\this}{that}
\renewcommand{\this}{the-other}




\stoptext