The environment is:
\documentclass{beamer}
\usepackage{xparse}
\usepackage{expl3}
Or:
\documentclass{article}
\usepackage{xparse}
\usepackage{expl3}
Following is an accustomed command sequence, \pog, which is written with the two package commands, sparse and expl3, except the second line one that is merely for expressing question but not a affirmative command in term of certain package:
If documentclass={Beamer}{% if
}%if
{%if
}%if
The complete command: \pog
\NewDocumentCommand{\pog}{m o O{Detail} m m}{ %newCS
If documentclass={Beamer}{% if
\IfValueTF{#2}{ %if
\tl_set:Nn \l__hezilun_tmp_tl {#4}
\tl_case:Nn \l__hezilun_tmp_tl {% case
\c_enum_tl { %c_enum_tl
\begin{frame}{#1}
\begin{columns}
\begin{column}{0.5\linewidth}
\begin{figure}
\includegraphics[width=\linewidth]{pics/#2}
\end{figure}
\end{column}
\begin{column}{0.5\linewidth}
\begin{block}{#3}
\begin{#4}
#5
\end{#4}
\end{block}
\end{column}
\end{columns}
\end{frame}
}%c_enum_tl
\c_desc_tl { %desc_tl
\begin{frame}{#1}
\begin{columns}
\begin{column}{0.5\linewidth}
\begin{figure}
\includegraphics[width=\linewidth]{pics/#2}
\end{figure}
\end{column}
\begin{column}{0.5\linewidth}
\begin{block}{#3}
\begin{#4}
#5
\end{#4}
\end{block}
\end{column}
\end{columns}
\end{frame}
}%desc_tl
}%case
}%if
{%if
\tl_set:Nn \l__hezilun_tmp_tl {#4}
\tl_case:Nn \l__hezilun_tmp_tl {% case
\c_enum_tl { %c_enum_tl
\begin{frame}{#1}
\begin{#4}
#5
\end{#4}
\end{frame}
}%c_enum_tl
\c_desc_tl { %desc_tl
\begin{frame}{#1}
\begin{#4}
#5
\end{#4}
\end{frame}
}%desc_tl
}%case
}%if
}%if
{%if
\tl_set:Nn \l__hezilun_tmp_tl {#4}
\tl_case:Nn \l__hezilun_tmp_tl {% case
\c_enum_tl { %c_enum_tl
\paragraph{#1}
\begin{figure}
\includegraphics[width=\linewidth]{pics/#2}
\end{figure}
\subpragraph{#3}
\begin{#4}
#5
\end{#4}
}%c_enum_tl
\c_desc_tl { %desc_tl
\paragraph{#1}
\begin{figure}
\includegraphics[width=\linewidth]{pics/#2}
\end{figure}
\subpragraph{#3}
\begin{#4}
#5
\end{#4}
}%desc_tl
}%case
{% if
}%newCS
\ExplSyntaxOff
\makeatletter\@ifclassloaded{foo}{yes}{no}\makeatotheroutside of package files, otherwise omit the\makeatletter...\makeatotherpair – Jun 03 '17 at 17:02beamerarticle. – samcarter_is_at_topanswers.xyz Jun 03 '17 at 18:46