2

It has become common practice on Mathematica.SE to us the Unicode characters for a number of Mathematica symbols. This works because these are correctly interpreted when copied and pasted into a Notebook.

Mathematica provides double-bracket characters for Part application. These can greatly improve legibility of code with lots of square brackets, but attempting to use them in posts reveals a problem.

This code: list[[Ordering[set[[All, 1]], 15]]]

With \[LeftDoubleBracket] and \[RightDoubleBracket] should look like:

Mathematica graphics

But instead it looks like this, with an extra space to the outside of these brackets, and the brackets are not vertically aligned:

list〚Ordering[set〚All, 1〛, 15]〛

There is however another pair of Unicode characters that have the correct appearance but unfortunately Mathematica does not interpret these correctly, so copy and paste of this line will fail:

list⟦Ordering[set⟦All, 1⟧, 15]⟧

I am requesting a formatting change, if it is possible, such that the upper line of code is rendered in appearance as the lower line.

Conceivably this could be done by either:

  • Changing the display kerning of the Unicode U+301A and U+301B characters to behave as single-width characters without the space, and correct alignment, possibly using the syntax highlighter script.

  • Replacing these characters with U+27E6 and U+27E7 for display, but somehow using U+301A and U+301B when the code is copied.

If either of these is possible I am requesting that it be done.

3
  • Copy+paste is probably the main reason this is not such a good idea.
    – David
    Jul 6, 2012 at 3:25
  • @David what do you mean? As I said in the second bullet point it would be necessary for this to copy correctly; that's the whole point of this request, otherwise one could use U+27E6 and U+27E7 right now (but it would break copy & paste).
    – Mr.Wizard
    Jul 6, 2012 at 6:41
  • 1
    it is possible using javascript, but SE will have philosophical issues with a code block (which is supposed to be verbatim) not really being what it purports to be. Besides, these are font and OS dependent and the latter set of characters (U+27E6 and U+27E7) are not the same height as a square bracket on my machine and that is very jarring. Nevertheless, if they're willing to fix the kerning and implement it, I do agree it will be useful.
    – rm -rf Mod
    Jul 8, 2012 at 4:53

0

You must log in to answer this question.

Browse other questions tagged .