Remove the small black rectangle that appears at the end of environment

Such problems should be tackled when the text is in final form.

The black box, together with the warning about Overfull \hbox, signals that TeX was unable to find a suitable break point. There are several actions that can be tried.

My first advice is to avoid an entire correction to consist of an enumerate environment, which gives an unbalanced look to the page. Another general advice is to load the microtype package (although in this case it doesn't help).

In your case, a 6pt overfull means that the \geqslant symbol is almost completely in the margin, so this should be fixed.

In the code that follows, I show the original, then some possible fixes. In the first fix I keep enumerate and push the \geqslant symbol to the next line: in a real emergency, this might do, once in a document. The best fix, in any case, is to just omit “Clairement”.

Note the \thickmuskip trick where I just add some shrinkability to it: again, once in a document, a reduced space around a relation symbol is not so bad. Don't do a global setting: this could have a very bad impact on formula spacing.

\documentclass[11pt,draft,a4paper]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage{amsmath}
\usepackage{amssymb}

\begin{document}

\subsubsection*{Original within \texttt{enumerate}}

\begin{enumerate}\setcounter{enumi}{1}
\item Clairement, si $A\subset B$, alors $d(x, A)\geqslant d(x, B)$. 
En particulier,
%%%% the problem!
$d(x, A)\geqslant d(x,\overline A)$.
%%%%
Soit $\varepsilon>0$. Il existe un $b\in\overline A$ tel que 
$d(x,b)<d(x,\overline A)+\varepsilon/2$. Il existe une suite $(a_n)\subset A$ telle 
que $a_n\to b$. Comme $y\mapsto d(x,y)$ est continue sur $X$, on trouve $d(x, a_n)\to d(x,b)$. 
Il existe donc un $n_0$ tel que $d(a_{n_0},b)<\varepsilon/2$.
\end{enumerate}

\subsubsection*{Original with \texttt{\char`\\linebreak}}

\begin{enumerate}\setcounter{enumi}{1}
\item Clairement, si $A\subset B$, alors $d(x, A)\geqslant d(x, B)$. 
En particulier,
%%%% the problem!
$d(x, A)\linebreak[0]\geqslant d(x,\overline A)$.
%%%%
Soit $\varepsilon>0$. Il existe un $b\in\overline A$ tel que 
$d(x,b)<d(x,\overline A)+\varepsilon/2$. Il existe une suite $(a_n)\subset A$ telle 
que $a_n\to b$. Comme $y\mapsto d(x,y)$ est continue sur $X$, on trouve $d(x, a_n)\to d(x,b)$. 
Il existe donc un $n_0$ tel que $d(a_{n_0},b)<\varepsilon/2$.
\end{enumerate}

\subsubsection*{Without \texttt{enumerate}}

2. Clairement, si $A\subset B$, alors $d(x, A)\geqslant d(x, B)$. 
En particulier,
%%%% the problem!
$d(x, A)\geqslant d(x,\overline A)$.
%%%%
Soit $\varepsilon>0$. Il existe un $b\in\overline A$ tel que 
$d(x,b)<d(x,\overline A)+\varepsilon/2$. Il existe une suite $(a_n)\subset A$ telle 
que $a_n\to b$. Comme $y\mapsto d(x,y)$ est continue sur $X$, on trouve $d(x, a_n)\to d(x,b)$. 
Il existe donc un $n_0$ tel que $d(a_{n_0},b)<\varepsilon/2$.

\subsubsection*{Locally reduce \texttt{\char`\\thickmuskip}}

2. Clairement, si $A\subset B$, alors $d(x, A)\geqslant d(x, B)$. 
En particulier,
%%%% the problem!
$\thickmuskip=\muexpr\thickmuskip + 0mu plus 0mu minus 2mu\relax 
d(x, A)\geqslant d(x,\overline A)$.
%%%%
Soit $\varepsilon>0$. Il existe un $b\in\overline A$ tel que 
$d(x,b)<d(x,\overline A)+\varepsilon/2$. Il existe une suite $(a_n)\subset A$ telle 
que $a_n\to b$. Comme $y\mapsto d(x,y)$ est continue sur $X$, on trouve $d(x, a_n)\to d(x,b)$. 
Il existe donc un $n_0$ tel que $d(a_{n_0},b)<\varepsilon/2$.

\subsubsection*{Rewording}

2. Si $A\subset B$, alors $d(x, A)\geqslant d(x, B)$. 
En particulier,
%%%% the problem!
$d(x, A)\geqslant d(x,\overline A)$.
%%%%
Soit $\varepsilon>0$. Il existe un $b\in\overline A$ tel que 
$d(x,b)<d(x,\overline A)+\varepsilon/2$. Il existe une suite $(a_n)\subset A$ telle 
que $a_n\to b$. Comme $y\mapsto d(x,y)$ est continue sur $X$, on trouve $d(x, a_n)\to d(x,b)$. 
Il existe donc un $n_0$ tel que $d(a_{n_0},b)<\varepsilon/2$.

\end{document}

enter image description here


The title of your posting is a bit misleading: the black rectangle -- it's called a "slug" in typography -- occurs at the end of an overfull line, not at the end of an environment. The slugs are being inserted because you specified the draft document class option.

  • The worst way to get rid of the slugs is to remove the draft document class option. While it gets rid of the slugs, it does nothing to fix the issues that cause the occurrence of overfull lines.

  • The best way to get rid of a slug is to rewrite parts or all of the paragraph in question, so that LaTeX can find other, better line breaks.

  • If rephrasing sentences and paragraphs isn't an option, I suggest you change the value of \thickmuskip -- a parameter that governs how much whitespace is inserted to the left and right of "relational" operators such as \subset and \geqslant. The default value of \thickmuskip is 5mu; setting it to 3mu gets rid of the overfull line and hence gets rid of the slug.

The following is a much-simplified version of your code, to allow us to focus on just the enumerated item where the slug occurs. I suggest that if you're choose the reduce the value of \thickmuskip, you reduce the value of \medmuskip (which governs the spacing around binary operators) as well.

enter image description here

\documentclass[11pt,draft]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage{mathtools,amssymb,mathrsfs}
\usepackage[nosolutionfiles]{answers} % for immediate answers (not stored in a file)

\usepackage{ntheorem}
\theoremstyle{plain}
\theoremindent=40pt
\theoremheaderfont{\normalfont\bfseries\hspace{-\theoremindent}}
\Newassociation{correction}{Soln}{mycor}
\renewcommand{\Solnlabel}[1]{\bf \emph{Correction #1}}
\begin{document}

\hrule
\begin{center}% TITRE
\textbf{\textsf{\Large Exercices}}
\end{center}
\hrule
\vspace*{1cm}

\begin{correction}
\begin{enumerate}
\item Soient $x, y\in A$. Pour tout $a\in A$ on a \dots

\item  Clairement, si $A\subset B$, alors $d(x, A)\geqslant d(x, B)$. En particulier, $d(x, A)\geqslant d(x,\overline A)$. Soit $\varepsilon>0$. Il existe un $b\in\overline A$ tel que $d(x,b)<d(x,\overline A)+\varepsilon/2$. Il existe une suite $(a_n)\subset A$ telle que $a_n\to b$. \dots

\item \begingroup % localize scope of next two instructions
\thickmuskip=3mu % default value: 5mu
\medmuskip=3mu   % default value: 4mu
Clairement, si $A\subset B$, alors $d(x, A)\geqslant d(x, B)$. En particulier, $d(x, A)\geqslant d(x,\overline A)$. Soit $\varepsilon>0$. Il existe un $b\in\overline A$ tel que $d(x,b)<d(x,\overline A)+\varepsilon/2$. Il existe une suite $(a_n)\subset A$ telle que $a_n\to b$. \dots 
\endgroup

\item  Clairement, si $A\subset B$, alors $d(x, A)\geqslant d(x, B)$. En particulier, $d(x, A)\geqslant d(x,\overline A)$. Soit $\varepsilon>0$. Il existe un $b\in\overline A$ tel que $d(x,b)<d(x,\overline A)+\varepsilon/2$. Il existe une suite $(a_n)\subset A$ telle que $a_n\to b$. \dots
\end{enumerate}
\end{correction}
\end{document}

Tags:

Environments