%    \begin{macrocode}
\RequirePackage{expl3}
\ProvidesExplPackage
  {minibox}
  {2013/06/21}
  {0.2a}
  {Another type of box.}
%    \end{macrocode}
%
%    \begin{macrocode}
\bool_new:N \l_minibox_frame_bool
\keys_define:nn {minibox}
 {
  frame .choice: ,
  frame / true  .code:n = { \bool_set_true:N  \l_minibox_frame_bool } ,
  frame / false .code:n = { \bool_set_false:N \l_minibox_frame_bool } ,
  frame .default:n  = { true } ,

  l .code:n = { \tl_set:Nn \l_minibox_tabular_preamble_tl {l} } ,
  c .code:n = { \tl_set:Nn \l_minibox_tabular_preamble_tl {c} } ,
  r .code:n = { \tl_set:Nn \l_minibox_tabular_preamble_tl {r} } ,

  t .code:n = { \tl_set:Nn \l_minibox_tabular_valign_tl {t} } ,
  m .code:n = { \tl_set:Nn \l_minibox_tabular_valign_tl {c} } ,
  b .code:n = { \tl_set:Nn \l_minibox_tabular_valign_tl {b} } ,

  rule .dim_set:N = \l_minibox_rule_dim ,
  pad  .dim_set:N = \l_minibox_pad_dim  ,
 }
%    \end{macrocode}
%
%    \begin{macrocode}
\cs_new:Npn \miniboxsetup #1 { \keys_set:nn {minibox} {#1} }
\miniboxsetup {l,m,rule=\fboxrule,pad=\fboxsep}
%    \end{macrocode}
%
%    \begin{macrocode}
\newcommand\minibox[2][]
 {
  \group_begin:
  \keys_set:nn {minibox} {#1}
  \bool_if:NTF \l_minibox_frame_bool
   {
    \setlength\fboxrule{\l_minibox_rule_dim}
    \setlength\fboxsep{\l_minibox_pad_dim}
    \fbox
   }
   { \use:n }
   {
    \use:x
     {
      \exp_not:N \begin{tabular}
        [\l_minibox_tabular_valign_tl]
        { @{} \l_minibox_tabular_preamble_tl @{} }
       \exp_not:n {#2}
      \exp_not:N \end{tabular}
     }
   }
  \group_end:
 }
%    \end{macrocode}
