to compile:
g++ -o grad *.cc

for Intel:
g++ -arch x86_64 -o grad *.cc

for Arm:
g++ -arch arm64 -o grad *.cc

for universal:
g++ -arch arm64 -arch x86_64 -o grad *.cc


to run:
./grad

toy example: see file "example",
load with "\infile example" or easier with "\in example"
or easiest with "\\" (loads the file "default", which
in turns loads example).

---------------------------------------
commands:


\help           print this list of commands

\list           list of all students, exams, and grades

\student        define new student
		  grad> \student name comments

\exam           define new exam:
		  grad> \exam name weight x1 y1 x2 y2 comments
		The weight will be used in the computation of averages (see
		\avg). (x1,y1) and (x2,y2) are two points that define the
		linear scale used for converting points into grades. The linear
		scale is cut off at minimum and maximum defined by \range and
		the grade is rounded according to precision set by \rounding.

\grade          define new grade:
		  grad> \grade name weight comments
		The weight will be used in the computation of averages (see
		\avg).

\possiblepoints define list of maximum possible points per problem:
		  grad> \possiblepoints exam 10 10 20 20

\sort           sort exams and grades:
			n sort according student name
			g sort according to grade
			c sort according to student's comment
		If no exams or grades are given, the student list is sorted
		instead (unless the sorting order is 'g', which is then
		ignored).
		  grad> \sort n s1 s2
		  grad> \sort c

\avg            compute resulting average grade from list of given exams and
		grades, taking into account the weight of each exam and grade.
		The result is rounded according to precision set by \rounding
		and cut off at minimum and maximum defined by \range.
		  grad> \avg final < s1 s2 s3

\max            pick maximum grade from list of given exams and grades, rounded
		according to precision set by \rounding and cut off at minimum
		and maximum defined by \range.
		  grad> \max final < s1 s2 s3

\min            pick minimum grade from list of given exams and grades, rounded
		according to precision set by \rounding, and cut off at minimum
		and maximum defined by \range.
		  grad> \min final < s1 s2 s3

\range          set minimum and maximum value for grades. Default is 1 6.
		  grad> \range 1 6

\rounding       set rounding precision for computing grades. If set to 0,
		rounding is switched off. Default is 0.25.
		  grad> \rounding 0.5

\infile         read file
		  grad> \infile myfile

\\              read file 'default', i.e., equivalent to
		  grad> \infile default

\stop           ignore rest of file

\show           with student or exam/grade: show student or exam/grade
		without argument: show overview of all students and all
		their exam grades and grades
		  grad> \show s1
		  grad> \show laura
		  grad> \show

\line           print empty line

\hide           hide (or unhide if already hidden) exams and grades or students:
		A hidden grade/exam does not show up in overview or in printlatex.
		  grad> \hide s1 s2
		A hidden student is ignored in any upcoming booking of grades
		and exams.
		  grad> \hide name

\setlatexfolder set path and name of folder where all LaTeX files will be
		written to. Default is 'default_LaTeX_folder'.
		  grad> \setlatexfolder myfolder

\class          set name of class, used as title on all LaTeX files. If no
		arguments are given, the class name is reset to the empty
		string. Default is empty.
		  grad> \class name used as title

\printlatex     print all students, exams, and grades, each as a separate
		LaTeX file, into the folder previously set by \setlatexfolder.
		In addition the files 'z_overview.tex', which shows an
		an overview of all students and their grades, and
		'z_studlist.tex', which is an empty table of all students,
		are generated.
		NB: To compile these LaTeX-files the stylefile 'research19.sty'
		is required. This stylefile is distributed together with the
		source code of this program.
		Optional arguments:
			l	 landscape format
			a	 anonymous: no student names are printed
			c	 comment instead of name is printed
			integer	 number of columns in empty student table
				 (default is 12)
		  grad> \printlatex cl14
		  grad> \printlatex l

\reset          erase everything

\quit           exit program



