# An annoying overflow in mdframed environment with tufte-handout

I'd like to highlight a text block in a Tufte style document. I defined myblock environment based on mdframed package.

\documentclass{tufte-handout}

\definecolor{MyGray}{rgb}{0.95,0.95,0.98}

\usepackage{mdframed}
\newenvironment{myblock}%
{\begin{mdframed}[backgroundcolor=MyGray,
linecolor=MyGray,
innerleftmargin=1.5mm,
innerrightmargin=1mm]\begingroup}
{\endgroup\end{mdframed}}

\begin{document}
\begin{myblock}
Hello, world! This is just a random text to show an annoying superflous
overflow in \texttt{mdframed} environment.
\end{myblock}
\marginnote{Why an overflow?}
\end{document}


This simple MWE generates a PDF document with an overflow at myblock environment.

You can see the word 'superflous' juts out over the colored box. Why do I have an overflow like this? Is there any way to keep the myblock text inside of the desired color box?

Update: After reading a comment by Yiannis Lazarides, I removed innerrightmargin parameter to see that it's working for the first example above. But it still ends up with an overflow in the following example where I use fontspec package for Minion Pro font.

\documentclass{tufte-handout}

\usepackage{fontspec}
\defaultfontfeatures{Scale=MatchLowercase}
\setmainfont[Mapping=tex-text]{Minion Pro}

\definecolor{MyGray}{rgb}{0.95,0.95,0.98}

\usepackage{mdframed}
\newenvironment{myblock}%
{\begin{mdframed}[backgroundcolor=MyGray,
linecolor=MyGray,
innerleftmargin=1.5mm]\begingroup}
{\endgroup\end{mdframed}}

\begin{document}
\begin{myblock}
A vector $v$ is \emph{appropriately orthogonal} if the potential function is
still small enough to admit another orthogonal vector in the next round.
\end{myblock}
\marginnote{I'm afraid I still have an overflow after deleting
the \texttt{innerrightmargin} parameter.}
\end{document}


I use XeLaTeX in TeX Live 2014 on Mac OS X. (I'm sorry for any confusion but the first example was a minimal document which still generates an overflow even without fontspec package.)

• Remove or increase innerrightmargin=1mm by 0.5. This is a hyphenation issue. – Yiannis Lazarides Jan 20 '15 at 8:45

It seems that \sloppy is the only option. as explained in here.