[Tex/LaTex] Typesetting Meijer’s G function in LaTeX

math-modemathtools

At the moment I'm working on a paper, where I use Meijer's G function. The problem is that I don't like the way my G functions look. Let me first tell how I'm typesetting the function at present, and then what I don't like about it. At present I use

\documentclass[11pt]{article}

\usepackage{amssymb,amsmath,mathtools}

\newcommand{\MeijerG}[7]{G \begin{smallmatrix} #1 & #2 \\ #3 & #4 \end{smallmatrix} \left( \begin{smallmatrix} #5 \\ #6 \end{smallmatrix} \middle\vert #7 \right) }

\begin{document}

\begin{equation}
\MeijerG{m}{n}{p}{q}{a_1,\ldots,a_p}{b_1,\ldots,b_q}{z}
\end{equation}

\end{document}

There are several things I would like to change. First, I would like to have a functionality similar to that of commands defined using \DeclarePairedDelimiter from the package mathtools. The following example should illustrate what I mean

\documentclass[11pt]{article}

\usepackage{amssymb,amsmath,mathtools}

\DeclarePairedDelimiter{\average}{\langle}{\rangle}

\begin{document}

\begin{equation}
\average*{\sum_k \delta(x-x_k)}      \neq
\average[\Big]{\sum_k \delta(x-x_k)} \neq
\average{\sum_k \delta(x-x_k)}
\end{equation}

\end{document}

The second problem is that I don't like the spacing around the m,n,p,q. This can to some extent be improved by using \!:

\newcommand{\MeijerG}[7]{G \begin{smallmatrix} #1\! & #2 \\ #3\! & #4 \end{smallmatrix}\!\! \left( \begin{smallmatrix} #5 \\ #6 \end{smallmatrix} \middle\vert #7 \right) }

But I don't know if there is better way to fix this.

If you have any suggestions on how to improve the above defined \MeijerG or if you would define the Meijer's G function in a completely different way, then please write an answer.

Actually I have an additional question: Do you think that any effort (regarding the typesetting of Meijer's G function) will be eliminated when the manuscript is summited to a journal?

Best Answer

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}

enter image description here

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.

Related Question