使用 mathclap 换行

使用 mathclap 换行

我怎样才能使文本换行,\mathclap以便文本不会像图片那样溢出?

\usepackage{mathtools}
\makeatletter% From https://tex.stackexchange.com/a/419690/156344
\def\smalloverbrace#1{\mathop{\vbox{\m@th\ialign{##\crcr\noalign{\kern3\p@}%
  \tiny\downbracefill\crcr\noalign{\kern3\p@\nointerlineskip}%
  $\hfil\displaystyle{#1}\hfil$\crcr}}}\limits}
\makeatother
\begin{document}
    \[ \mu = \int_{-\infty}^{\infty} x f(x)dx = \frac{\int_{-\infty}^{\infty} x f(x)dx}{\int_{-\infty}^{\infty} x f(x)dx} = \underbrace{\bar{x}}_{\mathclap{\text{x-coordinate of centroid of region $\mathcal{R}$ under the graph}}}\]
\end{document}

在此处输入图片描述

答案1

看看以下简化的解决方案是否接近您想要的解决方案:

\documentclass{article}
\usepackage{mathtools}

\begin{document}
\[
\mu = \int_{-\infty}^{\infty} x f(x)dx
    = \frac{\int_{-\infty}^{\infty} x f(x)dx}{\int_{-\infty}^{\infty} x f(x)dx}
    = \underbrace{\bar{x}\strut}_{\mathclap{\begin{smallmatrix}
                            x$-coordinate of$\\
                              $centroid of region$\\
                              \mathcal{R} $ under the graph$
                            \end{smallmatrix}{}}}
\]
\end{document}

它给:

在此处输入图片描述

答案2

解决方案如下stackengine

\documentclass{article}

\usepackage{mathtools}
\usepackage[usestackEOL]{stackengine}
\makeatletter% From https://tex.stackexchange.com/a/419690/156344
\def\smalloverbrace#1{\mathop{\vbox{\m@th\ialign{##\crcr\noalign{\kern3\p@}%
  \tiny\downbracefill\crcr\noalign{\kern3\p@\nointerlineskip}%
  $\hfil\displaystyle{#1}\hfil$\crcr}}}\limits}
\makeatother
\begin{document}

    \[ \mu = \int_{-\infty}^{\infty} x f(x)dx = \frac{\int_{-\infty}^{\infty} x f(x)dx}{\int_{-\infty}^{\infty} x f(x)dx} = \underbrace{\bar{x}}_{\strut\clap{\scriptsize\Shortunderstack{ x-coordinate of centroid of \\ region $\mathcal{R}$ under the graph}}} \]

\end{document}

在此处输入图片描述

相关内容