I've created (copied) a simple environment in order to create a frame around a piece of text. The environment uses the mdframes environment in order to box the content and a simple macro changemargin that is used to add some white space at the left and at the right of the box.
\documentclass{article}
\usepackage[utf8]{inputenc}
% mdframe: put a certain amount of text in a box
\usepackage[framemethod=default]{mdframed}
\usepackage{showexpl}
\mdfdefinestyle{exampledefault}{
rightline=true,
innerleftmargin=10,
innerrightmargin=10,
frametitlerule=true,
frametitlerulecolor=black,
frametitlebackgroundcolor=white,
frametitlerulewidth=1pt,
}
% macro to change margins
\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endchangemargin=\endlist
% custom environment
\newenvironment{Boxed}[1]
{
\begin{changemargin}{2cm}{2cm}
\begin{mdframed}[style=exampledefault, frametitle={#1}]
}
{
\end{mdframed}
\end{changemargin}
}
\usepackage{lipsum} % add some text
\begin{document}
\lipsum
\begin{Boxed}{I'm the title}
I'm the content. I've a nice frame around me.
\end{Boxed}
\end{document}
This is the result. It works perfectly.

My question is, can I use my environment like a command?
\Boxed{title}{content}

changemargin'environment'? – Jan 29 '17 at 10:50