0

This question already has an answer here:

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

marked as duplicate by TeXnician, Troy, Stefan Pinnow, user31729, Mensch Jun 3 '17 at 18:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Please add a full minimal working example (all important definitions). – TeXnician Jun 3 '17 at 16:53
  • \makeatletter\@ifclassloaded{foo}{yes}{no}\makeatother outside of package files, otherwise omit the \makeatletter...\makeatother pair – user31729 Jun 3 '17 at 17:02
  • @ChristianHupfer That's the version suggested in the linked question... – TeXnician Jun 3 '17 at 17:07
  • @TeXnician Exactly, the post is what I am looking for. Thanks! – Hezilun Jun 3 '17 at 17:20
  • @TeXnician: Didn't follow the link :-P – user31729 Jun 3 '17 at 17:22