% LaTeX test file for kate's syntax highlighting and code folding

\ordinaryLaTeXcommandwithoption[10pt,a4paper]{article}
<beginfold id='1'>% BEGIN</beginfold id='1'> region
%comment, this is all ok % $ 
\%no comments please
\\%comment
<endfold id='1'>% END</endfold id='1'> of region

\newcommand{\nohighlighting}

\section{normal}

\ref{blue}
\pageref{blue}
\cite{blue}

<beginfold id='2'>\begin</beginfold id='2'>{environmentshavespecialcolors}
normal
\end{environmentshavespecialcolors<endfold id='2'>}</endfold id='2'>

$equations are green, \commands somewhat darker$
normal
$<beginfold id='3'>$</beginfold id='3'>equations are green, \commands somewhat darker<endfold id='3'>$$</endfold id='3'>
normal
\( 
\frac{1}{2}
<beginfold id='2'>\begin</beginfold id='2'>{test}
\end{test<endfold id='2'>}</endfold id='2'>
\)
normal
<beginfold id='3'>\[</beginfold id='3'>
%comment 
displaymath 
<endfold id='3'>\]</endfold id='3'>
normal
<beginfold id='2'>\begin</beginfold id='2'>{equation}
green\darkergreen
<beginfold id='2'>\begin</beginfold id='2'>{test}
\test
\end{test<endfold id='2'>}</endfold id='2'>
\end{equation<endfold id='2'>}</endfold id='2'>

<beginfold id='2'>\begin</beginfold id='2'>{equation*}
green\darkergreen
%comment
<beginfold id='2'>\begin</beginfold id='2'>{test}
\test
\end{test<endfold id='2'>}</endfold id='2'>
\%no comment
\end{equation*<endfold id='2'>}</endfold id='2'>

\{     %this should be comment

\verb%this shouldn't be%and this should be normal text
\verb!verbatim text! normal text

text \texttt{more text}

<beginfold id='2'>\begin</beginfold id='2'>{verbatim}
text inside a verbatim environment is also treated special $ %,
you can even put a \begin{verbatim} inside
\end{verbatim<endfold id='2'>}</endfold id='2'>

normal

<beginfold id='2'>\begin</beginfold id='2'>{Verbatim}
&@@#^%&^#$
\end{Verbatim<endfold id='2'>}</endfold id='2'>

<beginfold id='2'>\begin</beginfold id='2'>{Verbatim*}
@*&^#@*(^#(*@&
\end{Verbatim*<endfold id='2'>}</endfold id='2'>

normal

<beginfold id='2'>\begin</beginfold id='2'>{Verbatim}
\begin{verbatim}
This is a verbatim block.
\end{verbatim}
\end{Verbatim<endfold id='2'>}</endfold id='2'>

normal

% test alignat
<beginfold id='2'>\begin</beginfold id='2'>{alignat}{2}
A  &= B &= C \\
A  &= B &= C
\end{alignat<endfold id='2'>}</endfold id='2'>
normal text

\iffalse
\fill commented out text
\fi

% Math mode

Depending on the value of $x$ the equation \( f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x} \) may diverge or converge.
 
<beginfold id='3'>\[</beginfold id='3'> f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x} <endfold id='3'>\]</endfold id='3'>
 
<beginfold id='3'>\[</beginfold id='3'>
S = \{ z \in \mathbb{C}\, |\, |z| < 1 \} \quad \textrm{and} \quad S_2=\partial{S}
<endfold id='3'>\]</endfold id='3'>

<beginfold id='3'>\[</beginfold id='3'>
\frac{
    <beginfold id='2'>\begin</beginfold id='2'>{array}[b]{r}
      \left( x_1 x_2 \right)\\
      \times \left( x'_1 x'_2 \right)
    \end{array<endfold id='2'>}</endfold id='2'>
  }{
    \left( y_1y_2y_3y_4 \right)
  }
<endfold id='3'>\]</endfold id='3'>