commands need not be spelled out in full: e.g., "\sh" suffices
If the expansion is not unique, the first command in alphabetical order
is executed: e.g., "\h" will be expanded to "\help", not "\hide" 

---------------------------------------
History:
1.0 (May 2021): Stefan Moser
	 	-new version based on Andi's buha
1.1 (May 2021): Stefan Moser
    	 	-negative numbers
		-average/stddev
		-rounding can be switched off
1.2 (May 2021): Stefan Moser
    	 	-removed strngp from exam_entry as it is not needed,
		 instead added pointer to exam to each entry
		-sorting command
		-clear exam/grade command
		-show comment of exam in student view
1.3 (May 2021): Stefan Moser
    	 	-removed clear command as it caused segmentation faults
	 	-listing now also prints comments of exam
		-names of exams/grades and of students cannot be the same
		-if exam/grade is hidden, \show does not print it
		-order of exactgrade and grade fixed
		-latex print: generates separate tex-files:
       		  every student	     => name.tex
		  every exam	     => name.tex
       		  every grade	     => name.tex
       		  overview (show)    => z_overview.tex
       		  empty student list => z_studlist.tex
		  with arguments: c (comment instead of name for stud)
		      		  a (anonymous without names for stud)
      		  		  15 (number of fields in studlist)
				  l (landscape)
1.4 (May 2021): Stefan Moser
    	 	-fixed spacing in LaTeX code
		-added +-booking that allows overwrite of grades
		-added min-command
		-added \setlatexfolder command to fix foldername for
		 \printlatex
		-fixed alphabetical sorting with special characters
		 (replaces ä, ü, ö, ë, é, è, ê, and capitals)
1.5 (June 2021): Stefan Moser
    	  	-makes sure _numberofproblems is always largest number of
		 problems, and fixes corresponding output
		-added average points calculation for exams
1.6 (June 2021): Stefan Moser
    	  	-improved help
1.7 (June 2021): Stefan Moser
    	  	-range is now checked also on \avg, \max, \min
1.8 (July 2021): Stefan Moser
    	  	-added sorting feature to student-list: \sort c and \sort n
		 now additionally also sorts the students according to name
		 or comment. Has impact for \sh and z_overview.tex and
		 z_studlist.tex
		-fixed a mistake in \max and \min: calculate with grade, not
		 exactgrade!
		-changed output of grade: if created by \avg/\max/\min then
		 the corresponding grades used for the computation are also
		 shown
		-tweaked and fixed LaTeX-output a bit more
1.9 (July 2021): Stefan Moser
    	  	-new command \class to set titles of LaTeX files
1.10 (January 2022): Stefan Moser
     	     	-empty center title in z_studlist.tex
		-universal and intel versions
1.11 (May 2022): Stefan Moser
     	  	-improved example, with separate default file
		-default latexfolder is now called "default_LaTeX_folder"
1.12 (July 2022): Stefan Moser
     	   	-fixed a sorting bug that messed things up when sorting
		 according to 'c' (was introduced in version 1.8). The
		 command \sort has been redefined. Also the student list
		 by default keeps the order of definition, unless \sort
		 is invoked.
		-adapted example accordingly
1.13 (December 2023): Stefan Moser
     	        -fixed LaTeX code: spacing of "points to grade",
		 \frenchspacing everywhere, added space after colon
		-presentation of grades in \show: average and stdev
		 are now moved to the correct column
1.14 (January 2025): Stefan Moser
     	        -changed LaTeX to research19.sty
		-added command \possiblepoints
		-updated included example-files
1.15 (February 2025): Stefan Moser
     	        -fixed sort according to points: takes first order of
		 final grade and only then of exact grade
1.16 (February 2026): Stefan Moser
    	        -\hide for students
1.17 (February 2026): Stefan Moser
    	        -\hide for students: \sh and \printlatex now also ignores
		 hidden students
		-improved z_studlist.tex with automatic numbering of
		 columns
1.18 (June 2026): Stefan Moser
     	   	-fixed precision issue by adding 1e-12 before rounding
		-changed all floats to double

