自定义定理样式:为什么我会收到“Underfull \hbox”警告?

自定义定理样式:为什么我会收到“Underfull \hbox”警告?

为什么下面的代码会产生Underfull \hbox (badness 10000) in paragraph at lines ...警告?

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm}

\newtheoremstyle{solutionstyle}
    {12pt}  
    {12pt}   
    {\normalfont}
    {}    
    {\bfseries} 
    {\bfseries\newline\rule{\textwidth}{0.4pt}\newline} 
    {\newline} 
    {}  
\theoremstyle{solutionstyle}
\newtheorem{solution}{Solution}

\begin{document}

    \begin{solution}
        Test.

        \begin{displaymath}
            r^2 = 2t^2 - 6t + 5 = 2\left(t - \frac{3}{2}\right)^2 + \frac{1}{2}
        \end{displaymath}
    \end{solution}

\end{document}

答案1

这是由这些\newline命令引起的。

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm}

\newtheoremstyle{solutionstyle}
  {12pt}  
  {12pt}   
  {\normalfont}
  {}    
  {\bfseries} 
  {}
  {\newline} 
  {}  
\theoremstyle{solutionstyle}
\newtheorem{solutioninner}{Solution}
\newtheorem*{solutioninner*}{Solution}
\newenvironment{solution}
  {\begin{solutioninner}\rule{\columnwidth}{0.4pt}\par\nopagebreak}
  {\end{solutioninner}}
\newenvironment{solution*}
  {\begin{solutioninner*}\rule{\columnwidth}{0.4pt}\par\nopagebreak}
  {\end{solutioninner*}}

\begin{document}

\begin{solution}
\begin{equation*}
r^2 = 2t^2 - 6t + 5 = 2\left(t - \frac{3}{2}\right)^2 + \frac{1}{2}
\end{equation*}
\end{solution}

\begin{solution*}
\begin{equation*}
r^2 = 2t^2 - 6t + 5 = 2\left(t - \frac{3}{2}\right)^2 + \frac{1}{2}
\end{equation*}
\end{solution*}

\end{document}

图像

相关内容