How can I get a Legendre symbol


which just used the dashed line instead of the fractional rule?

3 Answers 3








The user command are \legendre that typesets the symbol in the current math style or \dlegendre and \tlegendre to force display or text style.

enter image description here

The \genfrac parts are only for comparisons.

  • The $\genfrac(){}{}{p}{q}\legendre{p}{q}$ get a bit of larger parenthese.
    – fas
    Jun 10, 2011 at 16:52
  • @fas: I've edited the macros.
    – egreg
    Jun 10, 2011 at 17:10
  • @fas: I should add that I've seen nowhere this notation.
    – egreg
    Jun 10, 2011 at 20:08

Interesting question. My first idea was to write In french the symbol is


but without dashed line, the second idea was to use \genfrac but I don't know how to draw the dashed line so the last idea is to use arydshln




enter image description here

  • 1
    Looking at the code, \genfrac uses \over (or \above) internally so the line is produced by a primitive and thus I don't think one could easily modify \genfrac to produce a dashed line. Shame. Jun 10, 2011 at 7:56

If you are going to use this type of notation a lot, I am not sure if the following is suitable but at least, it is quite simple to get some automation wrapped around it


\node[matrix of math nodes,left delimiter=(,right delimiter=)] (lege) at (0,0) {
#1  \\
#2  \\
\draw[densely dashed] (lege.west) -- (lege.east);

\[ \lege{1252}{567}\lege{1}{0} \int^\infty_0{dx}\]    

Trying out the code

I can't foresee any problems with my code but I can sense that there are. Hence, I am pretty sure that advanced users here would find a smarter way to do it (especially the spacing of the delimiters with xshift etc.). You can scale the whole tikzpicture to get different sizes. Cheers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.