In my last question, Reading a student class list, I asked how to read a list of students and create a class list. Everything works ok as @egreg had a wonderful answer. I am now attempting to create a semester attendance sheet that imports students names and has some keys that can be user input like University Name, Course Name, etc.
Another key thing am looking to achieve is, say, you have a course that you are offering only Monday and Wednesdays or Tuesday and Thursday or Monday, Wednesdays and Thursdays (depends on the days you teach the course), I want to be able to print on the column headers the day and date as shown from say a semester running from August 19, 2019 to December 6, 2019 (shown below). Of course for this new semester it would be from January 6, 2020 to May 8, 2020.
They way I have been doing this is looking at my calendar and sorting only the two or three days I teach the course and identify the date for each manually and then input it in the file and print. Note that the table wont fit in a page so needs to restart/ continue on the following page keeping the first 3 columns.
I noticed in my MWE a few issues, the words in the picture below don't have the spaces that should usually be there.
Update: Adding ~ in between the words with spaces fixed this issue.
Here is my MWE:
\documentclass[10pt]{article}
\usepackage[margin=1cm,landscape]{geometry} % make room
\usepackage{xparse,array,graphicx}
\newsavebox\TBox
\newif\ifrotate\rotatefalse
\newcolumntype{C}{%
>{\begin{lrbox}{\TBox}\arraybackslash}
c
<{\end{lrbox}\ifrotate\rotatebox{90}{\usebox\TBox}\else\usebox\TBox\fi}}
\newcommand{\rotateon}{\global\rotatetrue}% rotate switch ON
\newcommand{\rotateoff}{\global\rotatefalse}% rotate switch OFF
\ExplSyntaxOn
\NewDocumentCommand{\studentlist}{m}
{% #1 = file name
\azetina_studentlist:n { #1 }
}
\ior_new:N \g_azetina_studentlist_stream
\seq_new:N \l_azetina_studentlist_seq
\seq_new:N \l__azetina_studentlist_temp_seq
\tl_new:N \l__azetina_studentlist_header_tl
\cs_new_protected:Nn \azetina_studentlist:n
{
\seq_clear:N \l_azetina_studentlist_seq
\ior_open:Nn \g_azetina_studentlist_stream { #1 }
\int_zero:N \l_tmpa_int
% populate the sequence
\ior_map_inline:Nn \g_azetina_studentlist_stream
{
\int_incr:N \l_tmpa_int
\seq_put_right:Nx \l_azetina_studentlist_seq
{
\int_to_arabic:n { \l_tmpa_int } & \exp_not:n { ##1 } & & & &
}
}
% build the header
\tl_set:Nn \l__azetina_studentlist_header_tl
{
\# & \textbf{Student~Name} & \textbf{Ab/T} & & &
}
% make the table
\par\noindent
\begin{tabular}{|r|l|c|*{3}{C|}}
\cline{4-6}%
\multicolumn{3}{l|}{%
%\makecell[l]{%
\parbox[b]{16em}{%
University Name\\ %
Course Name (Course Code)\\ %
Lecturer Name\\ %
\null\\
\today\\
\null%
%}
}%
}&
\rotateon %
\parbox{10em}{Monday\par August 19, 2019} &%
\parbox{10em}{Wednesday\par August 21, 2019}&%
\parbox{10em}{Monday\par August 26, 2019}\\ % These dates are manually entered. Can they be calculated and printed in columns?
\hline%
\rotateoff %
\tl_use:N \l__azetina_studentlist_header_tl \\ \hline
\seq_map_function:NN \l_azetina_studentlist_seq \__azetina_studentlist_row:n
\end{tabular}
}
\cs_new_protected:Nn \__azetina_studentlist_row:n
{
#1 \\ \hline
}
\ExplSyntaxOff
\begin{document}
\studentlist{MATH1004CL}
\end{document}
Thus, how can I print the columns when the course is taught and make it so that it can propagate across multiple pages?
I am looking for some user input like:
\semester{8/19/2019}{12/06/2019}
\schoolweek{M}{W} % where M = Monday and W = Wednesday are the days printed from the two dates set above in \semester


xparse, which is coded using the LaTeX 3 conventions. The purpose of this mode is to be able to avoid the problems with finicky spacing that are present with LaTeX 2e -- so all typed spaces in the code are ignored! But you can use\spacewhere a real output space is wanted. (Someone else should be able to help with the question regarding the printing of the daily forms.) – barbara beeton Jan 05 '20 at 04:49~will do right? – azetina Jan 05 '20 at 06:19~should work. I haven't tried it, but you should; it's surely easier to read and understand than\space. – barbara beeton Jan 05 '20 at 14:57