2

Why does the following code produce Underfull \hbox (badness 10000) in paragraph at lines ... warning?

\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}
3

That's caused by those \newline commands.

\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}

image

|improve this answer|||||
  • How do I define the starred version? I tried \newtheorem*{solution*}{Solution}, but with no avail. – blackened May 2 '19 at 10:46
  • 1
    @blackened I added the unnumbered version – egreg May 2 '19 at 11:04

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.