LaTeX frustration - defining commands with arguments

  • Context: LaTeX 
  • Thread starter Thread starter Tickitata
  • Start date Start date
  • Tags Tags
    Latex
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 5K views
Tickitata
Messages
29
Reaction score
0
Hi all, I'm a beginner to typesetting using LaTeX. I'm not sure if this is the correct place to ask (the stickied LaTeX thread in Tutorials seemed to be devoted to TeX for the forums)

Homework Statement


I'm attempting to define a command \mlegendre{x}{y} which returns the legendre symbol [tex]$x \overwithdelims () y$[/tex] once already in math mode. My \legendre{x}{y}, to be used while in text mode, seems to be working just fine.

Homework Equations


N/A

The Attempt at a Solution


My attempt is
\newcommand{\mlegendre}[2]{#1 \overwithdelims () #2}

but this is producing very odd results in some places, and causing errors in others. For example,

$g_2 = \mlegendre{0}{7} $

produces [tex]$g_2 = 0 \overwithdelims () 7$[/tex]

/edit: okay well, apparently I don't know how to use PF's tex commands either, haha. In the first, it should have x in the top, and in the second, it should have parentheses around it.

Cheers!
 
Physics news on Phys.org
Ah nevermind, I think I've got it with
\newcommand{\mlegendre}[2]{(\frac{#1}{#2})}