LaTeX LaTeX frustration - defining commands with arguments

  • Thread starter Thread starter Tickitata
  • Start date Start date
  • Tags Tags
    Latex
AI Thread Summary
A beginner in LaTeX is seeking help to define a command for the Legendre symbol, specifically \mlegendre{x}{y}, which should display as $x \overwithdelims () y$ in math mode. The initial attempt at creating the command using \newcommand resulted in unexpected outputs and errors. The user initially defined the command as \newcommand{\mlegendre}[2]{#1 \overwithdelims () #2}, but it did not produce the desired format. After some trial and error, the user corrected the command to \newcommand{\mlegendre}[2]{(\frac{#1}{#2})}, achieving the intended representation of the Legendre symbol.
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 $x \overwithdelims () y$ 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 $g_2 = 0 \overwithdelims () 7$

/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})}
 

Similar threads

Replies
5
Views
3K
Replies
1
Views
3K
Replies
3
Views
2K
Replies
15
Views
25K
Replies
4
Views
4K
Replies
766
Views
737K
Replies
4
Views
3K
Replies
3
Views
5K
Back
Top