8
$\begingroup$

When you type -> in the front end, it is automatically replaced with the \[Rule] character. Similarly, when you type <=, it is replaced automatically with \[LessEqual], and >= is replaced with \[GreaterEqual].

Is it possible to disable these replacements? I occasionally run a tutorial for students who are utterly new to Mathematica, where I show example code on a screen and they have to type it in to their own machines and then modify it to do certain things. Occasionally, students will get confused when they see special characters such as \[Rule] on my screen, and not know that they should type -> instead. It would be helpful if I could disable this auto-replacement on my screen in order to avoid such confusion.

$\endgroup$
  • $\begingroup$ Convert the cell to InputForm (Cell | Convert To | InputForm) . See menu for corresponding shortcut keys on your system. $\endgroup$ – Bob Hanlon Aug 30 '19 at 3:41
  • $\begingroup$ @BobHanlon: That looks like a reasonable answer to me. $\endgroup$ – Michael Seifert Aug 30 '19 at 15:23
6
$\begingroup$

Find InputAutoReplacements in Option inspector. It contains replacement rules for special characters and operators. You may disable (just remove what you don't need to be automatically replaced) this feature for particular Cell, or complete Notebook. There is another option ShowSpecialCharacters, which controls the display of special characters: when set to False a character in Input will be represented by its full name, e.g. a->b will be shown as a \[Rule] b.

| improve this answer | |
$\endgroup$
0
$\begingroup$

The InputAutoReplacements are specified for the form being used, which is typically StandardForm:

CurrentValue[{StyleDefinitions, "StandardForm", InputAutoReplacements}]
{"->" -> "\[Rule]", ":>" -> "\[RuleDelayed]", "<=" -> "\[LessEqual]", 
">=" -> "\[GreaterEqual]", "!=" -> "\[NotEqual]", "==" -> "\[Equal]", 
"@>" -> "\[InlinePart]", "<->" -> "\[TwoWayRule]", ParentList}

Since this is a stylesheet definition, to modify it you need to modify the stylesheet. For example, the following code will disable all input auto replacements:

SetOptions[
    EvaluationNotebook[],
    StyleDefinitions -> Notebook[
        {
        Cell[StyleData[StyleDefinitions->"Default.nb"]],
        Cell[StyleData["StandardForm"], InputAutoReplacements->{}]
        },
        StyleDefinitions->"PrivateStylesheetFormatting.nb"
    ]
]

If you already have a non-default stylesheet, you will just need to add the above "StandardForm" style to the stylesheet instead.

| improve this answer | |
$\endgroup$

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.