\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{boththeorems}

\RequirePackage{amsmath}
\RequirePackage{xifthen}

\ProcessOptions\relax

\newcommand*{\newboththeorems}[1]{%
  \def\boththeorems@thmname{#1}
  \internal@newboththeorems%
}

\newcommand*{\internal@newboththeorems}[2][]{%
  \expandafter\newtheorem\expandafter*\expandafter{\boththeorems@thmname*}{#2}
  \ifthenelse{\isempty{#1}}%
  {%
    \expandafter\newtheorem\expandafter{\boththeorems@thmname}{#2}%
  }{%
    \expandafter\newtheorem\expandafter{\boththeorems@thmname}[#1]{#2}%
  }%
}

\endinput
