1

I'm writing my own simple template, what I have so far is a new, redefined make title command:

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{myclass}[2016/06/22 My custom class]
\LoadClass{article}

\usepackage{cmap}
\usepackage[T1]{fontenc}
\usepackage{longtable}
\usepackage{multirow}
\usepackage{fancybox}
\usepackage{rotating}
\usepackage{hyperref}
\usepackage{framed}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{graphicx}
\usepackage{pdfpages}
\usepackage{enumitem}


\newcommand{\LOGO}{logo.png}
\newcommand{\FIRST}[1]{#1}
\newcommand{\SECOND}[1]{#1}
\newcommand{\THIRD}[1]{#1}

\renewcommand{\maketitle}{
    \begin{titlepage}
        \vspace{10pt}
        \hbox{
            \mbox{
                \hspace{-20pt}
                \fbox{ \includegraphics{\LOGO}}
                \hspace{4pt}
            }
            \vrule depth 0.9\textheight
            \mbox{\hspace{2em}}
            \vtop{
                \vspace{20pt}
                \begin{flushleft}
                    \Large \FIRST \par
                \end{flushleft}
                \vspace{80pt}
                \begin{flushleft}
                    \Huge \bfseries \SECOND \par
                \end{flushleft}
                \begin{flushleft}
                    \large \bfseries \THIRD  \par
                \end{flushleft}
                \vfil
            }
        }
    \end{titlepage}
    \setcounter{footnote}{0}
}

In the new maketitle I'm using macros \FIRST, \SECOND, \THIRD which I defined as :

\newcommand{\FIRST}[1]{#1}

However, I would like the user using this template to be able to upload during writing the tex while any value to \FIRST is such a way that when the user is calling my \maketitle, in place of \FIRST appears the value selected by the user. How can I do that, when I define \FIRST macro in the .cls file?

2

1 Answer 1

4

You could define your commands like given below:

\newcommand{\FIRST}[1]{\gdef\@FIRST{#1}}
\newcommand{\SECOND}[1]{\gdef\@SECOND{#1}}
\newcommand{\THIRD}[1]{\gdef\@THIRD{#1}}
\let\@FIRST\@empty
\let\@SECOND\@empty
\let\@THIRD\@empty

Then later inside \maketitle you could replace \FIRST, \SECOND and \THIRD to \@FIRST, \@SECOND and \@THIRD respectively.

Now user can give:

\FIRST{one}
\SECOND{two}
\THIRD{three}

Hope this helps.

1
  • This is exactly what I was looking for! Thanks a lot!
    – Ziva
    Jun 23, 2016 at 11:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .