8

I would like to correct the attached script that I was lucky enough to have it thanks to this Post

\documentclass[11pt,draft]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage{ntheorem}
\usepackage[most]{tcolorbox}
\usepackage[nosolutionfiles]{answers} % for immediate answers (not stored in a file)
\theoremstyle{plain}
\theoremindent=40pt
\theoremheaderfont{\normalfont\bfseries\hspace{-\theoremindent}}
\newtheorem{theorem}{Théorème}
\newtheorem{definition}{Définition}
\newtheorem{proof}{Démonstration}
\usetikzlibrary{decorations.pathmorphing}
\tcbuselibrary{skins}
\tcolorboxenvironment{theorem}{
    blanker,
    breakable,
    before skip=\topsep,
    after skip=\topsep,
    borderline west={1pt}{20pt}{double, shorten <=12pt}
    }
\tcolorboxenvironment{proposition}{
    blanker,
    breakable,
    before skip=\topsep,
    after skip=\topsep,
    borderline west={1pt}{20pt}{double, shorten <=12pt}
    }
\tcolorboxenvironment{definition}{
    blanker,
    breakable,
    before skip=\topsep,
    after skip=\topsep,
    borderline west={1pt}{20pt}{decoration={zigzag,amplitude=2pt,pre=moveto,pre length=12pt},decorate}
    }
\newtheorem{exo}{Exercice}
\Newassociation{correction}{Soln}{mycor}
\Newassociation{indication}{Indi}{myind}
\renewcommand{\Solnlabel}[1]{\bf \emph{Correction #1}}
\renewcommand{\Indilabel}[1]{\bf \emph{Indication #1}}
\newcommand{\flag}[1]{}
\newtheorem{question}{Question}
\def\Tiny{\fontsize{4pt}{4pt}\selectfont}
\newcommand*{\eqdef}{\ensuremath{\overset{\mathclap{\text{\Tiny def}}}{=}}}
\newcommand{\norm}[1]{\left\lVert#1\right\rVert}
\begin{document}
\hrule
\begin{center}
\textbf{\textsf{\Large
     Exercices                                  % TITRE
}}
\end{center}
\hrule
\vspace*{1cm}
\Opensolutionfile{mycor}[ficcorex]
\Opensolutionfile{myind}[ficind]

\begin{exo}
Soient $(X,d)$ un espace métrique et $A\subset X$, $A\neq\emptyset$. On pose:
 \[
 d(x, A)=\inf\{ d(x,a)\ ;\, a\in A\}.
 \]
 Qu'on appelle la \textit{ distance du point $x$ à l'ensemble $A$}.
 On remarque que $d(x, A)$ est bien définie et $\geqslant 0$. De plus, $d(x,A)=0$ si $x\in A$.
 Montrer que
\begin{enumerate}
 \item $x\mapsto d(x,A)$ est $1$-lipschitzienne.
 \item $d(x,A)=d(x,\overline A)$.
 \item $d(x, A)=0\Longleftrightarrow  x\in \overline A$.
 \end{enumerate}
\end{exo}
\begin{correction}
\begin{enumerate}
 \item Soient $x, y\in A$. Pour tout $a\in A$ on a
 \[
 -d(x,y)+d(y,a)\leqslant d(x,a)\leqslant d(y,a)+d(x,y).
 \] Par passage à l'inf, on trouve
 $-d(x,y)+d(y, A)\leqslant d(x,A)\leqslant d(y,A)+d(x,y)$, d'où $|d(x, A)-d(y,A)|\leqslant d(x,y)$.
 \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$. 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$. Il s'ensuit que
 $$d(x, A)\leqslant d(x, a_{n_0})\leqslant d(x,b)+d(b, a_{n_0})<d(x,\overline A)+\varepsilon.$$
 $\varepsilon$ étant arbitraire, on trouve $d(x, A)\leqslant d(x,\overline A)$.\\
 \item "$\Longrightarrow$" Si $d(x, A)=0$, alors pour tout $\varepsilon>0$ il existe un $a\in A$ tel que $d(x,a)<\varepsilon$. Pour $\varepsilon=1/(n+1)$, on trouve une suite $(a_n)\subset A$ telle que $d(x,a_n)<1/(n+1)$. On a donc $a_n\to x$, et par conséquent $x\in\overline A$.\\
  Si $x\in\overline A$, alors $0=d(x,\overline A)=d(x,A)$.
\end{enumerate}
 \end{correction}
\end{document}

Here is an error message

Overfull \hbox (6.10593pt too wide) in paragraph at lines 87--88 

Picture

How to remove the small black rectangle that appears at the end of the correction?

  • 4
    Remove draft, i.e. replace \documentclass[11pt,draft]{book} by \documentclass[11pt]{book}. These boxed indicate overfull hboxes. Of course, the cleaner way is to shuffle things such that there is no such hbox. – marmot Jun 11 at 17:58
  • Note that what you're reporting is not an error message but a warning message. – Mico Jun 11 at 18:09
  • Is warning you that there are not a good point to break the line. Before of the math mode is really bad, and before ≥ is also very bad, although LaTeX could be more more tolerant here (It accept a suggestion of \linebreak[1] here, whilst before of $d(x, ... will accept only the \linebreak[4]) so it break after that. However, for humans probably is better do not break the mathematical expression (in spite of the huge spaces), or better, as suggested, rewrite the paragraph (some like " ..., et particulièrement, $d(x...." – Fran Jun 11 at 18:32
  • Avoid $$. In order to solve the particular problem, rewording seems the best approach: remove “Clairement”, that adds nothing. I'd also avoid the whole correction consisting of an enumerate environment, that gives an unbalanced look to the page. – egreg Jun 11 at 20:09
7

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

  • Thank you for your precious advice. – Zbigniew Jun 11 at 21:09
6

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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.