7. Given the function
$$
f(x)=\left\{\begin{array}{ll}
\ln x, & x>1 ; \\
\frac{1}{2} x+\frac{1}{2}, & x \leqslant 1 .
\end{array}\right.
$$

If $m<n$, and $f(m)=f(n)$, then the minimum value of $n-m$ is $\qquad$ .
$7.3-2 \ln 2$.
Draw the graph of the function $f(x)$, as shown in Figure 3. If $m0$, we get $2<n \leqslant \mathrm{e}$; when $h^{\prime}(n)<0$, we get $1<n<2$.
Therefore, when $n=2$, the function $h(n)$ attains its minimum value $h(2)=3-2 \ln 2$.