# How to align the new environment

I have to define the new environment, similar to the proof environment. I learned on our site how to define it, but I do not know how to customize it.

In particular, I design a book by using gsm document class, the output looks like the following:

Problem Blah Blah Blah...

Solution:.....


I want the solution line is not indented, like

Problem : Blah Blah Blah

Solution Blah Blah Blah ....


How can I do this?

Here is the MWE: (The new environment is defined by \newenvironment{sol}{\paragraph{\bf Loi giai:}}{\hfill $\square$})

\documentclass{gsm-l}
\usepackage[utf8]{vietnam}
\newtheorem{exe}{Bài toán}
\usepackage{lipsum}
\newenvironment{sol}{\paragraph{\bf Loi giai:}}{\hfill $\square$}
\makeindex
\begin{document}
\begin{exe} Here is the problem, or the exercise.
\end{exe}
\begin{sol}
Here is the solution.
\end{sol}
\end{document}


By defining like this the $\square$ symbol (small square at the end of the proof) sometimes appears at the beginning of a new line. How can I put it on the right side like using the flushright command?

You already have the necessary infrastructure, namely the proof environment.

\documentclass{gsm-l}
\usepackage[utf8]{vietnam}

\newtheorem{exe}{Bài toán}

\newenvironment{sol}{\proof[\bfseries Loi Giai:]}{\endproof}

\begin{document}
\begin{exe}
Here is the problem, or the exercise.
\end{exe}

\begin{sol}
Here is the solution.
\end{sol}

\begin{sol}
Here is a longer solution that should use two lines
in order to show the effect.
\end{sol}

\end{document}


NOTE Avoid commands such as \bf, \it and the similar two letter ones for changing fonts. They are obsolete and deprecated.

Perhaps the following is what you're after:

\documentclass{gsm-l}
\usepackage[utf8]{vietnam}
\newtheorem{exe}{Bài toán}
\usepackage{lipsum}
\newenvironment{sol}
{\noindent\textbf{Loi giai:}}% \begin{sol}
{~\hfill $\square$}% \end{sol}
\begin{document}
\begin{exe}
Here is the problem, or the exercise.
\end{exe}
\begin{sol}
Here is the solution that fills the entire line width of the text block.
\end{sol}
\end{document}


The $\square$ is tied (via ~) to the \hfill with some advice from Implicit \hfil at the end of each paragraph?. However, if this doesn't work in some bizarre cases, I'd suggest a slight rewording of the final sentence in order to make it work.