## 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.
Stefan Kottwitz
Posts: 8527
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

### Generic title page needs optimization

Using a macro I saw posted by Yiannis Lazarides:

\RequirePackage[l2tabu,orthodox]{nag}\documentclass[12pt,oneside]{article}\usepackage[letterpaper,margin=1in]{geometry}\usepackage[T1]{fontenc}\usepackage{graphicx}\usepackage{float}\usepackage{color} \makeatletter\def\spreadeven#1{%\@tfor\next:=#1\do{%  \next\hfill }%} \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*{2pt}		\color{red}\rule{4.5in}{0.4pt}\color{black}\\[\baselineskip]		\makebox[4.5in]{\Huge\textsc{\spreadeven{Book\ titl}e}}\\[1\baselineskip]		{\large Subtitle}\\[0.2\baselineskip]		\rule{4.5in}{0.4pt}\vspace*{-\baselineskip}\vspace{3.2pt}		\rule{4.5in}{1.6pt}		\vfill 		Author		\vfill		\includegraphics[width=4.5in]{example-grid-100x100pt}		\vfill		version, town, year.	\end{center}\end{titlepage} \end{document}

Stefan

Cham
Posts: 813
Joined: Sat Apr 02, 2011 4:06 pm
Wow! It's *almost* working! The letters with French accents don't pass :
\makebox[4.5in]{\Huge\textsc{\spreadeven{La \ mécanique \ classique}}}\\[1\baselineskip]

Of course, I use this in the preamble :
\usepackage[T1]{fontenc}\usepackage[utf8]{inputenc}\usepackage[french]{babel}

Stefan Kottwitz
Posts: 8527
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:
It works when you protect non-standard characters: m{é}canique

Stefan

Cham
Posts: 813
Joined: Sat Apr 02, 2011 4:06 pm
Yep, it's working. Thanks for this nice find.

I suspect there should be a more natural way, using some kerning commands or some way to stretch or enlarge the font.

Stefan Kottwitz
Posts: 8527
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:
Sure, with the microtype package or the soul package. So changing kerning and letter spacing is possible. But that's more static once it's set. Here, the dynamic \hfill is inserted everywhere.

Stefan

Cham
Posts: 813
Joined: Sat Apr 02, 2011 4:06 pm
Interesting! I always load the microtype package (essential one!). What do you mean by "more static" ? Could it be made only for some text sentence without having an effect on the rest?

So how do you implement the kerning in the case above?

Stefan Kottwitz
Posts: 8527
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:
Yes, it can be applied to specific text. But I think you can specify a kerning value you want. But its not automatically filling a certain width, it's just another kerning value. Ok, maybe one can set a rubber length as kerning value. Anyway, take a look into the microtype manual regarding letter spacing or kerning settings. I don't have all manuals in my head.

Stefan

Cham
Posts: 813
Joined: Sat Apr 02, 2011 4:06 pm
Cool!

The command \textls[<amount>]{<text>} seems to be the option to use (see page 23 of the documentation) :

\textls*[50]{\Huge\textsc{Main title}}

However, it's not clear yet what the proper <amount> should be. I could do it by hand, but there may be an option to define the lenght in inches.

Cham
Posts: 813
Joined: Sat Apr 02, 2011 4:06 pm
Hmm, the kerned title feels a bit weird, not natural. I think I'll change the strategy : get the total lenght of the title, then make the rules and picture of the same size. I'm not sure how to do this yet.

EDIT : Found it !
\newlength{\largeur}	\settowidth{\largeur}{\Huge\textsc{Book title}}

Works great !

Here's the final result. The code has been cleaned, it's simple and easy to understand! (the beautifull picture is clicable, and brings Picasso's Wikipedia page!)
title.jpg (42.43 KiB) Viewed 60 times
Last edited by Cham on Sun Dec 03, 2017 9:24 pm, edited 1 time in total.

Johannes_B
Site Moderator
Posts: 3584
Joined: Thu Nov 01, 2012 4:08 pm
What if the width extend the given size of the rule? For example, look at the title The influence of pidgeon dust on statues made of bronze in a vacuum on a sunny day?

How do you deal with that?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.