9

I have some text that nearly fits the given line width. I can see that a minimal adjustment of font size or kerning would make the text fit, but how do I tell LaTeX to squeeze the text? Yes, this would be bad typography for an average paragraph, but in my case it is a custom In a custom quotation environment, that has a smaller font size anyway, so it won't look ugly.

lockstep
  • 250,273
Jakob
  • 1,234

3 Answers3

10

If you compile your document with pdfLaTeX, use the microtype package and its font expansion feature. Microtype will try to horizontally stretch your font (by default from -2% to +2%), and this will affect line breaks (and in your case, possibly make the text fit).

lockstep
  • 250,273
  • 6
    Exactly. But in your case do it locally by defining a context by including something like \SetExpansion[context = sloppy,shrink = 60,...]{encoding = {OT1,T1,TS1} }{} in your preamble. Then you can write something like {\microtypecontext{expansion=sloppy}This line is a smidgen too long...} to kick in the local 'sloppy' context adjustment on just the enclosed text. – Geoffrey Jones Sep 24 '10 at 12:08
  • 1
    Thanks! The \SetExpansion and \microtypecontext solution did not work form me (I got "pdfTeX error (font expansion): using fonts with different limit of expansion in one paragraph is not allowed."), but \SetTracking solved the issue. I'll play around with more microtype options if needed. – Jakob Sep 24 '10 at 12:48
2

One simple thing that one could try is to increase the stretchability of the space between words, i.e.:

\setbox0\hbox{i} \spaceskip=\wd0 plus .15em minus .15em

And to keep it inside scope.

lockstep
  • 250,273
morbusg
  • 25,490
  • 4
  • 81
  • 162
2

Just put the last few words inside an \mbox{...} to discourage breaking the line.

doncherry
  • 54,637