As in this question on stackoverflow, I want to replicate the so-called 'big text' formatting:
Functioning:
- You give as input:
- the line (column) width for each line,
- and the content of each line.
- The font size is dynamically adapted for each line so that they all have the same width.
(Note that, in previous example, each line is only one word long. However, I would like to be able to have longer lines (in terms of words number) as in this example.)
Question: how to achieve this formatting with LaTeX?
Partial/not satisfactory solutions (so far):
- Of course, justified text is not satisfactory, since it adapt the line length by modulating the character and/or interword spacing... and not the font size.
- Fit text into given box by adjusting the fontsize develops a solution, but is rather a "maximum" constraint (it won't makes the text bigger to fill all the space).
Edit:
What makes this formatting visually strong is that the very first/last pixel of each line are aligned (or in other words: there is no kerning nor protrusion)*. In suggested answers however, their is a protrusion that is especially noticeable at the beginning of the last two lines.
So, is it be possible to 'pixel-align' the beginning and the end of each line? (if yes, how?!)
*to be honest, I observed that there is a small protrusion in the given example. But it is less noticeable than in suggested answer, and I'd like to be able to have no protrusion at all.
LaTeX3
-syntax. However, it needs to be compiled withXeLaTeX
. Thus, I suggest you to also have a look to the also satisfactory solution written by Runar Trollet that is a bit easier to implement (imho) and requiresLaTeX
only.