<beginfold id='2'>\begin</beginfold id='2'>{eqnarray*}
<beginfold id='2'>\begin</beginfold id='2'>{eqnarray*}
f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x} \\
\textstyle f(x) = \textstyle \sum_{i=0}^{n} \frac{a_i}{1+x} \\
\scriptstyle f(x) = \scriptstyle \sum_{i=0}^{n} \frac{a_i}{1+x} \\
\scriptscriptstyle f(x) = \scriptscriptstyle \sum_{i=0}^{n} \frac{a_i}{1+x}
\end{eqnarray*<endfold id='2'>}</endfold id='2'>
\end{eqnarray*<endfold id='2'>}</endfold id='2'>

<beginfold id='2'>\begin</beginfold id='2'>{xalignat}{3}
i_{11} & =i_{23}\nonumber
\end{xalignat<endfold id='2'>}</endfold id='2'>

c
<beginfold id='2'>\begin</beginfold id='2'>{equation}
c
<beginfold id='2'>\begin</beginfold id='2'>{aligned}
a & b\\
c & d
\end{aligned<endfold id='2'>}</endfold id='2'>
c
\end{equation<endfold id='2'>}</endfold id='2'>
c

$<beginfold id='3'>$</beginfold id='3'>E=mc^2<endfold id='3'>$$</endfold id='3'>
 
<beginfold id='2'>\begin</beginfold id='2'>{equation}
E=m
\end{equation<endfold id='2'>}</endfold id='2'>

