CS 2204 Lab 12

Your name here (please print):

Your student ID number here:

    In this lab you will hone your LaTex skills to perfection.

  1. (1 point) Download this file UNIX.ps and open it by gv UNIX.ps . If this does not work, open UNIX.pdf using acroread or xpdf .
  2. (An automatic A+ in this class ) Completely on your own create a LaTex code to reproduce the above. Just kidding.
  3. (2 points) Can you change "UNIX" into "CSVT" in the above picture? Here is the LaTex source: UNIX.tex " Make the PDF.
  4. (7 points) Now let's do something useful. Create a gawk script stat.awk that does the following. It takes a set of numbers as input and produces different averages of these numbers. It makes a LaTex input file that can then be converted into a PDF file to show these averages inside a nice looking table. You will compute the simple arithmetic average: (Sum_i data_i)/N . You will also compute this average: sqrt[ (Sum_i data_i*data_i )/N ] where N is the number of data points. Here is a hint on how to begin:
    awk 'BEGIN{ {s=0} {print "\\begin{document}" } {print "\\begin{tabular}" } } { s+= $1 } END {print s/NR }' < data
    
    where the input data file looks like this:
    12
    13.3
    17.5
    10.11
    0.11
    -6.11
    0.16
    
  5. In the example above the awk line computes the arithmetic average and also outputs parts of the latex code. You will need to extend it. The table should have two columns and two rows. Use the top row to label the numbers computed: use math symbols to define the averages you put in the cells below (that is use a symbol for the square root, for the sum, etc. ). The LaTex -> PDF step (as well as the LaTex compilation itself) can be done on the command line, outside of the script. I suggest you start by figuring out how to make the table you need in Latex. Most of the special math symbols you need (summation, etc) were introduced in the lecture.







  6. (2 extra points ) Write a bash script that executes stat.awk and does the rest to produce the PDF.