The mathematical notation for the magnitude of a vector is $\vert x \vert$, but this does not work:

∥ {1, 2, 3} ∥

Is there any way to overload the DoubleVerticalBar symbol so my Mathematica code would look like a textbook formula?

  • $\begingroup$ Please try Norm. $\endgroup$ Nov 11, 2020 at 11:30
  • $\begingroup$ @ΑλέξανδροςΖεγγ I know about Norm, but I would like to use a "nicer" notation for it $\endgroup$
    – kungfooman
    Nov 11, 2020 at 11:32

2 Answers 2


If you only want to have the "nice" format for input, you could assign Norm to DoubleBracketingBar (which is equivalent to \[LeftDoubleBracketingBar] # \[RightDoubleBracketingBar] &)

DoubleBracketingBar := Norm
(* Norm[x] *)

Alternatively, and more usable, you could use the Notation package

RowBox[{"DoubleBracketingBar", "[", "x_", 
     "]"}]] \[DoubleLongLeftRightArrow] ParsedBoxWrapper[
RowBox[{"Norm", "[", "x_", "]"}]]]
RowBox[{"\[LeftDoubleBracketingBar]", "x_", 
     "\[RightDoubleBracketingBar]"}]] \[DoubleLongLeftRightArrow] 
RowBox[{"Norm", "[", "x_", "]"}]]]

Which is displayed more readable as

The way the input is displayed in the notebook

The usage is then as expected:

DoubleBracketingBar[x] // FullForm
(* Norm[x] *)
\[LeftDoubleBracketingBar]x\[RightDoubleBracketingBar] \
// FullForm
(* Norm[x] *)
(* \[LeftDoubleBracketingBar]x\[RightDoubleBracketingBar] *)

Edit: By the way, the reason I did not use \[DoubleVerticalBar] is because it is built in as an infix operator.

  • $\begingroup$ Thank you a lot! Do you happen to know an easy way to insert the special character for DoubleBracketingBar aswell? It isn't in the Esc menu $\endgroup$
    – kungfooman
    Nov 11, 2020 at 15:48
  • 1
    $\begingroup$ @lama12345 Esc-l||-Esc and Esc-r||-Esc (left and right double bar) works. $\endgroup$
    – Natas
    Nov 11, 2020 at 15:56

You could create an input alias for this:

CurrentValue[EvaluationNotebook[], {InputAliases, "norm"}] = TemplateBox[

The only downside is you have to tab to the placeholder.

  • $\begingroup$ Wow, Norm with DoubleBracketingBar feels like a native construct now (at least for one notebook). Thank you a lot! $\endgroup$
    – kungfooman
    Nov 12, 2020 at 8:48

Your Answer

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

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