[Tex/LaTex] framebox and margins

framedmargins

I have 2 minipages, the second of which is \frameboxed.

The \framebox command seems to push the minipage out into the right margin, as you can see.

Imgur

[This is not the same as a previous question: Right margin discrepancy between framed and fbox/minipage. Whilst it may have a related answer, it is not the same question. I am not interested in the \fbox command or the framed package.]

How do I prevent \framebox from transgressing the right margin in this way? It is playing havoc with my RTL documents!

The MWE is here:

\documentclass{article}
\begin{document}

\begin{minipage}{\textwidth}
word word word word word word word word word word word word word word word word word word word word word word word 
word word word word word word word word word word word word word word word word 
\end{minipage}%

\bigskip

\framebox{
\begin{minipage}{\textwidth}
word word word word word word word word word word word word word word word word word word word word word word word 
word word word word word word word word word word word word word word word word 
\end{minipage}%
}
\end{document}

Best Answer

Does this make sense?

\documentclass{article}
\usepackage{showframe}
\begin{document}

\noindent
\begin{minipage}{\textwidth}
word word word word word word word word word word word word word word word word word word word word word word word 
word word word word word word word word word word word word word word word word 
\end{minipage}%

\bigskip

\noindent
\framebox{%
\begin{minipage}{\dimexpr\linewidth-2\fboxrule-2\fboxsep}
word word word word word word word word word word word word word word word word word word word word word word word 
word word word word word word word word word word word word word word word word 
\end{minipage}%
}
\end{document}

enter image description here

As you can see, the box doesn't stick out into the right margin. I added the showframe package to better show the edges. It should be noted that this method is very similar to the one proposed in this question.