0

I have a quite long (in term of time) experience as a LaTeX user. Unfortunately I have never tried to customise it.

I now want to provide a custom class to member of a project in my department, mainly changing the title page and adding headers and footers.

EDIT: As I solved (thanks UlrikeFische) the error, I am now left with the actual issue. (If moderators think I should open a new questions, I will.)

I would also like to add multiple authors, so that the user simply calls \authors multiple times, and in the class I add them in a table (one for raw, together with email). I can also create a new command, like \authandemail{First Author}{first.author@mail.com}

I would also like to redefine the \title command to have an optional short title (like \title[short title]{Long title}. I then display the short title in the footer of the pages, and the main title in the title page

CURRENT STATUS OF TITLE PAGE:

\newcommand{\deliverabletitle}[2]{
    \def\@shortdeltitle{#1} 
    \def\@deltitle{#2}
}
\newcommand{\deliverableversion}[1]{
    \def\@deliverableversion{#1} 
}


\renewcommand*{\maketitle}{%
\begin{titlepage}
    %This to align on the left the text and on the right the image
\noindent
\parbox[t]{4cm}{\textbf{Title header}}%
\hfill
\raisebox{\dimexpr-\height+\baselineskip}{\includegraphics[width=2.5cm]{logo}}
\vfill
\centering
{\huge\bfseries\ifdefined\@deltitle
        \@deltitle
        \else
        \fi\unskip\strut\par}
\vfill

\begin{tabular}[b]{|p{.25\textwidth}|p{.6\textwidth}|}
    \hline
    \multicolumn{2}{|l|}{University} \\
    \multicolumn{2}{|l|}{Department} \\
    \hline
    Authors & \begin{minipage}{.6\textwidth}
                \vspace{0.15cm}
                {\@author \par}
                \vspace{0.15cm}
              \end{minipage} \\
    \hline
    Purpose & Deliverable \\
    \hline
    Revision & \@deliverableversion \\
    \hline
    Document Availability & \colorbox{red!50}{Confidential} \\
    \hline
    Date & \@date\\
    \hline
\end{tabular}

\end{titlepage}
}

SOLVED ERROR:

Unfortunately when I try to redefine the \maketitle command I get an Undefined control sequence on the \end{document} in the main section.

This is my tentative \maketitle command (inspired by https://en.wikibooks.org/wiki/LaTeX/Title_Creation)

\renewcommand*{\maketitle}{%
\begin{titlepage}
{\raggedleft%
    \includegraphics[width=4cm]{logo}\par
}\vspace{1cm}
\centering
{\huge\bfseries\@title\unskip\strut\par}
\vfill

\begin{tabular}[b]{|p{.3\textwidth}|p{.3\textwidth}|}
    \hline
    \multicolumn{2}{|l|}{Institution} \\
    \multicolumn{2}{|l|}{My Dept} \\
    \hline
    Authors &   \\
    \hline
    Purpose & Deliverable \\
    \hline
    Revision & $1.0$ \\
    \hline
    Document Availability & \colorbox{red!50}{Confidential} \\
    \hline
    Date & \@date\\
    \hline
\end{tabular}

\end{titlepage}
}

The main document is

\documentclass[]{myclass}


\title{My project title}
\author{First Author}

\begin{document}
\maketitle
test
\end{document}

and I get the error on the closing \end{document}.

  • You should take a look at the documentation of the titling package. – Bernard Aug 25 '17 at 9:06
  • 1
    Show the complete log-file. – Ulrike Fischer Aug 25 '17 at 11:24
  • @UlrikeFischer Thanks!! There was a typo before the redefinition of the \maketitle command. The GUI was suppressing most of the log, while on the terminal I immediately saw the error. As the title is quite generic, I edit the question with the "real" question, i.e. multiple author and redefinition of the title command – Francesco Aug 25 '17 at 11:39
  • Out of interest: was the wikibook page helpful? – Johannes_B Aug 25 '17 at 13:08
  • 1
    If you want, you can answer your own question. It gives you a few more internet points. – Johannes_B Aug 28 '17 at 21:09
1

After a big help from Johannes_B, I managed to solve my original problem.

Here is the final maketitle command

\newcommand{\deliverabletitle}[2]{
    \def\@shortdeltitle{#1} 
    \def\@deltitle{#2}
}
\newcommand{\deliverableversion}[1]{
    \def\@deliverableversion{#1} 
}


\renewcommand*{\maketitle}{%
\begin{titlepage}
    %This to align on the left the text and on the right the image
\noindent
\parbox[t]{4cm}{\textbf{Title header}}%
\hfill
\raisebox{\dimexpr-\height+\baselineskip}{\includegraphics[width=2.5cm]{logo}}
\vfill
\centering
{\huge\bfseries\ifdefined\@deltitle
        \@deltitle
        \else
        \fi\unskip\strut\par}
\vfill

\begin{tabular}[b]{|p{.25\textwidth}|p{.6\textwidth}|}
    \hline
    \multicolumn{2}{|l|}{University} \\
    \multicolumn{2}{|l|}{Department} \\
    \hline
    Authors & \begin{minipage}{.6\textwidth}
                \vspace{0.15cm}
                {\@author \par}
                \vspace{0.15cm}
              \end{minipage} \\
    \hline
    Purpose & Deliverable \\
    \hline
    Revision & \@deliverableversion \\
    \hline
    Document Availability & \colorbox{red!50}{Confidential} \\
    \hline
    Date & \@date\\
    \hline
\end{tabular}

\end{titlepage}
}

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.