# Fix overfull line by local settings of microtype expansion

The second line of the paragraphs has an overulll (6pt). I can't change the text and the hyphenation of the first two line (pri-vate and al-ready) would not help.

I try to change the microtype settings (I use the default ones) for this paragraph:

\SetExpansion
[ context = sloppy,
stretch = 30,
shrink = 60,
step
= 5 ]
{ encoding = {OT1,T1,TS1} }
{ }

{\microtypecontext{expansion=sloppy}%
You are horrified at our intending to do away with private
property.  But in your existing society, private property is
already done away with for nine-tenths of the population; its
existence for the few is solely due to its non-existence in the
hands of those nine-tenths.  You reproach us, therefore, with
intending to do away with a form of property, the necessary
condition for whose existence is the non-existence of any
property for the immense majority of society.
}


But I got the error (lualatex 0.80 and microtype v2.5a):

! Package microtype Error: microtype isn't set up for expansion contexts.
(microtype)                Ignoring context' key on input line 701.


I don't understand what is going on. Someone can explain me the way to change the microtype parameters locally.

Any other advice on how to fix this overfull lines is wellcome.

• Load microtype with the copyfonts option or move the \SetExpansion block to the preamble. – Henri Menke Nov 30 '15 at 9:02
• Moving \SetExpansion to the preamble works fine. I didn't understand the copyfonts option. Unfortunately, this is not helping to fix the Overfull box. Please make the comment an answer. – TeXtnik Dec 1 '15 at 8:55

You have to either move the \SetExpansion block to the preamble or load the microtype package with the copyfonts option. The documentation says

copyfonts will copy all fonts before setting them up. This allows protrusion and expansion with different parameters. This options is also undocumented in the hope that we can always find out automatically whether it’s required.

That is to say, moving the \SetExpansion block to the preamble is the better practice, as it allows microtype to detect whether copying the fonts is necessary.

\documentclass{article}
\usepackage{microtype}
\SetExpansion
[ context = sloppy,
stretch = 30,
shrink = 60,
step = 5 ]
{ encoding = {OT1,T1,TS1} }
{ }
\newcommand\text{You are horrified at our intending to do away with
private property.  But in your existing society, private property is
already done away with for nine-tenths of the population; its
existence for the few is solely due to its non-existence in the hands
of those nine-tenths.  You reproach us, therefore, with intending to
do away with a form of property, the necessary condition for whose
existence is the non-existence of any property for the immense
majority of society.}
\begin{document}
\text

{\microtypecontext{expansion=sloppy}\text}
\end{document}
`