Author: tziade
Date: Sun Feb 26 00:34:20 2006
New Revision: 2474

Added:
   cookbook/trunk/macros.tex
   cookbook/trunk/recipe0.tex
Log:
added macros and recipe 0

Added: cookbook/trunk/macros.tex
==============================================================================
--- (empty file)
+++ cookbook/trunk/macros.tex   Sun Feb 26 00:34:20 2006
@@ -0,0 +1,104 @@
+% Import all the nice and important packages
+\usepackage{amssymb, amsmath} % Allows math symbols.
+\usepackage{epsfig} % Allows us to insert EPS figures.
+\usepackage{eso-pic}
+\usepackage{graphicx}
+\usepackage{fancyvrb}
+\usepackage[obeyspaces]{url}
+\usepackage{listings}
+\usepackage{nameref}
+\usepackage[usenames]{color}
+
+% Setup up listings.
+\lstnewenvironment{python}
+{
+\lstset{language=Python,
+        fancyvrb=true,
+        morekeywords={self},
+        basicstyle=\footnotesize\ttfamily,
+        basewidth=0.51em,
+        stringstyle=\ttfamily\color{Blue},
+        keywordstyle=\color{BlueViolet}\bfseries,
+        commentstyle=\color{BrickRed}\itshape,
+        showstringspaces=false}
+}{}
+
+\lstnewenvironment{codetext}
+{
+\lstset{language=Python,
+        fancyvrb=true,
+        basicstyle=\footnotesize\ttfamily,
+        basewidth=0.51em,
+        showstringspaces=false}
+}{}
+
+\lstnewenvironment{zcml}
+{
+\lstset{language=XML,
+        fancyvrb=true,
+        basicstyle=\footnotesize\ttfamily,
+        basewidth=0.51em,
+        stringstyle=\ttfamily\color{Blue},
+        keywordstyle=\color{BlueViolet}\bfseries,
+        commentstyle=\color{BrickRed}\itshape,
+        showstringspaces=false}
+}{}
+
+\lstnewenvironment{xml}
+{
+\lstset{language=XML,
+        fancyvrb=true,
+        basicstyle=\footnotesize\ttfamily,
+        basewidth=0.51em,
+        stringstyle=\ttfamily\color{Blue},
+        keywordstyle=\color{BlueViolet}\bfseries,
+        commentstyle=\color{BrickRed}\itshape,
+        showstringspaces=false}
+}{}
+
+\lstnewenvironment{zpt}
+{
+\lstset{language=XML,
+        fancyvrb=true,
+        basicstyle=\footnotesize\ttfamily,
+        basewidth=0.51em,
+        stringstyle=\ttfamily\color{Blue},
+        keywordstyle=\color{BlueViolet}\bfseries,
+        commentstyle=\color{BrickRed}\itshape,
+        showstringspaces=false}
+}{}
+
+\lstnewenvironment{css}
+{
+\lstset{fancyvrb=true,
+        basicstyle=\footnotesize\ttfamily,
+        basewidth=0.51em,
+        stringstyle=\ttfamily\color{Blue},
+        keywordstyle=\color{BlueViolet}\bfseries,
+        commentstyle=\color{BrickRed}\itshape,
+        showstringspaces=false}
+}{}
+
+\lstnewenvironment{shell}
+{
+\lstset{fancyvrb=true,
+        basicstyle=\footnotesize\ttfamily,
+        basewidth=0.51em,
+        showstringspaces=false}
+}{}
+
+
+% Problem/Task
+\newenvironment{problem}
+{
+% todo: see later
+}
+{}
+
+% Solution
+\newenvironment{solution}
+{
+% todo: see later
+}
+{}
+

Added: cookbook/trunk/recipe0.tex
==============================================================================
--- (empty file)
+++ cookbook/trunk/recipe0.tex  Sun Feb 26 00:34:20 2006
@@ -0,0 +1,105 @@
+\documentclass{book}
+\pagestyle{headings}
+\include{macros}
+
+\begin{document}
+
+\chapter{Dummy Recipe}
+
+\begin{problem}
+This dummy recipe is a tutorial on how to write a recipe.
+\end{problem}
+
+\begin{solution}
+
+\section*{Recipe structure}
+
+A recipe is made of a problem and a solution section.
+
+\begin{itemize}
+\item The problem describe in less than 20 lines the problem to solve.
+
+\item The solution is made of sections and subsections, and provide the
+solution.
+\end{itemize}
+
+The solution can contain text and code. The code can be made with several
+specific commands.
+
+\section*{Specific commands for the code blocs}
+
+You can define special sections to present Python, ZPT, XML, CSS,
+and ZCML examples. They are all defined in macros.tex. They help
+you write examples.
+
+\subsection*{Python}
+
+\begin{python}
+    >>> import math
+    >>> math.pow(2, 4)
+    16.0
+\end{python}
+
+\subsection*{Codetext}
+
+\begin{codetext}
+    >>> import math
+    >>> math.pow(2, 4)
+    16.0
+\end{codetext}
+
+
+The only difference between Codetext and Python is that Python blocs are
+executed for real.
+
+\subsection*{ZCML}
+\begin{zcml}
+    <page
+      for="IMyInterface"
+      name="mypage.html"
+      permission="the.permission"
+      layer="the_layer"
+      class="MyClass"
+      template="my_template.pt" />
+\end{zcml}
+
+\subsection*{XML or HTML}
+\begin{xml}
+    <PERSONS>
+      <PERSON>
+        <NAME>John</NAME>
+      </PERSON>
+    </PERSONS>
+\end{xml}
+
+\subsection*{CSS}
+\begin{css}
+    .style {
+      background: 1px;
+      color: red;
+    }
+\end{css}
+
+\subsection*{Shell}
+\begin{shell}
+    [EMAIL PROTECTED]:/home/svn.z3lab.org/cookbook\$ ls -lh
+    total 72K
+    -rw-r--r--  1 tziade tziade  647 2006-02-25 23:30 cookbookmacros.aux
+    -rw-r--r--  1 tziade tziade 2,9K 2006-02-25 23:30 cookbookmacros.tex
+    -rw-r--r--  1 tziade tziade  158 2006-02-25 23:30 recipe1.aux
+    -rw-r--r--  1 tziade tziade 1,2K 2006-02-25 23:30 recipe1.tex
+\end{shell}
+
+\section*{About latex}
+
+You can find infos about latex on several sites, like the UK FAQ:
+
+  \url{http://www.tex.ac.uk/cgi-bin/texfaq2html}
+
+\section*{Good practices}
+
+Here will rely a list of good practices about Latex and the cookbook writing.
+\end{solution}
+
+
+\end{document}
\ No newline at end of file
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to