TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 10 down vote accepted

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).

share|improve this answer
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
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

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.

share|improve this answer

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

share|improve this answer
Welcome to TeX.sx! A tip: You can use backticks ` to mark your inline code as I did in my edit. – doncherry Aug 23 '12 at 16:34
While this will work, it will still be (possibly very visible) longer than the other lines and cause an overfull hbox warning. – Tom Bombadil Aug 23 '12 at 20:13
\mbox{} is used to mark a word not to be hyphenated. \sloppy could perhaps help here, better is to use package microtype. – Kurt Sep 13 '12 at 22:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.