TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I create this where {a}{b}{c} are variables for a possible math formula?

share|improve this question
Welcome to TeX.sx! – lockstep Dec 6 '12 at 11:48

I suggest using the amsmath command \genfrac which will resize as follows:

Sample output



\newcommand{\test}[3]{\left( \genfrac{}{}{0pt}{}{#1}{#2}\,\middle\vert\, #3\right)}


  \test a b c
  \quad \scriptstyle \test{a}{b}{c}
  \quad \scriptscriptstyle \test{a}{b}{c}
\( \test a b c \)


\genfrac takes six arguments, the first two are delimiters around the "fraction", then next is the thickness of the horizontal dividing line, set to 0pt here to make it invisible, and the last two are the numerator and denominator of the fraction.

If you want to have good control over the enclosing brackets (...) then an alternative definition can be given using the mathtools package:

mathtools version



\DeclarePairedDelimiterX{\test}[3]{(}{)}{\genfrac{}{}{0pt}{}{#1}{#2}\,\delimsize\vert\, #3}


  \test* a b c\quad \scriptstyle \test* a b c\quad
  \scriptscriptstyle \test* a b c
\( \test a b c \)

  \test*{a^X}{b_Y}{c_Z} \quad \test[\Bigg]{a^X}{b_Y}{c_Z}
  \quad \test[\bigg]{a^X}{b_Y}{c_Z}
  \quad \test[\Big]{a^X}{b_Y}{c_Z}
  \quad \test[\big]{a^X}{b_Y}{c_Z}
  \quad \test{a^X}{b_Y}{c_Z}


This time you have use \test* for the version with automatic sizing of brackets, \test just gives you ordinary brackets, but you also get the possiblities \test[\big], \test[\Big] etc. where the brackets sizes are explicitly specified.

share|improve this answer
Be very careful about \left and \right when used in the text. Try $ \text b g c $, then the fences disturb the line spacing (add a line of text above and below). It is anoying to use, but \mathchoice might be a better choice. – daleif Dec 6 '12 at 15:05
@daleif You are perfectly correct about use inline in text. I'll add an alternative mathtools macro to my answer. – Andrew Swann Dec 6 '12 at 15:16

How about this?

\usepackage{amsmath} % for \text            
\newcommand\test[3]{\text{voor }\left( \begin{array}{@{}c@{\,}} #1 \\ #2 \end{array}\middle|\ \ #3 \right)}

enter image description here

share|improve this answer
both perfect solutions, thanks alot – min Dec 6 '12 at 21:15
I haven't been able to figure out what this piece of code in your example does: \begin{array}{@{}c@{\,}} – min Dec 6 '12 at 23:44
@min it removes column sep – cmhughes Dec 7 '12 at 0:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.