Create new environment with options

I'm new to creating new environments and even though I searched at the xparse*documentation I couldn't figured out how to solve my specific problem. I would like to create a new environment, say concept, and I would like it to take an optional argument (I don't know if it has to be a boolean or what). This optional argument will make the text to be in italics. If the argument is not declared, it will simply print normal font. It's as simple as that. So

\begin{concept}[i] % I just invented a option named "i"
This text will be in italics
\end{concept}


or without an option

\begin{concept}
This text will be in normal font.
\end{concept}


I thought that may be using the xparse package would make the task easier. Sorry to ask such a silly question but I couldn't come to a solution.

-
For simple usages see Peter's answer. For advanced stuff, try some of the keyval packages like kvoptions or pgfkeys, xkeyval, l3keys etc. –  tohecz Feb 20 at 13:31
Welcome to TeX.sx! Your post was migrated here from Stack Overflow site. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Feb 20 at 15:21

migrated from stackoverflow.comFeb 20 at 13:17

This question came from our site for professional and enthusiast programmers.

Normal LaTeX environments can do this without the need for the xparse package:

References:

Relevant for using \itshape:

Code:

\documentclass{article}
\usepackage{xstring}

\newenvironment{concept}[1][]{%
\IfStrEq{#1}{i}{\itshape}{}%
}{%
}%

\begin{document}
\begin{concept}[i]% I just invented a option named "i"
This text will be in italics
\end{concept}

\begin{concept}
This text will be in normal font.
\end{concept}

\end{document}

-
Thanks @peter ! –  ezitoc Feb 19 at 19:11