1

I have made my own package which loads some packages and setup a custom title page using the following

% Title and author
\makeatletter
\def\@maketitle{%
  \newpage
  %\vspace{-\topskip}      % remove the initial space

  \vskip 6em
   \begin{flushleft}Incomplete draft. Please do not cite or quote without premission \end{flushleft}
  \vskip 6em
  {}
  \begingroup    % instead of \begin{center}
  \begin{flushleft}
  \let \footnote \thanks
  \hrule height \z@        % to avoid the insertion of lineskip glue
    {\LARGE \protect\textbf{\@title} \par}%
    \vskip 2.5em
    {\large
      \lineskip .5em

        \@author
        \par}%
    \vskip 1.5em
    {\small
      \@date}
  \end{flushleft}
  \par\endgroup            % instead of \end{center}
  \vskip 6em             % <--- modify this to adjust the separation
}
\makeatother

I would like to be able to make the note about "incomplete draft" appear only if I load the package with the option "drafting". I tried using

  \DeclareOption{drafting}{
  \vskip 6em
   \begin{flushleft}Incomplete draft. Please do not cite or quote without premission \end{flushleft}
  \vskip 6em
  }
  \DeclareOption*{\PackageWarning{faden}{Unknown ‘\CurrentOption’}}
  \ProcessOptions\relax

But this does not work

I put a MWE below

\documentclass{article}
\usepackage[utf8]{inputenc}


\usepackage[top=2.5cm, bottom=2.5cm, left=3.5cm, right=3.5cm]{geometry} %Margins

% Title and author
\makeatletter
\def\@maketitle{%
  \newpage
  %\vspace{-\topskip}      % remove the initial space
  \vskip 6em
   \begin{flushleft}Incomplete draft. Please do not cite or quote without premission \end{flushleft}
  \vskip 6em
  {}
  \begingroup    % instead of \begin{center}
  \begin{flushleft}
  \let \footnote \thanks
  \hrule height \z@        % to avoid the insertion of lineskip glue
    {\LARGE \protect\textbf{\@title} \par}%
    \vskip 2.5em
    {\large
      \lineskip .5em

        \@author
        \par}%
    \vskip 1.5em
    {\small
      \@date}
  \end{flushleft}
  \par\endgroup            % instead of \end{center}
  \vskip 6em             % <--- modify this to adjust the separation
}
\makeatother

% Author and title
\title{Test}
\author{Namesen}
\date{\today} % no date

\begin{document}
\maketitle
\section{Title}
\label{sec:title}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

\end{document}
1

Here's a rather basic way:

\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesClass{myclass}[2015/03/16 v0.0001 For example]

% Condition
\newif\if@drafting
\def\maybedraft{%
  \if@drafting
   \begin{flushleft}
     Incomplete draft. Do not read; do not believe.
   \end{flushleft}
   \else
   Full draft. Enjoy!
   \fi}

\DeclareOption{drafting}{\@draftingtrue}

\ProcessOptions\relax
\LoadClass[]{article}[1994/06/01]


% Title and author
\def\@maketitle{%
  \newpage
  %\vspace{-\topskip}      % remove the initial space

  \vskip 6em

  \noindent
  \maybedraft

  \vskip 6em

  \begingroup    % instead of \begin{center}
  \begin{flushleft}
  \let \footnote \thanks
  \hrule height \z@        % to avoid the insertion of lineskip glue
    {\LARGE \protect\textbf{\@title} \par}%
    \vskip 2.5em
    {\large
      \lineskip .5em

        \@author
        \par}%
    \vskip 1.5em
    {\small
      \@date}
  \end{flushleft}
  \par\endgroup            % instead of \end{center}
  \vskip 6em             % <--- modify this to adjust the separation
}

And the .tex file:

\documentclass[drafting]{myclass}
%\documentclass[]{myclass}
\usepackage[T1]{fontenc}

\title{Test}
\author{Namesen}
\date{\today}

\begin{document}

\maketitle
\section{Title}
\label{sec:title}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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