One possibility: I used \DeclarePairedDelimiterX
from the mathtools
package to define a \MeijerM
command with three arguments which is responsible to typeset the delimited matrix; then I defined \MeijerG
having eight arguments (the first one is optional and will be passed as the optional argument to \MeijerM
); using the \WithSuffix
command from the suffix
package to provide the starred version \MeijerG*
:
\documentclass[11pt]{article}
\usepackage{suffix}
\usepackage{mathtools}
\DeclarePairedDelimiterX\MeijerM[3]{\lparen}{\rparen}%
{\begin{smallmatrix}#1 \\ #2\end{smallmatrix}\delimsize\vert\,#3}
\newcommand\MeijerG[8][]{%
G^{\,#2,#3}_{#4,#5}\MeijerM[#1]{#6}{#7}{#8}}
\WithSuffix\newcommand\MeijerG*[7]{%
G^{\,#1,#2}_{#3,#4}\MeijerM*{#5}{#6}{#7}}
\begin{document}
\[
\MeijerG*{m}{n}{p}{q}{a_1, \dots, a_p}{b_1, \dots, b_q}{z}\quad
\MeijerG[\big]{m}{n}{p}{q}{a_1, \dots, a_p}{b_1, \dots, b_q}{z}\quad
\MeijerG[\Bigg]{m}{n}{p}{q}{a_1, \dots, a_p}{b_1, \dots, b_q}{z}
\]
\end{document}
The size of delimiters in the second and third examples is obviously wrong, but I just included them to test the functionality of the defined commands. Also, I used simple sub/superscripts to typeset the first four arguments, but of course you can use one of your proposed variants instead.
If using the primitive form you need to remember that like \write
macros are expanded while sending to lua so you need
\documentclass{article}
\usepackage{array}
\newcommand{\mytable}{%
\directlua{
tex.print("\string\\begin{tabular}{lll}")
tex.print("1 & a & Test A \string\\\string\\")
tex.print("2 & b & Test B \string\\\string\\")
tex.print("\string\\end{tabular}")
}
}
\begin{document}
\mytable
\end{document}
Best Answer
If this works generally, I just got lucky. EDITED to do derivatives.
EDITED To be more true to math mode. EDITED to allow different function names with use of optional argument (default
\f
). EDITED to use more natural syntax\f(3)
rather than\f{3}
. EDITED to provide\listfunc
macro. EDITED to work withamsmath
.Finally, EDITED to allow a more general syntax that can include primes, subscripts etc. in the function name itself.
NOTE: Joel noted that the method can get confused if the evaluation value itself contains a term in parentheses, for example,
$\f ( \ln(a + 1.5) )$
. The workaround for this is to embrace the inner argument, such as$\f({\ln(a + 1.5)})$
or$\listfunc y''({\ln(a + 1.5)})$
.