LaTeX forum ⇒ GeneralGeneric title page needs optimization Topic is solved

LaTeX specific issues not fitting into one of the other forums of this category.
User avatar
Stefan Kottwitz
Site Admin
Posts: 8527
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Generic title page needs optimization

Postby Stefan Kottwitz » Sun Dec 03, 2017 6:46 pm

Using a macro I saw posted by Yiannis Lazarides:

  1. \RequirePackage[l2tabu,orthodox]{nag}
  2. \documentclass[12pt,oneside]{article}
  3. \usepackage[letterpaper,margin=1in]{geometry}
  4. \usepackage[T1]{fontenc}
  5. \usepackage{graphicx}
  6. \usepackage{float}
  7. \usepackage{color}
  8.  
  9. \makeatletter
  10. \def\spreadeven#1{%
  11. \@tfor\next:=#1\do{%
  12. \next\hfill
  13. }%
  14. }
  15.  
  16. \begin{document}
  17.  
  18. % CODE (2) :
  19. \begin{titlepage}
  20. \hfill {}\par
  21. \vspace{0.25in}
  22.  
  23. \begin{center}
  24. {Course number}\par
  25. \vspace{0.5in}
  26. \vspace*{\baselineskip}
  27. \rule{4.5in}{1.6pt}\vspace*{2pt}
  28. \color{red}\rule{4.5in}{0.4pt}\color{black}\\[\baselineskip]
  29. \makebox[4.5in]{\Huge\textsc{\spreadeven{Book\ titl}e}}\\[1\baselineskip]
  30. {\large Subtitle}\\[0.2\baselineskip]
  31. \rule{4.5in}{0.4pt}\vspace*{-\baselineskip}\vspace{3.2pt}
  32. \rule{4.5in}{1.6pt}
  33. \vfill
  34. Author
  35. \vfill
  36. \includegraphics[width=4.5in]{example-grid-100x100pt}
  37. \vfill
  38. version, town, year.
  39. \end{center}
  40. \end{titlepage}
  41.  
  42. \end{document}


Stefan
Site admin

User avatar
Cham
Posts: 813
Joined: Sat Apr 02, 2011 4:06 pm

Postby Cham » Sun Dec 03, 2017 6:57 pm

Wow! It's *almost* working! The letters with French accents don't pass :
  1. \makebox[4.5in]{\Huge\textsc{\spreadeven{La \ mécanique \ classique}}}\\[1\baselineskip]


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

User avatar
Stefan Kottwitz
Site Admin
Posts: 8527
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Sun Dec 03, 2017 7:10 pm

It works when you protect non-standard characters: m{é}canique

Stefan
Site admin

User avatar
Cham
Posts: 813
Joined: Sat Apr 02, 2011 4:06 pm

Postby Cham » Sun Dec 03, 2017 7:19 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.

User avatar
Stefan Kottwitz
Site Admin
Posts: 8527
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Sun Dec 03, 2017 8:26 pm

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
Site admin

User avatar
Cham
Posts: 813
Joined: Sat Apr 02, 2011 4:06 pm

Postby Cham » Sun Dec 03, 2017 8:27 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?

User avatar
Stefan Kottwitz
Site Admin
Posts: 8527
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Sun Dec 03, 2017 8:33 pm

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
Site admin

User avatar
Cham
Posts: 813
Joined: Sat Apr 02, 2011 4:06 pm

Postby Cham » Sun Dec 03, 2017 8:53 pm

Cool! :mrgreen:

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

  1. \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.

User avatar
Cham
Posts: 813
Joined: Sat Apr 02, 2011 4:06 pm

Postby Cham » Sun Dec 03, 2017 9:07 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 ! 8-)
  1. \newlength{\largeur}
  2. \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
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.

User avatar
Johannes_B
Site Moderator
Posts: 3584
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sun Dec 03, 2017 9:22 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.


Return to “General”

Who is online

Users browsing this forum: No registered users and 5 guests