## 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

This code is already much better. But I still don't understand a few parts :
\RequirePackage[l2tabu,orthodox]{nag}\documentclass[12pt,letterpaper,twoside]{article}\usepackage[letterpaper,margin=1in]{geometry}\usepackage[T1]{fontenc}\usepackage{graphicx} \begin{document} % CODE (2) :\begin{titlepage}	\centering 	\vfill 	Course number 	\vfill 	\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} 	\includegraphics[width=4.5in]{example-grid-100x100pt} 	\vfill 	version, town, year.\end{titlepage} \end{document}

How to make the Author in the middle, without the \vspace{0.5in} command ? \vfill doesn't seem to help there and I don't understand what's going on in this part.

Also, I don't understand the title part. Why the extra { } around the Book title and around the Subtitle ? I suspect this part could be much simpler.

Stefan Kottwitz
Posts: 8596
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:
Braces do grouping and are limiting the effect of local commands (scoping). So, {\large Subtitle} means that after the group with braces has ended, \large is not affecting the following text. {...}acts like an environment, limiting the effect of commands, such as centering and font size or color or shape commands.

Stefan

Stefan Kottwitz
Posts: 8596
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:
Cham wrote:How to make the Author in the middle, without the \vspace{0.5in} command ?

It's just a single title page. It's ok to manually tweak here and there for that single case.

LaTeX' centering commands and such staff is usually working on base lines. Even if you would get the base line perfectly centered, the text is nor centered since it has some height. One could put it into a box and center that one.. but I would just quickly insert vertical space here to adjust.

Stefan

Cham
Posts: 826
Joined: Sat Apr 02, 2011 4:06 pm
Stefan, how would you do the part inside the rules? I still don't understand the vertical spacing commands there (there's even a negative -\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]

The space between the thick and thin lines should be an exact fixed constant. The title and subtitle should be equilibrated inside the rules. This code was an old "hack" done a long time ago, and I probably got some parts from elsewhere without a clear understanding of what was going on (my use of the picture and center environments talks by themselves! )

Stefan Kottwitz
Posts: 8596
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:
Cham wrote:I still don't understand the vertical spacing commands there (there's even a negative -\baselineskip)

When one adds vertical space, the current line ends, since it has to go downwards now. But ending a line means there's a new line with the distance \baselineskip. So, to have a distance of 2pt between the first line and the second, you remove that line skip space, that's why it's negative, then you add 2pt as desired space. I would do it similar or make a macro for it, when it's about several rules.

Stefan

Cham
Posts: 826
Joined: Sat Apr 02, 2011 4:06 pm
Then why not simply use something like \vspace{2pt} between each rule ? Would it give a fixed constant space between the thick and thin rules ?

Stefan Kottwitz
Posts: 8596
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:
There is a line break between the two rules! LaTeX is line based in normal text mode. So you would have the line break space and 2pt.

Stefan

Cham
Posts: 826
Joined: Sat Apr 02, 2011 4:06 pm
Hmm, you're right. I tend to think in a "graphical mode" (with absolute measures), instead of a text mode.

But I still dont understand that part. I feel there should be a simpler way in doing this.

Also, the author's name not vertically centered annoys me and using \vspace{} by hand is clumsy..

EDIT : Okay, I fixed the author's name by simmply adding \vspace{6pt} below it, which is about half the name's height.

Now, how to make the Main title as long as the rules themselves (i.e 4.5 inches) ?
Last edited by Cham on Sun Dec 03, 2017 6:20 pm, edited 1 time in total.

Stefan Kottwitz
Posts: 8596
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:
It wasn't centered, you just added space (2 line skips) after the rule before the author.

Centering looks this way:

\rule{4.5in}{1.6pt}\vfill Author\vfill\includegraphics[width=4.5in]{example-grid-100x100pt}

or inserting equal space before and after.

Sure, there are more logical ways in graphic mode, but in text mode we have to link about text lines. Even \rule is a luxury in text mode.

Stefan

Cham
Posts: 826
Joined: Sat Apr 02, 2011 4:06 pm
Sorry for the cross-posting. I used
\rule{4.5in}{1.6pt} \vfill {\large Author} \vspace{6pt} \vfill \includegraphics[width=4.5in]{...

and then the output appears to be right. The name is now well centered.

But is it possible to make the main title as long as the rules themselves, i.e 4.5 inches in lenght? In other words: can we stretch a line of text so its lenght have an exact value? There's surely a way in doing this in LaTeX.

EDIT : Damn typos and auto-correctors in the browser!