Re: Defining a new coverpage for article



cristiano.paris@xxxxxxxxx wrote:
All I get is a poor "! Undefined control sequence." error from LaTeX.

That's right. Where is \foo and \bar defined? (with either \newcommand{\foo}{...} or \def\foo{...})


The only definition I see in your code snippet is inside \coverpage, which means that \foo and \bar will be defined only after the first call of \coverpage. But even so, this leads to the problem I'll explain below.

(By the way, it's \newcommand{\commandname}{...}, not \newcommand\commandname{...}.)

I've tried to move the \let statements out of the
"\newcommnad\coverpage" scope but then the error becomes:

! LaTeX Error: Missing \begin{document}.

Right. You say \global\let\foo\relax, which means "let \foo be globally a synonym for \relax". And \relax basically means "nothing". So, when you say


  \foo{this is foo}

it means (since \foo=\empty)

  {this is foo}

which is purely a normal text. Since it occurs before \begin{document}, it's illegal.

Can any of you guys provide a minimal example of a simple document
class implementing such a feature?

In myarticle.cls:

\newcommand{\foo}[1]{\def\@foo{#1}}
\newcommand{\bar}[1]{\def\@bar{#1}}

\newcommand{\coverpage}{%
  \@foo\\
  \@bar
}

This way, your example.tex works as expected (if I correctly understood your problem).

--
Regards,
Vilar Camara Neto
.



Relevant Pages

  • Re: Upgrade to FP 2003? Any advantage?
    ... it's got a vastly better "code view" and a great "code snippet" ... feature and it's got a very interesting (though I haven't gotten too deep ... Is it worth the cost to upgrade from FP 2002/XP to FP2003? ...
    (microsoft.public.frontpage.addins)
  • Re: Creating a MailStream : StreamReader
    ... See the Save code snippet that works great: ... MailWriter is not documented with MSDN either, ... I'm glad you know how to use Reflector, ... feature does not work because I have incorrectly coded the Save routine. ...
    (microsoft.public.dotnet.languages.csharp)