LaTeX frustration - defining commands with arguments

  • Context: LaTeX 
  • Thread starter Thread starter Tickitata
  • Start date Start date
  • Tags Tags
    Latex
Click For Summary
SUMMARY

The forum discussion centers on defining a LaTeX command with arguments, specifically the command \mlegendre{x}{y} to represent the Legendre symbol. The user initially attempted to create the command using \newcommand{\mlegendre}[2]{#1 \overwithdelims () #2}, which resulted in incorrect formatting and errors. Ultimately, the user resolved the issue by redefining the command as \newcommand{\mlegendre}[2]{(\frac{#1}{#2})}, successfully achieving the desired output of the Legendre symbol in math mode.

PREREQUISITES
  • Basic understanding of LaTeX syntax and commands
  • Familiarity with mathematical typesetting in LaTeX
  • Knowledge of the \newcommand function in LaTeX
  • Understanding of the Legendre symbol notation
NEXT STEPS
  • Explore advanced LaTeX command definitions and customizations
  • Learn about LaTeX math mode and its formatting rules
  • Investigate the use of \overwithdelims for custom delimiters in LaTeX
  • Study the implementation of fractions in LaTeX using \frac
USEFUL FOR

Beginner LaTeX users, mathematicians, and anyone interested in typesetting mathematical symbols and expressions effectively.

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

Similar threads

  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 0 ·
Replies
0
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 15 ·
Replies
15
Views
25K
  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 3 ·
Replies
3
Views
6K
  • · Replies 766 ·
26
Replies
766
Views
745K
  • · Replies 4 ·
Replies
4
Views
3K