<beginfold id='2'>\begin</beginfold id='2'>{equation
x=3\textrm{plop}
\end{equation<endfold id='2'>}</endfold id='2'>

<beginfold id='3'>\[</beginfold id='3'> <beginfold id='2'>\begin</beginfold id='2'>{array}{llll}
  x^3 = (-x)^3 & \text{if $x > 0$}\\
  x^3 = (-x)^3 & \text{if {$x > 0$}}\\
  x^3 = (-x)^3 & \text{if {\color{green} $x > 0$}}\\
\end{array<endfold id='2'>}</endfold id='2'> <endfold id='3'>\]</endfold id='3'>

\section*{Notes for My Paper}

<beginfold id='2'>\begin</beginfold id='2'>{center}
<beginfold id='2'>\begin</beginfold id='2'>{tabular}{ |c|c|c| } 
 \hline
 cell1 & cell2 & cell3 \\ 
 cell4 & cell5 & cell6 \\ 
 cell7 & cell8 & cell9 \\ 
 \hline
\end{tabular<endfold id='2'>}</endfold id='2'>

<beginfold id='2'>\begin</beginfold id='2'>{tabular*}{0.75\textwidth}{@{\extracolsep{\fill} } | c | c | c | r | }
  \hline
  label 1 & label 2 & label 3 & label 4 \\
  \hline 
  item 1  & item 2  & item 3  & item 4  \\
  \hline
\end{tabular*<endfold id='2'>}</endfold id='2'>

<beginfold id='2'>\begin</beginfold id='2'>{tabular*}{0.75\textwidth}{ | c | c | c | r | }
  \hline
  label 1 & label 2 & label 3 & label 4 \\
  \hline 
  item 1  & item 2  & item 3  & item 4  \\
  \hline
\end{tabular*<endfold id='2'>}</endfold id='2'>
\end{center<endfold id='2'>}</endfold id='2'>


<beginfold id='2'>\begin</beginfold id='2'>{tabularx}{1\textwidth}{ |>{\setlength\hsize{1\hsize}\centering}X|>{\setlength\hsize{1\hsize}\raggedleft}X@{} >{\setlength\hsize{1\hsize}\raggedright}X|>{\setlength\hsize{1\hsize}\centering}X| } 
  \hline
Label 1 & \multicolumn{2}{>{\centering\setlength\hsize{2\hsize} }X|}{Label 2} & Label 3\tabularnewline
\hline 
  123  & 123  & 456  & 123  \tabularnewline
  \hline
  123  & 123  & 456  & 123  \tabularnewline
  \hline
\end{tabularx<endfold id='2'>}</endfold id='2'>

<beginfold id='2'>\begin</beginfold id='2'>{lstlisting}
Write('Case insensitive ');
Write('Pascal keywords.');
\end{lstlisting<endfold id='2'>}</endfold id='2'>

<beginfold id='2'>\begin</beginfold id='2'>{lstlisting}%[frame=single]
Write('Case insensitive ');
Write('Pascal keywords.');
\end{lstlisting<endfold id='2'>}</endfold id='2'>

<beginfold id='2'>\begin</beginfold id='2'>{lstlisting}[frame=single]
Write('Case insensitive ');
Write('Pascal keywords.');
\end{lstlisting<endfold id='2'>}</endfold id='2'>

<beginfold id='2'>\begin</beginfold id='2'>{lstlisting}[frame=single] % blah blah
Write('Case insensitive ');
Write('Pascal keywords.');
\end{lstlisting<endfold id='2'>}</endfold id='2'>

<beginfold id='2'>\begin</beginfold id='2'>{lstlisting}
[frame=single] % blah blah
Write('Case insensitive ');
Write('Pascal keywords.');
\end{lstlisting<endfold id='2'>}</endfold id='2'>

<beginfold id='2'>\begin</beginfold id='2'>{minted}{python}
def foo<beginfold id='4'>(</beginfold id='4'>x<endfold id='4'>)</endfold id='4'>:
    return x
\end{minted<endfold id='2'>}</endfold id='2'>

<beginfold id='2'>\begin</beginfold id='2'>{minted}
% blah blah
{python}
def foo<beginfold id='4'>(</beginfold id='4'>x<endfold id='4'>)</endfold id='4'>:
    return x
\end{minted<endfold id='2'>}</endfold id='2'>

<beginfold id='2'>\begin</beginfold id='2'>{minted}[frame=lines]{python}
def foo<beginfold id='4'>(</beginfold id='4'>x<endfold id='4'>)</endfold id='4'>:
    return x
\end{minted<endfold id='2'>}</endfold id='2'>

<beginfold id='2'>\begin</beginfold id='2'>{minted}
% plop
[frame=lines,
fontsize=\footnotesize
]
% ok
{python}
def foo<beginfold id='4'>(</beginfold id='4'>x<endfold id='4'>)</endfold id='4'>:
    return x
\end{minted<endfold id='2'>}</endfold id='2'>

<beginfold id='2'>\begin</beginfold id='2'>{comment}
This is a comment block.
\end{comment<endfold id='2'>}</endfold id='2'>

\documentclass{article}
\usepackage{fancyvrb}

\documentclass[12pt]{article}
<beginfold id='2'>\begin</beginfold id='2'>{document}

Text that has a footnote\footnote{This $i_s$ the <beginfold id='3'>\[</beginfold id='3'>i_s<endfold id='3'>\]</endfold id='3'> $<beginfold id='3'>$</beginfold id='3'>x_i<endfold id='3'>$$</endfold id='3'> \(x_i\)footnote}\addtocounter{footnote}{-1}\addtocounter{footnote}{-1} looks like this. Later text referring to same footnote\footnotemark uses the other command.

\end{document<endfold id='2'>}</endfold id='2'>

% A delimiter is not required before "\" in keywords of kind "\command" (see bug #413493)
<beginfold id='2'>\begin</beginfold id='2'>{equation}123\end{equation<endfold id='2'>}</endfold id='2'>

<beginfold id='2'>\begin</beginfold id='2'>{comment}Comment\end{comment<endfold id='2'>}</endfold id='2'>
\iffalse text\fi normal text

text<beginfold id='2'>\begin</beginfold id='2'>{tabular}text\end{tabular<endfold id='2'>}</endfold id='2'>
text<beginfold id='2'>\begin</beginfold id='2'>{a}text\end{a<endfold id='2'>}</endfold id='2'>

% Close brackets correctly in some commands (see bug #415384)
\input{\a{}}
\cites{ text { text } text }

% Parentheses within [ ... ] (see bug #418979)
\cite[eq. (1.1)]{some_reference}
\cite[eq. \(x^n + y^n = z^n\)]{some reference}

% Close folding correctly in "\end{...}" and in region markers (see bug #419125)
<beginfold id='2'>\begin</beginfold id='2'>{document}
  <beginfold id='2'>\begin</beginfold id='2'>{abstract}

  \end{abstract<endfold id='2'>}</endfold id='2'>

  <beginfold id='2'>\begin</beginfold id='2'>{itemize}
    \item[\(\bullet\)]
    <beginfold id='1'>%%  BEGIN</beginfold id='1'> something
    Here are some text describiing a new theorem. In the equation
    <beginfold id='2'>\begin</beginfold id='2'>{equation}
      E = mc^2
    \end{equation<endfold id='2'>}</endfold id='2'>
    we have a solution for energy-mass equivalence.
    <endfold id='1'>%% END</endfold id='1'>

    \item[\(\bullet\)]
    <beginfold id='2'>\begin</beginfold id='2'>{align*}
      B(z) &= p^r \sum_{k \geq 0} \binom{-r}{k} (-1)^k (1 - p)^k z^k \\
      B(z) &= p^r \sum_{k \geq 0} \binom{-r}{k} (-(1-p) z)^k
    \end{align*<endfold id='2'>}</endfold id='2'>
  \end{itemize<endfold id='2'>}</endfold id='2'>
\end{document<endfold id='2'>}</endfold id='2'>

% Allow Math environment within another Math environment (see bug #435086)
<beginfold id='2'>\begin</beginfold id='2'>{gather*}
    a = 5 \\
    y = <beginfold id='2'>\begin</beginfold id='2'>{cases}
      0 & x < 2 \\
      2x-4 & x > 2 \\
    \end{cases<endfold id='2'>}</endfold id='2'> \\
    x = 5 \\
    z = 5
\end{gather*<endfold id='2'>}</endfold id='2'>

<beginfold id='2'>\begin</beginfold id='2'>{bashcode}
    find . -name '*.jpg' -print | parallel --bar convert '{}' '{.}.png'
    \(ToRemember\) # Remember expression in brackets and then use
    "${RAXML}" -s ${INPUT} # All the parameters as usually...
\end{bashcode<endfold id='2'>}</endfold id='2'>

<beginfold id='2'>\begin</beginfold id='2'>{bashcode}[lineno]
    find .
\end{bashcode<endfold id='2'>}</endfold id='2'>

<beginfold id='3'>\[</beginfold id='3'><beginfold id='2'>\begin</beginfold id='2'>{matrix}2\\3\\3\end{matrix<endfold id='2'>}</endfold id='2'><endfold id='3'>\]</endfold id='3'>

\section{title}{\small bla bla}

\section  {title}
{\small bla bla}

\section
  {title}
{\small bla bla}

$<beginfold id='2'>\begin</beginfold id='2'>{tabu*} to 140mm {|X[$c]}
    \alpha & \beta & \gamma \\
    \sum_i \frac{a_i}{x_i} & 0 & \cdot \\
\end{tabu<endfold id='2'>}</endfold id='2'>$

<beginfold id='2'>\begin</beginfold id='2'>{tabu}{|c|*{21}{X[$c]|}}
    \toprule
    Notes $x_i$ & 0 & 0b\\
    \hline
    Notes $x_i$ & 0 & 0b\\
    \bottomrule
\end{tabu<endfold id='2'>}</endfold id='2'>
