1

I have defined a new environment called sltn and want the text Solution to be green. The text working fine but the . after Solution also needs to be blue but I couldn't find any way to do that.

\documentclass{amsbook}
\usepackage{amsthm}
\usepackage{xcolor}

\newenvironment{sltn} {\begin{proof}[\bfseries \textcolor{green}{Solution}]} {\end{proof}} 

\begin{document}
    \begin{sltn}
        A solution.  
    \end{sltn}
\end{document}

enter image description here

3 Answers 3

2

The thmtools package cooperates with amsthm and provides efficient tools to customise theorem declarations and theorem styles:

\documentclass{amsbook}
\usepackage{amsthm}
\usepackage{xcolor}
\usepackage{thmtools}

\declaretheoremstyle[%
spaceabove=6pt, spacebelow=6pt,
headfont=\normalfont\bfseries\color{green}, headindent=\parindent,
notefont=\mdseries, notebraces={(}{)},
bodyfont=\normalfont,
postheadspace=0.5em]%
{sol}

\declaretheorem[name=Solution, numbered=no, style=sol]{sltn}

\usepackage{lipsum}

\begin{document}

\lipsum[47]
    \begin{sltn}
        A very short solution.
    \end{sltn}

\end{document} 

enter image description here

1

Solution. instead of Solution

\documentclass{amsbook}
\usepackage{amsthm}
\usepackage{xcolor}

\newenvironment{sltn} {
\begin{proof}[\bfseries \textcolor{green}{Solution.}]
}{\end{proof}} 

\begin{document}
    \begin{sltn}
        A solution.  
    \end{sltn}
\end{document}
0

You can define a new theorem style with the formatting and punctuation you want.

This variant creates the unnumbered proof environment sltn* and the numbered environment sltn, which would give you “Solution 1.”

\documentclass{amsbook}
\usepackage{amsthm}
\usepackage[svgnames]{xcolor}

\newtheoremstyle{solution}%
  {3pt}% Space above
  {3pt}% Space below
  {}% Body font
  {}% Indent amount
  {\bfseries\color{green}}% Theorem head font
  {\textcolor{blue}{.}}% Punctuation after theorem head
  {.5em}% Space after theorem head
  {}% Theorem head spec
\theoremstyle{solution}
\newtheorem{sltn}{Solution}
\newtheorem*{sltn*}{Solution}

\begin{document}
    \begin{sltn*}
        A solution.  
    \end{sltn*}
\end{document}

A sample.

See the amsthm manual if you need more details.

Note that the original code sample you posted actually selects bold small caps, which were not displaying only because the default bold font does not contain small caps. If you genuinely wanted them, add \scshape to \bfseries and \color.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .