I come from this link and the response that is given is very good.
I have this MWE:
\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\vspace{5mm}
\fbox{\begin{minipage}{30em}
\underline{\textbf{NOTACI\'ON}}: Dada \(f:D\subseteq \mathbb R\rightarrow \mathbb R\) con \(y=f(x)\) para denotar la funci\'on derivada se puede encontrar en la bibliograf\'ia disponible de la materia las siguientes notaciones: \[\begin{array}{cccc}f'(x), & D_xf, & \dfrac{df}{dx}, & \dfrac{dy}{dx}\end{array}.\] Todas ellas son equivalentes y que utilizaremos indistintamente en lo sucesivo.
\end{minipage}}
\vspace{5mm}
\end{document}
where I modify the fbox value (which is 30em) manually. But that is not the correct width of box (according to the margins of the document). So I change 30emfor \textwidth value, and when I compile it says that there is an Bad Box (I clarify that approximately from 31em onwards the Bad Box message appears). How can I avoid that message?
Should I manually enter the value or is there some (easy) way to not have to worry about every box in my document?
Thanks!


fboxsep) on all sides of the box to the text. This space is added to the linewidth, hence the whole box needs more space and creates a warning. – Johannes_B Jan 22 '18 at 07:16\textwidthuse\begin{minipage}{\textwidth-2\fboxsep}and include\usepackage{calc}. Also, you need a\noindentbefore the\fbox{}. But, yes defintly do as @Johannes_B recommends and define a custom environment instead of tweaking every use of this. I'd recomment looking intotcolorbox(there are numerous examples on this site). Also, adding theshowframepackage will clearly show you what is happening with you add the\noindentand the-2\fboxsep. – Peter Grill Jan 22 '18 at 07:37