1

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}.

Francesco
  • 131
  • You should take a look at the documentation of the titling package. – Bernard Aug 25 '17 at 09: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
  • @Johannes_B the Latex wikibook page is my first source of information for most of the topics and it has been always been very helpful. Regarding these kind of advanced topics, it still has some limited information (better than nothing. I then looked for the specific topics on google) – Francesco Aug 25 '17 at 15:56
  • Be warned, only parts of the wikibook are up to date with trustful information. There aren't enough people to bring everything up to standards. The part on titlepages is ok, i think. (disclaimerL i am updating that part.) – Johannes_B Aug 25 '17 at 16:15
  • How should authors be displayed? I don't get it. For standard document classes, you can do \author{Walter Wombat \\ Mail \and Carl Capybara\\ Mail} – Johannes_B Aug 27 '17 at 06:51
  • @Johannes_B I am adding authors in a table. Each row should contain an author and his email, i.e. "First Author, first.author@mail.com", etc (one in each line) – Francesco Aug 28 '17 at 07:35
  • @Johannes_B standard \and works! I had to do a modifications to the template: redefine the \and command \renewcommand\and{\\}. I will update my question with the current status. I am missing only a couple of minor details and my class is ready! – Francesco Aug 28 '17 at 16:06
  • I saw your comment earlier, but by the time i had time to look closer at it, i had forgotten about it. Your redefinition should do what you want perfectly fine. – Johannes_B Aug 28 '17 at 16:42
  • Don't mind that the question is about a completely different topic, have a look at the answer. For example Problem with \thesistitle in Masters/Doctoral Thesis template. You don't need/want the line with tttitle, but the other stuff is what you also want to do. – Johannes_B Aug 28 '17 at 16:45
  • @Johannes_B ok, I get inspiration from that answer and I added the command. I fully answered my question. If you create an answer with the comments of the \author part and command part I can accept it. Anyway I edited my question with my "current" solution – Francesco Aug 28 '17 at 20:17
  • 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 Answers1

2

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}
}
Francesco
  • 131