I would like to input "rendered" subscripts in Wolfram Cloud, without having to verbosely type Subscript[a, b]. The local notebook shortcut is ctrl + -, but as per this question, such shortcuts are not yet available. One can copy the rendered output of evaluating Subscript[a,b] into another input line, so it is possible that the input form contains rendered subscripts, albeit as non-editable tokens.

I am wondering whether it's possible to define a set of input transformation rules to parse and modify input as it is typed. For example, so that custom syntax like a((b)) would be immediately replaced with the output render of Subscript[a,b]. I note that I could do this after cell evaluationg using CellEpilog, as per this question, but I wish to perform the substitution 'on-the-fly' while the input is typed.

Is this at all possible? I can naturally choose a 'to be replaced' syntax in lieu of a((b)) which doesn't prematurely evaluate.

  • $\begingroup$ I don't use Wolfram Cloud but have you tried using Format[a[b]] := Subscript[a, b] or Format[x[n_Integer]] := Subscript[x, n] then input as indexed variables in subsequent code. $\endgroup$
    – Bob Hanlon
    May 25, 2021 at 16:06
  • 2
    $\begingroup$ You can render TeX in Mathematica using Ctrl+Shift+4. For example, press Crtl-Shift+4 and then type a_b and then Enter to get the equivalent of Subscript[a,b]. $\endgroup$
    – Mike Z.
    May 25, 2021 at 17:45
  • $\begingroup$ @BobHanlon Nice idea (albeit not 'on-the-fly'), though among the symbols I need to format is C, and Format[C[q_]] := Subscript[C, q] throws an error (Tag C is Protected) $\endgroup$
    – Anti Earth
    May 26, 2021 at 10:49
  • $\begingroup$ @MikeZ. Also a nice idea, and works in the Cloud,though I can't work out how to specify expressions like Subscript[a, b][arg] $\endgroup$
    – Anti Earth
    May 26, 2021 at 10:50
  • $\begingroup$ @BobHanlon Note too the re-formatting seems to occur after the expression is evaluated. Hence, functions which expected subscripts and not a[b] won't evaluate. $\endgroup$
    – Anti Earth
    May 26, 2021 at 11:07


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.