Author: tziade Date: Fri Mar 3 01:21:30 2006 New Revision: 2516 Modified: cookbook/trunk/macros.tex cookbook/trunk/recipe0.en.tex Log: simpler layout
Modified: cookbook/trunk/macros.tex ============================================================================== --- cookbook/trunk/macros.tex (original) +++ cookbook/trunk/macros.tex Fri Mar 3 01:21:30 2006 @@ -5,87 +5,20 @@ \usepackage{graphicx} \usepackage{fancyvrb} \usepackage[obeyspaces]{url} -\usepackage{listings} \usepackage{nameref} \usepackage[usenames]{color} +\usepackage{listings} % 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} +\newenvironment{python} { -\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} +\newenvironment{code} { -\lstset{fancyvrb=true, - basicstyle=\footnotesize\ttfamily, - basewidth=0.51em, - showstringspaces=false} -}{} +} +{} % Problem/Task Modified: cookbook/trunk/recipe0.en.tex ============================================================================== --- cookbook/trunk/recipe0.en.tex (original) +++ cookbook/trunk/recipe0.en.tex Fri Mar 3 01:21:30 2006 @@ -29,67 +29,41 @@ \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} +You can define special sections to present a code bloc. Either use verbatim +to define code or Verbatim to define code that will be run by the tests. + +verbatim: +\begin{verbatim} +>>> import math +>>> math.pow(2, 4) +16.0 + +<page + for="IMyInterface" + name="mypage.html" + permission="the.permission" + layer="the_layer" + class="MyClass" + template="my_template.pt" /> + +<PERSONS> + <PERSON> + <NAME>John</NAME> + </PERSON> +</PERSONS> + +.style { + background: 1px; + color: red; +} +\end{verbatim} + +Verbatim: +\begin{Verbatim} +>>> import math +>>> math.pow(2, 4) +16.0 +\end{Verbatim} \section*{About latex} @@ -97,10 +71,6 @@ \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 +\end{document} -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins