1

I am trying to create a custom title page in an scrbook class of document. The code is as follows:

\documentclass[openany]{scrbook}
\title{Sample LaTeX Book With Custome Title Page}
\author{Eva}
\date{\today}
\usepackage{blindtext}

\begin{document}

\begin{titlepage}
    \begin{tabular}{|l|c|l|}
        \hline
        Name & : & \textbf{\author} \\
        \hline
        Submission Date & : & \textbf{\date} \\
        \hline
    \end{tabular}
\end{titlepage}

\blinddocument \end{document}

The problem is that the third column, where my name, and the date should appear, remains blank. I tried to keep @author instead of \author in the third column. But when I did it, the third column had the word "author" instead of taking my name. What am I missing in this?

Eva
  • 127
  • \author and \date are commands with arguments to set the author and date not to print it. You could use the internal macros \@author and \@date (→ https://tex.stackexchange.com/questions/8351/what-do-makeatletter-and-makeatother-do ), that store the author and date, set by \author and \date. However, why not just typing the author and date directly at the tabular? – cabohah May 09 '23 at 09:22
  • @cabohah I tried to use the macros @author and @date in the table. But that shows the words "author" and "date" respectively in those place, instead of showing my name or submission date. That's why I am getting confused. – Eva May 09 '23 at 09:30
  • Have you read the page, I've linked in my comment? – cabohah May 09 '23 at 09:33

1 Answers1

0

You could use the internal storage macros, used by \author{…} and \date{…} (and also by \maketitle). Because they have internal names using @, you either have to use \makeatletter and \makeatother or \csname …\endcsname:

\documentclass[openany]{scrbook}
\title{Sample LaTeX Book With Custome Title Page}
\author{Eva}
\date{\today}
\usepackage{blindtext}

\begin{document}

\begin{titlepage}
    \begin{tabular}{|l|c|l|}
        \hline
        Name & : & \textbf{\csname @author\endcsname} \\
        \hline
        Submission Date & : & \textbf{\csname @date\endcsname} \\
        \hline
    \end{tabular}
\end{titlepage}

\blinddocument \end{document}

But I do not see any sense to not make it simple (and avoid internal macros):

\documentclass[openany]{scrbook}
\usepackage{blindtext}

\begin{document}

\begin{titlepage}
    \begin{tabular}{|l|c|l|}
        \hline
        Name & : & \textbf{Eva} \\
        \hline
        Submission Date & : & \textbf{\today} \\
        \hline
    \end{tabular}
\end{titlepage}

\blinddocument \end{document}

Both examples result in:

ugly result

which is IMHO very ugly, so that I would rather use something like:

\documentclass[openany]{scrbook}
\usepackage{blindtext}
\usepackage{array}
\begin{document}

\begin{titlepage} \fbox{\begin{tabular}{l<{:}l} Name & \textbf{Eva} \ Submission Date & \textbf{\today} \ \end{tabular}} \end{titlepage} \blinddocument \end{document}

better

or even without the \fbox.

cabohah
  • 11,455
  • Thanks a lot for the perfect answer. Yes, it could be made simpler, if I were working only for me. The issue is that I am creating this format for my other colleagues too, who would use it eventually. – Eva May 09 '23 at 09:33
  • @Eva the colleagues should be able to also replace a placeholder like AUTHOR or DATE, if you make a template. If you instead make a package, you could redefine \maketitle (or use a titlepage defined using package uni-titlepage). In this case, using internal macros wouldn't be a problem. However always note: Distributing a template or a package should also include providing support for it. Responsibility is always a factor. Often I see student templates with very ugly and fragile code that do more harm than benefit. – cabohah May 09 '23 at 09:36
  • I agree with you. The intention is to make a package ultimately. I am myself relatively a newcomer in LaTeX from closed source software like Microsoft Word. So, it is taking some time for me to understand all this. But I will surely look at the resources you have referred to. – Eva May 09 '23 at 09:42