LaTeX forum ⇒ General ⇒ Generic title page needs optimization Topic is solved

LaTeX specific issues not fitting into one of the other forums of this category.
Cham
Posts: 826
Joined: Sat Apr 02, 2011 4:06 pm

Generic title page needs optimization

I have a working generic title page that I want to add to some template documents (book, report, scrbook, scrreprt). As a simple example, take this small code :
\RequirePackage[l2tabu,orthodox]{nag}\documentclass[11pt,letterpaper,twoside]{book}\usepackage[T1]{fontenc}\usepackage{lmodern}\usepackage{microtype}\usepackage[total={6.25in,10in},left=1.25in,top=0.5in,includehead,includefoot]{geometry} \begin{document} % CODE (1) :\title{Title}\author{Isaac Newton}\date{}\maketitle% END OF CODE (1) \tableofcontents \chapter{Chapter title} Text \end{document}

Now, here's the title page :
\RequirePackage[l2tabu,orthodox]{nag}\documentclass[12pt,oneside]{article}\usepackage[letterpaper,margin=1in]{geometry}\usepackage[T1]{fontenc}\usepackage{graphicx}\usepackage{float} \begin{document} % CODE (2) :\begin{titlepage}	\hfill {}\par	\vspace{0.25in} 	\begin{center}		{Course number}\par		\vspace{0.5in}		\vspace*{\baselineskip}		\rule{4.5in}{1.6pt}\vspace*{-\baselineskip}\vspace*{2pt}		\rule{4.5in}{0.4pt}\\[\baselineskip]		{\Huge\textsc{Book title}}\\[1\baselineskip]		{\large Subtitle}\\[0.2\baselineskip]		\rule{4.5in}{0.4pt}\vspace*{-\baselineskip}\vspace{3.2pt}		\rule{4.5in}{1.6pt}\\[2\baselineskip]		Author		\vspace{0.5in}		\begin{figure}[H]			\centering			\includegraphics[width=4.5in]{example-grid-100x100pt}		\end{figure}		\vfill		version, town, year.	\end{center}\end{titlepage} \end{document}

Preview :
page.jpg (24.65 KiB) Viewed 170 times

I believe that the title code (2) given above could be simplified and optimized in some way. The vertical spacings could also be adjusted for a better looking output.

What would be the best way in replacing the code (1) in the first code by a better version of the code (2) ?

Johannes_B
Site Moderator
Posts: 3598
Joined: Thu Nov 01, 2012 4:08 pm
Never ever use a figure environment on a title page.
Get rid of all those weird spaces.
Start from scratch.
Have a look at https://en.wikibooks.org/wiki/LaTeX/Title_Creation ( and the links at the bottom) as well as http://tex.stackexchange.com/questions/ ... 280#210280
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Cham
Posts: 826
Joined: Sat Apr 02, 2011 4:06 pm
Johannes, I don't agree. What do you mean about weird spaces? It's a good looking title page. The code may not be great, but the output is nice.

What would be your suggestion anyway ? You're not helping much.

Johannes_B
Site Moderator
Posts: 3598
Joined: Thu Nov 01, 2012 4:08 pm
\vspace{0.5in}\vspace*{\baselineskip}

This is weird spacing for me.

Apart from that, the page is fine and i don't know what you want to optimize.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Cham
Posts: 826
Joined: Sat Apr 02, 2011 4:06 pm
Ah, yes here I agree! That vertical space is badly defined!

But you say that the rest is okay? What about the picture environment? You said that we shouldn't use that in a title page. How to show the picture without the picture environment?

And how to properly introduce the vertical spacings so the text (for example "Author") is centered between the "title box" and the picture below it?

The "Course number" should also be centered between the top (paper border) and the "title box".

The "title box" (with its horizontal frame) should be centered at about 2/3 (or 3/4 ?) of the bottom (paper edge), or maybe the golden ratio.

The picture should have the same size (horizontally) as the "title box".

Johannes_B
Site Moderator
Posts: 3598
Joined: Thu Nov 01, 2012 4:08 pm
Just leave out the figure environment. You do not need it to include a graphic.

Have you looked at TikZ? It allows you absolute positioning on the page. It can also draw the lines for you.

I think this is what you are looking for.

Unfortunately, i am not a TikZ person.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Cham
Posts: 826
Joined: Sat Apr 02, 2011 4:06 pm
Ahaa! Now I understand about the picture environment. Right, we don't need it. Code now already simpler.

I don't like Tikz. I already used it before for a few things, but I prefer to leave it out of my projects.

I need to fix the various vertical spacements. Any suggestions?

EDIT : The \begin{center} \end{center} appears to be useless too. Just using a \centering seems to be enough!

Stefan Kottwitz
Posts: 8596
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:
Yes, \centering is enough. The setting is valid until the current environment (titlepage here) ends.

\begin{center} ... \end{center} is for standalone centered text, displayed with additional space before and after.

Stefan

Johannes_B
Site Moderator
Posts: 3598
Joined: Thu Nov 01, 2012 4:08 pm
No, not really a suggestion from my side.
It sounds lie you want self adjusting code, the spacing will be different for each different titlepage.

I suggest to space stuff by hand by looking at the output.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Stefan Kottwitz
Posts: 8596
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:
Cham wrote:I need to fix the various vertical spacements.

Centering is usually done by inserting elastic space, such as \vfill. Several \vfill take the same space each, so it's used for centering (above and below) and for equal distances.

Stefan