TITLE: Demo document with computer code
AUTHOR: HPL
DATE: today

======= Data file =======

Suppose we have some data in a file. The final
result of including this file with `@@@CODE mydat.txt` (which implies
a code environment starting with `!bc dat`) looks like this:

@@@CODE mydat.txt envir=dat

======= Complete program and terminal output =======

The following program
# #if FORMAT in ('latex', 'pdflatex')
(which breaks a page)
# #endif
reads the data in the file and performs analysis (typeset with `!bc pypro`):

@@@CODE fileread.py
The output becomes (typeset with `!bc sys`):

!bc sys
Terminal> python fileread.py

mean=-0.006005
st.dev=0.583542
correlation matrix:
[[ 1.          0.0509676   0.52406366  0.20964645  0.1574504 ]
 [ 0.0509676   1.         -0.30920845 -0.12129049  0.7611538 ]
 [ 0.52406366 -0.30920845  1.          0.49355806 -0.42263817]
 [ 0.20964645 -0.12129049  0.49355806  1.         -0.38286589]
 [ 0.1574504   0.7611538  -0.42263817 -0.38286589  1.        ]]
!ec

======= Code snippet =======

Fortran 77 is also sometimes handy. Snippets in that language are
typeset inside `!bc fcod` environments.

!bnotice Fortran code box
!bt
\[ r_i = ca_i,\quad i=1,\ldots,n\]
!et

!bc fcod
       subroutine process(a, n, c, r)
C      This subroutine returns array r = c*a
       integer n
       real*8 a(n), c, r(n)
       integer i
       do i = 1,n
          r(i) = c*a(i)
       end do
       return
       end
!ec
!enotice