# How do I create a new environment like proof in amsthm package which reads as 'solution' instead of 'proof'?

Using the \newtheorem command, I know how to create similar type of environments like 'Examples', 'Remarks', 'Lemma' etc. in class notes. For Theorems, we use \begin{proof} ......... \end{proof} to write the proof.

My query is how to create a new environment (with amsthm package) called 'solution' for writing solutions to worked examples and problems. I want this to begin and end with 'solution'. A \qed to complete the solution will be also a great help. Kindly help on how to do it in LaTeX.

For the enclosed code, how should adjust I the LaTeX preamble after \usepackage{amsthm}? Thanks a lot!

 \begin{example}
Find the Laplace transform of $f(t) = 1$.
\end{example}

\begin{solution}
The Laplace transform of $f(t)$ is obtained as
$$F(s) = {\cal L}(f) = \int\limits_0^\infty e^{-s t} (1) dt = {1 \over s}$$
\end{solution}

• Do you know how to make your own environments? Commented Mar 11, 2022 at 12:28
• For the placement of the qed symbol, the ntheorem package is much better. Commented Mar 11, 2022 at 13:23

Just define solution in terms of proof.

\documentclass{article}
\usepackage{amsthm}

\theoremstyle{definition}
\newtheorem{example}{Example}

\newenvironment{solution}{\begin{proof}[Solution]}{\end{proof}}

\begin{document}

\begin{example}
Find the Laplace transform of $f(t) = 1$.
\end{example}

\begin{solution}
The Laplace transform of $f(t)$ is obtained as
$F(s) = \mathcal{L}(f) = \int\limits_0^\infty e^{-s t} (1) \, dt = \frac{1}{s} \qedhere$
\end{solution}

\end{document}


Since the particular solution ends with a display, you should use \qedhere as shown. Otherwise nothing is necessary to get the tombstone at the end.

1. {\cal L} has been deprecated for about 30 years and should be \mathcal{L}

2. $$...$$ has never be advertised in LaTeX and should not be used

3. {1\over s} is plain TeX syntax that should be avoided in LaTeX

4. The differential should be preceded by \,

• Your solution works beautifully! Earlier I was getting a \bullet at the end of the solution & proof which I did not like. Later I checked & found that this is due to another *.mac file which defined "\def\qed{\ \hfill$\bullet$}" but I changed it to "\def\qed{\ \hfill$\blacksquare$}" - Now things are working very well! Commented Mar 11, 2022 at 15:00

I tried many LaTeX commands & this one works:

\newenvironment{solution}{{\bf \emph{Solution.} }}{\hfill $\Box$ \\}


Now I use \begin{solution} ...... \end{solution}

I was earlier usign $\blacksquare$ for the end of the proof and the solution but I now feel that $\Box$ is easy for the eyes!

• These commands work well ! I tested! I am getting a \Box at the end of the 'solution' and not the 'dark bullet' as the case with other solution for me.. Just an update.. Commented Mar 11, 2022 at 14:55
• There is no guarantee that the box will be at the end of the line; you also lose \qedhere. Commented Mar 14, 2022 at 8:27