% Standard GATE team LaTeX preamble. Adapted for YAM 24th August 2006.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Valentin Tablan 13/02/2002
%
% This file is designed to be included at the begining of any latex document 
% and handles things like pdf detection, tex4ht detection, notes command, 
% paragraph spacing and indenting.
%
% 28/July/2003: consolidated GATE utils and TAO main.tex stuff here (Hamish).
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PDF detection
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newif\ifpdf
\ifx\pdfoutput\undefined
  \pdffalse          % we are not running PDFLaTeX
\else
  \pdfoutput=1       % we are running PDFLaTeX
  \pdftrue
\fi


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% tex4ht detection
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newif\ifhtml
\ifx\ifHtml\undefined
  \htmlfalse          % we are not running tex4ht
\else
  \htmltrue           % we are running tex4ht
\fi


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% packages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% note that hyperref modifies many of the latex commands so it needs to be 
% the last loaded package.

% general packages
\usepackage[english]{babel}
\usepackage{lscape}
\usepackage{longtable}
\usepackage{setspace}
\usepackage{color}

% packages with mode detection 
\ifpdf
  %PDF specific stuff
  \usepackage[pdftex]{graphicx}
  \usepackage{thumbpdf}

  % this should be last!
  \usepackage[
    pdftex,
    pdfborder=0,
    pdftitle={},
    pdfauthor={},
    pdfsubject={},
    pdfkeywords={},
    pdfpagemode=None,
    colorlinks=false,
    urlcolor=blue,
    anchorcolor=blue,
    anchorcolor=blue,
    filecolor=blue,
    linkcolor=blue,
    citecolor=blue,
    ]{hyperref}
\else
  \ifhtml
    % tex4ht specific stuff
    \usepackage{graphicx}
    \usepackage[colorlinks=false]{hyperref}
  \else
    % Latex specific stuff
    \usepackage[dvips]{graphicx}

    % this should be last!
    \usepackage[hypertex, colorlinks=false]{hyperref}
  \fi
\fi


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% HTML support commands
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% some utility definitions of HTML commands using the hyperref package 

% \htlink{target URL}{link text} - hypertext link
\newcommand{\htlink}[2]{\href{#1}{#2}}
\newcommand{\htlinkplain}[1]{\href{#1}{#1}}

% latex commands that only appear in the HTML version
\newcommand{\htlinkhtml}[2]{\href{#1}{#2}}
\newcommand{\htlinkplainhtml}[1]{\href{#1}{#1}}
\newcommand{\htlatexhtml}[1]{#1}

% \htcode{code} - raw HTML code
\newcommand{\htcode}[1]{}

% \htlatex{code} - latex only code
\newcommand{\htlatex}[1]{#1}

% if we're tex4ht'ing, redefine the HTML commands to use tex4ht commands
\ifhtml
  \renewcommand{\htcode}[1]{\HCode{#1}}
  \renewcommand{\htlatex}[1]{}
\else
  \renewcommand{\htlinkhtml}[2]{}
  \renewcommand{\htlinkplainhtml}[1]{}
  \renewcommand{\htlatexhtml}[1]{}
\fi


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% notes commands 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% writes a small "note:" marker on the left margin of the note 
\newcommand{\notes}[1]
{
\setlength{\unitlength}{1mm}
\begin{picture}(0,0)(15, 0)
\put(0,0) {\framebox{{\scriptsize {\sf {\bf note:}}}}}
\end{picture}%
{\sf{#1}}
\begin{picture}(0,0)
\put(0,0){\rule{.5\baselineskip}{.5\baselineskip}}
\end{picture}%
}

% uncomment for final version.
%%% \renewcommand{\notes}[1]{}

% IF pdf mode is enabled it will create a PDF note (non printable)
\newcommand{\pdfnote}[1]{
  \ifpdf
    \pdfannot         % generic annotation
                      
      width 10cm      % the dimension of the annotation can be controlled
      height 0cm      % via <rule spec>; if some of dimensions in
      depth  4cm      % <rule spec> is not given, the corresponding
                      % value of the parent box will be used.
    {                 
      /Subtype /Text  % text annotation
      %/Open true     % if given the text annotation opened by default
      /Contents       % text contents
        (#1)
    }
  \else
  \notes{#1}
  \fi
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% switches 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\textwidth 6.5in
\textheight 9.1in
\oddsidemargin 0.1in
\evensidemargin 0.1in
\topskip 0.35in
\footskip 0.2in
\topmargin -1.1cm
\tolerance=6000

% paragraph break with no indent
\setlength{\parindent}{0pt}

% extra spacing between paragraphs
\setlength{\parskip}{2ex}
%\setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}

% number subsubsections in the TOC
%\setcounter{tocdepth}{3}

% spacing
\singlespacing
%\onehalfspacing
%\doublespacing



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% misc commands 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\delete}[1]{}
\newcommand{\omitted}[1]{{\small \sf =OMITTED=}}
\newcommand{\thing}{book}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% sectioning commands 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\chapt}[1]{\section{#1}}
\newcommand{\sect}[1]{\subsection{#1}}
\newcommand{\subsect}[1]{\subsubsection{#1}}
\newcommand{\subsubsect}[1]{{\bf #1}}
\newcommand{\subsubsubsect}[1]{{\bf #1}}
\newcommand{\chapthing}{section}
\newcommand{\Chapthing}{Section}
\newcommand{\chapthings}{sections}
\newcommand{\Chapthings}{Sections}

\renewcommand{\chapt}[1]{\chapter{#1}}
\renewcommand{\sect}[1]{\section{#1}}
\renewcommand{\subsect}[1]{\subsection{#1}}
\renewcommand{\subsubsect}[1]{\subsubsection{#1}}

\renewcommand{\chapthing}{chapter}
\renewcommand{\Chapthing}{Chapter}
\renewcommand{\chapthings}{chapters}
\renewcommand{\Chapthings}{Chapters}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% compact itemize etc. 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% store the current value of parskip and allow resetting
% via \resetparskip
\newlength{\oldparskip}
\setlength{\oldparskip}{\parskip} 
\oldparskip=\parskip 
\newcommand{\resetparskip}[0]
{
  \parskip=\oldparskip
}

% \bit, \eit - compact version of itemize
% note that parskip is changed. To reset it use \resetparskip
% (after any text following the list that's not a new paragraph)
\newcommand{\bit}[0]
{
  \parskip=-4pt
  \begin{itemize}
  \itemsep=-3pt
}
\newcommand{\eit}[0]
{
  \end{itemize}
  \parskip=-4pt
}

% \ben, \een - compact version of enumerate
% note that parskip is changed. To reset it use \resetparskip
% (after any text following the list that's not a new paragraph)
\newcommand{\ben}[0]
{
  \parskip=-4pt
  \begin{enumerate}
  \itemsep=-3pt
}
\newcommand{\een}[0]
{
  \end{enumerate}
  \parskip=-4pt
}

% \bde, \ede - compact version of description
% note that parskip is changed. To reset it use \resetparskip
% (after any text following the list that's not a new paragraph)
\newcommand{\bde}[0]
{
  \parskip=-4pt
  \begin{description}
  \itemsep=-3pt
}
\newcommand{\ede}[0]
{
  \end{description}
  \parskip=-4pt
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% font size
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% font size - uncomment for standard print
\newcommand{\nsmall}{\small}
\newcommand{\nnormalsize}{\normalsize}
\newcommand{\nlarge}{\large}

% font size - uncomment for large print
%\newcommand{\nsmall}{\normalsize}
%\newcommand{\nnormalsize}{\Large}
%\newcommand{\nlarge}{\Large}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% quotex - including quotes in documents
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% create the .qt aux file
\newcommand{\qtinit}{
  \newwrite\qtaux
  \immediate\openout\qtaux=\jobname.qta
  \immediate\write\qtaux{! \jobname.qta}
}

% record the name of a quotable file
\newcommand{\qtpath}[1]{
  \immediate\write\qtaux{qtpath: #1}
}

% include a quote
\newcommand{\qt}[1]{
  \newread\qtfile
  \immediate\openin\qtfile=qt_#1.tex
  \ifeof\qtfile
    \immediate\closein\qtfile
    \immediate\write\qtaux{quote: #1}
  \else
    \immediate\closein\qtfile
    \input{qt_#1}
  \fi
}

% commands re-defined by the quotes files
\newcommand{\qtauthor}{}
\newcommand{\qttitle}{}
\newcommand{\qtdate}{}
\newcommand{\qtquote}{}
\newcommand{\qtpage}{}
\newcommand{\qtall}{}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% main.tex
%
% This is an example file for using Sheffield Latex conventions.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[10pt, a4paper]{article}
\input{preamble}
\begin{document}

\title{YAM minimal test file.}
%\author{The GATE Team}
%\address{Department of Computer Science, University of Sheffield, 
%Regent Court, 211 Portobello Street, Sheffield S1 4DP, UK. {\small \tt
%my-email@dcs.shef.ac.uk}}
\maketitle


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% main %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\1section{YAM minimal test file.}

\2section{Contents}
\n\bit\n
\item \url{#section-1.}{1. YAM Syntax}
\item ~~\url{#section-1.1.}{1.1. Changes from version 3}
\item ~~\url{#section-1.2.}{1.2. Contents label{contents}}
\item ~~\url{#section-1.3.}{1.3. Bold, italic, underline and teletype  label{bold}}
\item ~~\url{#section-1.4.}{1.4. Horizontal lines  label{hr}}
\item ~~\url{#section-1.5.}{1.5. Lists  label{lists}}
\item ~~\url{#section-1.6.}{1.6. Verbatim output  label{verbatim}}
\item ~~\url{#section-1.7.}{1.7. Footnotes  label{footnotes}}
\item ~~\url{#section-1.8.}{1.8. Escapes  label{escapes}}
\item ~~\url{#section-1.9.}{1.9. Headings  label{headings}}
\item ~~\url{#section-1.10.}{1.10. Links and anchors  label{links}}
\item ~~\url{#section-1.11.}{1.11. Block quotations  label{quotations}}
\item ~~\url{#section-1.12.}{1.12. Line breaks  label{linebreaks}}
\item ~~\url{#section-1.13.}{1.13. Tables  label{tables}}
\item ~~\url{#section-1.14.}{1.14. Images label{images}}
\item ~~\url{#section-1.15.}{1.15. Citations label{citations}}
\item ~~\url{#section-1.16.}{1.16. Inclusion label{inclusion}}
\item \url{#section-2.}{2. This is a title.}
\eit\n

\label{section-1.}\1section{1. YAM Syntax}

\label{section-1.1.}\2section{1.1. Changes from version 3}

\bit
\item horizontal lines are now three or more dashes 
\item comment syntax: %% for single lines, and /* */ for multiple lines
  (should replace notes?)
\item addition of column separator bars at the start and end of table rows
\item no dashes needed to separate table rows
\item multiple lines allowed in titles
\item added underlining
\item no more %output function
\item changed quotation syntax to %"
\item changed of line break style to %\
\item output is correct XHTML
\item verbatim output is %< ... %>
\item target language control characters (like < or \&) now dealt with properly
\item headings can be unnumbered, e.g. "%2*"
\eit


Slides: maybe:
\bit
\item if the document contains %slides then treat it all as slides
\item else if it contains %slide...%endslide then treat each of those as slides
\eit


\label{section-1.2.}\2section{1.2. Contents label{contents}}

Contents listings like that above are generated by '{\tt %contents}'


\label{section-1.3.}\2section{1.3. Bold, italic, underline and teletype  label{bold}}

Bold text is contained in stars: *this is bold* becomes {\bf this is bold}.

Italic text is contained in underscores: _this is italic_ becomes {\it this is
italic}.

Fixed-width text is contained in equals signs: =this is teletype=
becomes {\tt this is teletype}.

Underlined text is contained in doubles undercores: __this is underlined__
becomes {\ulthis is underlined}.


\label{section-1.4.}\2section{1.4. Horizontal lines  label{hr}}

Horizontal lines are indicated by 3 or more - signs at the start of a line.
For example:
\begin{verbatim}---\end{verbatim}
and
\begin{verbatim}---------------------------\end{verbatim}
both result in:
\hrulefill


\label{section-1.5.}\2section{1.5. Lists  label{lists}}

Unordered lists are indicated by '-' at the start of a line, and ordered
lists by 'o'. Nesting is indicated by increased spacing preceding the item
indicator. For example:
\begin{verbatim}
- This is an undordered list
- Second item
  o This is a nested...
  o ...ordered list
- Back to the third item of the enclosing list
\end{verbatim}
results in:

\bit
\item This is an undordered list
\item Second item
  \ben
  \item This is a nested...
  \item ...ordered list
  \een
\item Back to the third item of the enclosing list
\eit


\label{section-1.6.}\2section{1.6. Verbatim output  label{verbatim}}

Verbatim output starts with '%<' and ends with '%>'. For example:

%< 
This will *not* get translated.
%>

When the target language is HTML, for example, the output will contain
'<pre>' tags.


\label{section-1.7.}\2section{1.7. Footnotes  label{footnotes}}

Footnotes are like this:
\begin{verbatim}
%footnote(This is a footnote.)
\end{verbatim}
Becomes:\url{#footnote1}{1}.

The contents will be put in a section at the end of the document (HTML) or at
the bottom of the page (LaTeX), and linked by number from where they occured.


\label{section-1.8.}\2section{1.8. Escapes  label{escapes}}

To stop a special character from being interpreted, use a '\'. For example,
\begin{verbatim} \--- \end{verbatim}
will not generate a line.


\label{section-1.9.}\2section{1.9. Headings  label{headings}}

Headings are lines starting with {\tt %1} (for first level), {\tt %2}, {\tt %3} or
{\tt %4}. For example, the heading for this section is
\begin{verbatim}
%2 Headings
\end{verbatim}

If a heading level is followed by "*" it is not numbered, e.g.:
\begin{verbatim}
%2* An unnumbered heading
\end{verbatim}
Becomes:
\2section{An unnumbered heading}

This heading will not appear in the contents table.


\label{section-1.10.}\2section{1.10. Links and anchors  label{links}}

Links can be specified in three ways:
\ben
\item As plain text, e.g. 'http://gate.ac.uk/'
  will become \url{http://gate.ac.uk/}http://gate.ac.uk/
\item Using '{\tt %(target)}', e.g. {\tt %(http://gate.ac.uk/)}
  will become \url{http://gate.ac.uk/}http://gate.ac.uk/
\item Using '{\tt %(target, label)}', e.g. {\tt %(http://gate.ac.uk/, GATE home)}
  will become \url{http://gate.ac.uk/}GATE home
\een

Spaces or commas inside URLs must be escaped. A URL that appears in plain text
must be followed by a space, tab or newline.

Anchors and labels are specified using '{\tt %#name}'. For example,
\begin{verbatim}
%2 A Heading %#label
\end{verbatim}
will result in a heading followed by the anchor {\tt label}.

Spaces or commas inside anchors must be escaped. An anchor that appears in
plain text must be followed by a space, tab or newline.


\label{section-1.11.}\2section{1.11. Block quotations  label{quotations}}

Block quotations are enclosed in %" marks. For example,
\begin{verbatim}
  %"This is a quote%"
\end{verbatim}
becomes:
  egin{quotation}This is a quote\end{quotation}


\label{section-1.12.}\2section{1.12. Line breaks  label{linebreaks}}

Line breaks are indicated by %\ at the end of a line. For example:
\begin{verbatim}
This line is broken %\
in two.
\end{verbatim}
becomes: \\This line is broken \\in two.


\label{section-1.13.}\2section{1.13. Tables  label{tables}}

Tables use square brackets, bars and dashes. For example:
\begin{verbatim}
%[
 | *header col 1*	| *header col 2*        |
 | row 1 col 1	        | col 2                 |              
 | row 2 col 1	        | col 2                 |
%]
\end{verbatim}
results in:
\begin{table}
  {\bf header col 1}	 &  {\bf header col 2}         & \\
  row 1 col 1	         &  col 2                  & \\
  row 2 col 1	         &  col 2                  & \\
\end{table}


\label{section-1.14.}\2section{1.14. Images label{images}}

Images are like URLs:
\bit
\item '{\tt %image(test-image.jpg)}' will become \includegraphics{ src="test-image.jpg"}
\item '{\tt %image(test-image.jpg, a test image)}' will become \includegraphics{ src="test-image.jpg" alt="a test image"} (the text becomes the "alt" attribute of the image)
\eit


\label{section-1.15.}\2section{1.15. Citations label{citations}}

Citations work like this: '{\tt %cite(Cun06a)}' becomes \cite{\cite{Cun06a}}. Multiple
cite keys should be separated by commas, e.g.: '{\tt %cite(Cun05a,Cun06a)}'
becomes \cite{\cite{Cun05a}, \cite{Cun06a}}.


\label{section-1.16.}\2section{1.16. Inclusion label{inclusion}}

A page can include another page like this:
\begin{verbatim}
%include(yam-first.yam)
\end{verbatim}
Becomes:

\label{section-2.}\1section{2. This is a title.}

This, by way of {\bf contrast}, is a paragraph.

This is another paragraph. It contains
two lines.


\1section{Footnotes}
\n\ben\n
\item 
\label{footnote1}
This is a footnote.

\een\n
\end{document}