1

I am trying to develop a class file for my department. I want to add two dependencies to the \maketitle command. As we have \title & \author as compulsory commands for \maketitle, I want \supervisor and as we have \date which is optional, I want \subtitle. I have tried the following code. It's not working. What mistake am I committing?

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{ML}[2020/01/24 MWE class-file]

\LoadClass{book}
\newcommand{\supervisor}[1]{\textsc{supervisor : #1}}
\newcommand{\subtitle}[1]{\textsc{}}
\renewcommand{\maketitle}{
    \makeatletter
    \thispagestyle{empty}
    \fboxsep3em
    \noindent\fbox{\begin{minipage}
            [c][\dimexpr\textheight-2\fboxsep-2\fboxrule]
            [c]{\dimexpr\linewidth-2\fboxsep-2\fboxrule}
            \begin{center}
                \bigskip
                \textbf{{\LARGE \textsc{\@title}}%\\
                    %\vspace{0.2cm}
                    %{\@subtitle}
                }
                \\
                \vfill
                {\large\textsc{\@author}}\\
                %   \vspace{0.5in}
                %   {\large \@supervisor}
                \vspace{0.5in}
                \textsc{\@date}
            \end{center}
        \end{minipage}}
        \makeatother}
Niranjan
  • 3,435

1 Answers1

1

Please check with below given modified MWE

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{ML}[2020/01/24 MWE class-file]

\LoadClass{book}
\let\@superwiser\@empty%
\def\superwiser#1{\def\@superwiser{\textsc{superwiser :#1}}}%

\let\@subtitle\@empty%
\def\subtitle#1{\def\@subtitle{\textsc{#1}}}%

\renewcommand{\maketitle}{
    \makeatletter
    \thispagestyle{empty}
    \fboxsep3em
    \noindent\fbox{\begin{minipage}
            [c][\dimexpr\textheight-2\fboxsep-2\fboxrule]
            [c]{\dimexpr\linewidth-2\fboxsep-2\fboxrule}
            \begin{center}
                \bigskip
                \textbf{{\LARGE \textsc{\@title}}\\
                    \vspace{0.2cm}
                    {\@subtitle}
                }
                \\
                \vfill
                {\large\textsc{\@author}}\\
                   \vspace{0.5in}
                   {\large \@superwiser}\\
                \vspace{0.5in}
                \textsc{\@date}
            \end{center}
        \end{minipage}}
        \makeatother}

\endinput

Usage

\documentclass{ML}

\begin{document}

\title{Title}
\subtitle{Subtitle}
\author{Author}

\superwiser{Name}
\maketitle

\end{document}
MadyYuvi
  • 13,693