8
$\begingroup$

How do I make mathematica treat $5\frac{1}{2}$ as a mixed fraction rather than 5 times one-half?

I'm using typesetting keyboard shortcuts (if that's important)

Currently I'm using $(5 + \frac{1}{2})$ to achieve this.

$\endgroup$

2 Answers 2

12
$\begingroup$

You can add an input alias to do this. For example:

CurrentValue[EvaluationNotebook[], {InputAliases, "mf"}] = TemplateBox[
    {"\[SelectionPlaceholder]","\[Placeholder]","\[Placeholder]"},
    "MixedFraction",
    DisplayFunction->(RowBox[{#1, FractionBox[#2,#3]}]&),
    InterpretationFunction->(RowBox[{#1,"+", FractionBox[#2,#3]}]&)
];

Here is a short animation showing it in action:

enter image description here

$\endgroup$
5
$\begingroup$

\[ImplicitPlus] can be entered as ESC+ESC:

5\[ImplicitPlus](1/2)
(*  11/2  *)

It works for entering in the Front End, but it is automatically converted to Plus:

Mathematica graphics

$\endgroup$

Your Answer

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

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