# Creating a ConTeXt/LaTeX hybrid module

I have a simple titlepage, which I want to make available for ConTeXt- as well as LaTeX users. Each should just type \usemodule[myTitlepage], or \usepackage{myTitlepage}, respectively.

I want to do this by determining if LaTeX is used, and if so, define all used ConTeXt-macros to their LaTeX equivalents, so that the titlepage can be written in ConTeXt, similar to this:

\ifLaTeX
\newcommand{\starttikzpicture}[1]{\begin{tikzpicture}[#1]}
\newcommand{\stopttikzpicture}   {\end  {tikzpicture}    }
\newcommand{\crlf}{\\}
...
\else
\doConTeXtRelatedStuff
\fi

\starttikzpicture[scale=3]
\node [text centered] {it works! \crlf or does it?};
\stoptikzpicture

What do I use instead of the pseudocode \ifLaTeX and will the whole idea likely work?

-

However, a better solution might be to let kpse choose the format for you. Create a file called mytitlepage.tex in $TEXMF/tex/genereic/.... that contains the common code. Then create a file mytitlepage.sty in$TEXMF/tex/latex/... that contains latex specific code and loads mytitlepage.tex and create a file t-mytitlepage.(tex|mkii|mkiv|lua) in \$TEXMF/tex/context/third/... that contains ConTeXt specific code and loads mytitlepage.tex. This way, the right file is chosen depending on the format.