I can't get the syntax right. I am trying to use this answer below to help me.
how to use conditional to define different \begin and \end environment at compile time
I am trying to setup an environment for tex4ht vs. pdflatex. If tex4ht is running, then the environment will be
\begin{Verbatim}
.......
\end{Verbatim}
If pdflatex is running, then it will be
\begin{Verbatim}[samepage,fontsize=\small,frame=single]
.......
\end{Verbatim}
I am not able to figure the API to \NewEnviron
to pass those additional arguments above inside the [....]
Here is a MWE
\documentclass{article}%
\usepackage{fancyvrb}
\usepackage{array}%for m option
\usepackage{environ}
\NewEnviron{X}[4][]{% takes 4 arguments, samepage,fontsize=..,frame=...,Verbatim
\ifdefined\HCode %htlatex
\begin{#4}
\BODY
\end{#4}
\else% pdflatex
\begin{#4}[#1,#2,#3] %is this right?
\BODY
\end{#4}
\fi%
}
\begin{document}
\begin{tabular}[c]{|m{4in}|m{2.5in}|}\hline
\textbf{Mathematica}
\begin{X}[samepage][fontsize=\small][frame=single]{Verbatim} %is this right?
{(10 E^(-t/10) HeavisideTheta[t]
Sin[(3 Sqrt[11] t)/10])/(3 Sqrt[11])} some Verbatim stuff
\end{X}
&
some text
\\\hline
\end{tabular}
\end{document}
The above should become the following (if pdflatex is running)
\begin{tabular}[c]{|m{4in}|m{2.5in}|}\hline
\textbf{Mathematica}
\begin{Verbatim}[samepage,fontsize=\small,frame=single]
{(10 E^(-t/10) HeavisideTheta[t]
Sin[(3 Sqrt[11] t)/10])/(3 Sqrt[11])}
\end{Verbatim}
&
some text
\\\hline
\end{tabular}
and if tex4ht if running, it should become
\begin{tabular}[c]{|m{4in}|m{2.5in}|}\hline
\textbf{Mathematica}
\begin{Verbatim}
{(10 E^(-t/10) HeavisideTheta[t]
Sin[(3 Sqrt[11] t)/10])/(3 Sqrt[11])}
\end{Verbatim}
&
some text
\\\hline
\end{tabular}
I tried calling it as follows
\begin{X}[samepage,fontsize=\small,frame=single]{Verbatim}
But that did not help. I keep getting syntax error Missing $ inserted \end{X}
and extra }
etc....
Also tried
\begin{X}[samepage],[fontsize=\small],[frame=single]{Verbatim}
What is the correct syntax to setup this environment? Using texlive 2013 and Miktex
environ
for defining verbatim environments.