Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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{john.doe@email.com} 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.

share|improve this question
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 '13 at 12:53
    
You need to do \def\email#1{\def\@email{#1}}. {\tt#1} simply typesets the argument. –  Qrrbrbirlbel Sep 5 '13 at 12:54
    
@JosephWright exactly I want to define it and use it. –  tdi Sep 5 '13 at 12:58

1 Answer 1

up vote 5 down vote accepted

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}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.