5

I am trying to customize an article class for my needs. I want to access \email{} in my class but without any success.

This is my \maketitlepage section in cls file,

\newcommand{\maketitlepage}{%
\begin{center}      
\includegraphics[scale=0.20]{dsg}~\\[0.5cm]
\textsc{\LARGE University name}\\[1.0cm]
 \textsc{\Large Institute of Something}\\[0.5cm]
 \HRule \\[0.4cm]    
  {\huge \bfseries\@title \\[0.4cm]}

  \HRule \\[1.5cm]    
  \large          
  \@author\@email                                                                                            
   \vfill
  {\large \@date}     
 \end{center}          
 \end{titlepage}%      
 }     

I also defined \email to be (took it from lncs.cls):

\def \email#1{{\tt#1}}

After using this in my article as \email{[email protected]} the email is shown on the top of the titlepage, instead of the place where it should land.

I am quite new to creating own classes.

3
  • 1
    The LaTeX kernel doesn't define \email, so there is no \@email 'out of the box'. Are you perhaps looking to define \@email (e.g. \newcommand{\email}[1]{\def\@email{#1}} then use it where it should be printed?
    – Joseph Wright
    Sep 5, 2013 at 12:53
  • You need to do \def\email#1{\def\@email{#1}}. {\tt#1} simply typesets the argument. Sep 5, 2013 at 12:54
  • @JosephWright exactly I want to define it and use it.
    – Darek
    Sep 5, 2013 at 12:58

1 Answer 1

6

The LaTeX kernel defines only \author, \title and \date for saving 'meta data', for example

\newcommand{\author}[1]{\def\@author{#1}}

which therefore stores the author list as \@author for later use. Thus you can set up \email in the same way

\newcommand{\email}[1]{\def\@email{#1}}

You can then use the e-mail address(es) using \@email. I would not just use \tt: quite apart from anything else, it is deprecated in favour of \texttt/\ttfamily. Probably you are best using the \url package, e.g.

\documentclass{article}
\makeatletter
\newcommand{\email}[1]{\def\@email{#1}}
\newcommand*{\printemail}{\expandafter\url\expandafter{\@email}}
\makeatother
\usepackage{url}

\email{demo@demo_domain.com}

\begin{document}

\printemail

\end{document}

You must log in to answer this question.

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