Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 5th, 2012  |  syntax: None  |  size: 0.76 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. newcommand and math environement [migrated]
  2. newcommand{twopartdef}[3]
  3. {
  4. left{
  5.     begin{array}{ll}
  6.         #1 & mbox{if } #2 \
  7.         #3 & mbox{otherwise}
  8.     end{array}
  9. right
  10. }
  11.        
  12. f$(x)$ = twopartdef{$lbrace alpha rbrace}{$x >$ 10}{lbrace beta rbrace}
  13.        
  14. documentclass{article}
  15. newcommand{twopartdef}[3]{%
  16.   left{
  17.     begin{array}{ll}
  18.       #1 & mbox{if } #2 \
  19.       #3 & mbox{otherwise}
  20.     end{array}
  21.   right.
  22. }
  23. begin{document}
  24. [
  25.   f(x) = twopartdef{{ alpha }}{x > 10}{{ beta }}
  26. ]
  27. end{document}
  28.        
  29. documentclass{article}
  30. usepackage{amsmath}% http://ctan.org/pkg/amsmath
  31. newcommand{twopartdef}[3]{%
  32.   begin{cases}
  33.     #1 & text{if #2} \
  34.     #3 & text{otherwise}
  35.   end{cases}
  36. }
  37. begin{document}
  38. [
  39.   f(x) = twopartdef{{ alpha }}{$x > 10$}{{ beta }}
  40. ]
  41. end{document}