\documentclass[6pt, a4paper]{article}
\usepackage[pdftex]{graphicx}
\usepackage{paralist} % needed for compact lists
\usepackage[normalem]{ulem} % needed by strike

\usepackage[utf8]{inputenc}  % char encoding
\usepackage[english,frenchb,francais]{babel}  % user defined
\usepackage[T1]{fontenc}  % user defined
\usepackage[cm]{aeguill}  % user defined
\usepackage{../includes/cyoa_A4}  % user defined

\title{txt2CYOA : a "choose your own adventure" easily made with txt2tags}
\author{by Farvardin (enter your own name here)}
\begin{document}
\begin{LARGE}
\date{2009-08-31}
\maketitle
\clearpage


\includegraphics{sample_txt2cyoa.png}

\hypertarget{0}{}
\textbf{\begin{center}\subsection*{\Huge{0}}\end{center}}

\begin{compactitem}
\item Start the tour \textbf{\htmladdnormallink{1}{\#1}}
\end{compactitem}

\hypertarget{intro}{}
\textbf{\begin{center}\subsection*{\Huge{1}}\end{center}}

txt2CYOA is a new way for creating "choose yourself your own adventure" books. \textit{(c'est par ici en français : \textbf{\htmladdnormallink{9}{\#9}})}

Thanks to the very easy syntax of \htmladdnormallink{txt2tags}{http://txt2tags.sf.net}, you write the story 
with simple markup, and can convert it to html or top quality pdf \textit{(by using LaTeX)}.

You can also include some images if you wish...  

Just study the instructions given in the source file and you're ready to use it !
You can modify the sample.t2t file and the cyoa\_A4.sty style file to make your game and customise the appearance.

\begin{itemize}
\item look at the \htmladdnormallink{txt2tags source}{sample.t2t}
\item admire the \htmladdnormallink{pdf output}{sample.pdf}
\item download the \htmladdnormallink{package}{../txt2cyoa.zip}
\item browse the \htmladdnormallink{code}{../}
\item Read the instructions in English \textbf{\htmladdnormallink{8}{\#8}}
\item ou ici en français : rendez-vous au \textbf{\htmladdnormallink{9}{\#9}}

\item or begin the sample story : \textbf{\htmladdnormallink{6}{\#6}}
\end{itemize}

\hypertarget{2}{}
\textbf{\begin{center}\subsection*{\Huge{2}}\end{center}}

There is nothing interesting in the boat.
This sample story is quite empty yet, but you can improve it yourself !

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

\begin{compactitem}
\item Go to the cliff :  \textbf{\htmladdnormallink{6}{\#6}}
\item Go to the village nearby :  \htmladdnormallink{3}{\#village}
\item Use the boat :  \textbf{\htmladdnormallink{7}{\#7}}
\end{compactitem}

\hypertarget{village}{}
\textbf{\begin{center}\subsection*{\Huge{3}}\end{center}}

You are in the village. There are some nice old houses there.

\begin{wrapfigure}{l}{0\textwidth} \vspace{-00mm}  \includegraphics[height=4cm]{sample_village.png} \vspace{-00mm} \end{wrapfigure} 

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

\begin{compactitem}
\item Go back to the cliff : \textbf{\htmladdnormallink{6}{\#6}}
\item Go the beach : \textbf{\htmladdnormallink{5}{\#5}}
\item Go to the market place : \textbf{\htmladdnormallink{4}{\#4}}
\item Enter your home :  \textbf{\htmladdnormallink{7}{\#7}}
\end{compactitem}

\hypertarget{4}{}
\textbf{\begin{center}\subsection*{\Huge{4}}\end{center}}

There is no one here.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

\begin{compactitem}
\item Go to the cliff : \textbf{\htmladdnormallink{6}{\#6}}
\item Go to beach : \textbf{\htmladdnormallink{5}{\#5}}
\item Go back to the entrance of the village : \htmladdnormallink{3}{\#village}
\end{compactitem}

\hypertarget{5}{}
\textbf{\begin{center}\subsection*{\Huge{5}}\end{center}}

You are on the beach. There is the sea in front of you. A boat is here.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

\begin{compactitem}
\item Go back to the cliff : \textbf{\htmladdnormallink{6}{\#6}}
\item Go to the village nearby : \htmladdnormallink{3}{\#village}
\item Look inside the boat : \textbf{\htmladdnormallink{2}{\#2}}
\end{compactitem}

\hypertarget{6}{}
\textbf{\begin{center}\subsection*{\Huge{6}}\end{center}}

You stand on the edge of a cliff.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

\begin{compactitem}
\item Go to the beach : \textbf{\htmladdnormallink{5}{\#5}}
\item Go to the village nearby : \htmladdnormallink{3}{\#village}
\end{compactitem}

\hypertarget{7}{}
\textbf{\begin{center}\subsection*{\Huge{7}}\end{center}}

Congratulation, the game is finished !

\begin{compactitem}
\item Go study how it works : \textbf{\htmladdnormallink{8}{\#8}}
\item Voir la version française : \textbf{\htmladdnormallink{9}{\#9}}
\end{compactitem}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

\hypertarget{8}{}
\textbf{\begin{center}\subsection*{\Huge{8}}\end{center}}

Create Choose your own Adventure with Txt2Tags (txt2CYOA)

Requirement : python and optionally tex + pdflatex (use texlive for ex.)

For using this template, you just need to create your sections using for ex. :

\begin{verbatim}
== z ==
\end{verbatim}

To create a choice, use either :

\begin{verbatim}
- Description of the choice : z
- Description of the choice : [z #z]. More words afterwards.
\end{verbatim}

with z being replaced by the number of your section. 
You must use the syntax \texttt{[z \#z]} if the number is followed by something 
and not alone at the end of the line.

You can also add more descriptive links with :

\begin{verbatim}
== z ==[name_of_link]
\end{verbatim}

and the call to this chapter would be :

\begin{verbatim}
- Go to this chapter : [z #name_of_link]
\end{verbatim}

You can add pictures with \texttt{[yourpicture.jpg]} (or .png)
To used wrapped pictures, use 

\begin{verbatim}
wrap =[yourpicture.jpg]=wrap
\end{verbatim}

(without space) 

It's also possible to expand the html game with one chapter on one html file.
For the general syntax, further tips and requirement for txt2tags, please go to :
\htmladdnormallink{http://txt2tags.sf.net}{http://txt2tags.sf.net}

For choosing between tex (pdf) and html, 
just comment and uncomment one of the 2 sections below beginning with "!target"
and invoque the file with " txt2tags txt2cyoa.t2t ". 
For creating the pdf use " pdflatex txt2cyoa.tex ".

You can also change your tex style and replace or modify cyoa\_A4.sty or  cyoa\_dayromanA4.sty (see the two lines after MORE OPTIONS and / or !style(tex))
Please note in the second example you'll need the tex font dayroman

It's possible to get a graph with all the chapters connected together.
You need to have graphviz installed to do that, and make sure each choice starts on one individual line, with a - and ends with the number of the choice.
The best is to use a Unix environment, and invoque "make all" in order to generate the html, pdf versions and the graph in svg and png as well.

\begin{compactitem}
\item Examine the organigramme : \textbf{\htmladdnormallink{10}{\#10}}
\end{compactitem}

\hypertarget{9}{}
\textbf{\begin{center}\subsection*{\Huge{9}}\end{center}}

Traduction française :
Créer des "livres dont vous êtes le héros" avec Txt2Tags (txt2CYOA)

Outils nécessaire : python éventuellement tex + pdflatex (utiliser texlive par ex.)

Pour utiliser ce modèle, il suffit de le copier dans un nouveau fichier 
et de créer des paragraphes avec cette syntaxe :

\begin{verbatim}
== z ==
\end{verbatim}

Pour créer un choix on peut utiliser ces 2 formules :

\begin{verbatim}
- Description du choix : z
- Description du choix : [z #z]. Et quelques mots ensuite.
\end{verbatim}

avec z symbolisant le numéro de votre paragraphe.
Il est obligatoire d'utiliser la syntaxe \texttt{[z \#z]} si le nombre est suivi de quelque chose 
et n'est pas tout seul à la fin de la ligne.

Il est également possible d'avoir des liens plus imagés avec (sans espace):

\begin{verbatim}
==z==[nom_du_lien]
\end{verbatim}

et l'appel à ce paragraphe serait :

\begin{verbatim}
- Aller à ce paragraphe : [z #nom_du_lien]
\end{verbatim}

Vous pouvez ajouter des images avec \texttt{[votreimage.jpg]} (ou .png)
Pour utiliser des images incluses dans le texte, on peut utiliser
la syntaxe 

\begin{verbatim}
wrap =[votreimage.jpg]=wrap
\end{verbatim}

(sans espace entre wrap et =)

Il est également possible d'avoir un paragraphe par fichier html.
Pour en apprendre plus sur les options et la syntaxe générale de txt2tags, 
il y a des manuels sur : \htmladdnormallink{http://txt2tags.sf.net}{http://txt2tags.sf.net}

Pour choisir entre tex (pdf) et html, 
il suffit de commenter une des deux sections commençant par "!target"
et d'invoquer le fichier avec " txt2tags txt2cyoa.t2t ". 
Pour générer le pdf il faut utiliser : " pdflatex txt2cyoa.tex ".

Vous pouvez également modifier le style tex cyoa\_A4.sty ou cyoa\_dayromanA4.sty
(voir les deux lignes après MORE OPTIONS et/ou !style(tex))
Dans le second exemple il vous faudra installer dayroman

Enfin, il est possible d'obtenir un organigramme avec tous les chapitres reliés
entre eux. Il faut le programme graphviz pour cela et veuillez à bien débuter les options
 possibles avec un tiret et de terminer chaque ligne par le chapitre choisi.
Le plus simple est d'utiliser un environnement Unix et de taper "make all" pour obtenir directement les versions html et pdf ainsi que l'organigramme en png et svg.

\begin{compactitem}
\item Examine the organigramme : \textbf{\htmladdnormallink{10}{\#10}}
\end{compactitem}

\hypertarget{10}{}
\textbf{\begin{center}\subsection*{\Huge{10}}\end{center}}

The organigramme of the game :

\includegraphics{sample_graph.png}

\begin{compactitem}
\item Now go to the last chapter (it's using the GBL syntax, but it's not working yet) : \textbf{\htmladdnormallink{12}{\#12}}
\end{compactitem}

\#11\# test\_chapter\_eleven

Nothing to do here

\begin{compactitem}
\item Back to the begining rendez-vous au \textbf{\htmladdnormallink{1}{\#1}}
\item Back to the help rendez-vous au \textbf{\htmladdnormallink{8}{\#8}}
\item To the end rendez-vous au \textbf{\htmladdnormallink{12}{\#12}}
\end{compactitem}

\#12\# Twelve

Another choice

\begin{compactitem}
\item Back to the begining rendez-vous au \textbf{\htmladdnormallink{1}{\#1}}
\item Back to the help rendez-vous au \textbf{\htmladdnormallink{8}{\#8}}
\item To eleven rendez-vous au \textbf{\htmladdnormallink{11}{\#11}}
\end{compactitem}


% LaTeX2e code generated by txt2tags 2.6b (http://txt2tags.sf.net)
% cmdline: txt2tags -t tex --outfile sample.tex sample.t2t
\end{LARGE}
\end{document}
