Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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
add comment

2 Answers

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

Sample output

\documentclass{article}

\usepackage{amsmath}

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

\begin{document}

\begin{equation*}
  \test a b c
  \quad \scriptstyle \test{a}{b}{c}
  \quad \scriptscriptstyle \test{a}{b}{c}
\end{equation*}
\( \test a b c \)

\end{document}

\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

\documentclass{article}

\usepackage{mathtools}

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

\begin{document}

\begin{equation*}
  \test* a b c\quad \scriptstyle \test* a b c\quad
  \scriptscriptstyle \test* a b c
\end{equation*}
\( \test a b c \)

\begin{equation*}
  \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}
\end{equation*}

\end{document}

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
add comment

How about this?

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

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
add comment

Your Answer

 
discard

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.