diff options
Diffstat (limited to 'Master/texmf-dist/doc/generic/c-pascal/demo2.tex')
-rw-r--r-- | Master/texmf-dist/doc/generic/c-pascal/demo2.tex | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/generic/c-pascal/demo2.tex b/Master/texmf-dist/doc/generic/c-pascal/demo2.tex index bd26d89b713..548ef8ee21b 100644 --- a/Master/texmf-dist/doc/generic/c-pascal/demo2.tex +++ b/Master/texmf-dist/doc/generic/c-pascal/demo2.tex @@ -1,4 +1,18 @@ \input cap +\let\IdentifierColor=\Black +\let\KeywordColor=\MidnightBlue +\let\SpecialColor=\Black +\let\SymbolColor=\Black +\let\CommentColor=\Gray +\let\TextColor=\ForestGreen +\let\DirectiveColor=\Tan +\SpaceSkip=1.3ex + +% Just for fun, you can use a cyrillic font for identifiers +% Of course, any font can be changed just like in the non-color +% version of cap. +%\font\cirm=wncyi10\let\IdentifierFont=\cirm + A short program in C. It was inserted directly into the \TeX\ source file. @@ -46,4 +60,31 @@ This one was imported from another file. \medskip \InputPascal{prog/guess.pas} +\vfill\eject + +And now, my latest addition: programs written in Python. The first one +is typed directly into the file. + +\medskip +\BeginPython +def fib(n): + """Calculates Fibonacci series. + + It returns the first member of Fibonacci series larger than n""" + a,b=1,1 + while b <= n: + a,b = b,a+b # see how we use multiple assignment? + return b + +fib(10) +\EndPython + +\hrule +\bigskip + +This one was imported from another file. + +\medskip +\InputPython{prog/fib.py} + \bye |