\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{experimentTitle}

\usepackage{tex/coms}
\usepackage{multirow}
\usepackage{array}
\usepackage{etoolbox}
\usepackage{ifthen}

\makeatletter
\newcounter{researchercount}
\setcounter{researchercount}{1}
\newcommand{\addResearcher}[1]{\listadd{\researchers}{#1}}
\newcommand{\researchercs}[1]{
    \ifthenelse{\isodd{\theresearchercount}}
    {
        & \underline{(\theresearchercount) #1}
    }
    {
        & \underline{(\theresearchercount) #1} \@arraycr
    }
    \stepcounter{researchercount}
}

\newcounter{expdatecount}
\setcounter{expdatecount}{0}
\newcommand{\expdates}{}
\newcommand{\addExperimentDate}[1]{\listadd{\expdates}{#1}}
\newcommand{\expdatecs}[1]{\stepcounter{expdatecount} & \underline{\theexpdatecount. #1} \@arraycr}

\newcommand{\expgroup}[1]{\def\@expgroup{#1}}
\newcommand{\reportid}[1]{\def\@reportid{#1}}

\newcommand{\experimentTitle}{
    \begin{titlepage}
        \thispagestyle{empty}
        \begin{flushright}
            提出締切\hspace{2em}{\@dueyear \@duemonth \@dueday}
            
            提出\qquad\hspace{1.84375em}{\@turninyear \@turninmonth \@turninday}
        \end{flushright}

        \vspace{2em}

        \begin{center}
            {\Large {\@schoolyear}年度 {\@department}\quad {\@grade}年}

            \vspace{2em}

            {\Huge {\@subject}レポート}
        \end{center}

        \begin{flushleft}
            \vspace{1em}

            レポート記号：\qquad {\@reportid}

            \vspace{1em}

            実験テーマ名：\qquad {\@title}

            \vspace{1em}

            提出者：\quad \underline{実験班：\quad \@expgroup}\quad \underline{名列番号\quad \@seatingnum}\quad \underline{氏名\quad \@author}

            \vspace{1em}

            \hspace{-0.5625em}\begin{tabular}{ lp{5em}p{5em} }
                \multirow[t]{3}{7.3125em}{共同実験者：} \forlistloop{\researchercs}{\researchers}
            \end{tabular}

            \vspace{5em}

            \hspace{-0.5625em}\begin{tabular}{ lp{5em} }
                \multirow[t]{3}{7.3125em}{実験実施日：} \forlistloop{\expdatecs}{\expdates}
            \end{tabular}
        \end{flushleft}
    \end{titlepage}
}
\makeatother
