8

Mathematica graphics

Alt++ could adjust the size, but how to store the satisfactory size?

For example: Each time I type |, its size is (I assume) 12.

How to make its effect like adding StyleBox["|", FontSize->18]?

Sjoerd C. de Vries
  • 65,815
  • 14
  • 188
  • 323
HyperGroups
  • 8,619
  • 1
  • 26
  • 63

3 Answers3

5
SetOptions[InputNotebook[], 
 InputAutoReplacements -> {"!!" -> StyleBox["\[NotVerticalBar]", 25]}]

Then just type !!

or use

SetOptions[InputNotebook[],InputAliases -> {"!!" -> StyleBox["\[NotVerticalBar]", 25]}]

to type Esc!!Esc

panda-34
  • 1,268
  • 7
  • 8
  • 2
    There is one imperfect thing: First input !! and then add xx!! yy,xx,yy will inherit the FontSize->25. – HyperGroups Jul 29 '13 at 08:36
  • @HyperGroups, increasing font size through front end menu exhibits the same behavior, it's a feature of the frond end. – panda-34 Jul 29 '13 at 09:17
3

This could be a comment but it is wrong habbit to put the answers there, if it is not what you like I will delete it:

newNV[x__] := Row[{x}, Style["\[NotVerticalBar]", 25]]

newNV[1, 2, 3, 4]

enter image description here

Kuba
  • 136,707
  • 13
  • 279
  • 740
  • This is good for some programming generated formulas. Now I'm typing formulas by hand and Ctrl+9 this way. But this is also useful, so just leave it as one answer. – HyperGroups Jul 29 '13 at 08:40
  • @HyperGroups I agree that @panda-34 's answer is closer to your needs so I've +1ed it. :) Bun none of this two is ideal. panda-34's solution do not affect NotVerticalBar[] for example. – Kuba Jul 29 '13 at 08:48
2

By forcing the character to have a certain font size you run into the problem that its relative size will be incorrect if the entire expression is subsequently styled to have a different font size.

Therefore, it would be better to scale the character with a Magnification factor instead of an absolute font size. If you're interested in typesetting, I would assume that the relevant formatting is really only needed for TraditionalForm output, so I would use the following:

Format[
  NotVerticalBar[x___], TraditionalForm] := 
 DisplayForm[
  RowBox[Riffle[ToBoxes /@ Flatten[{x}], 
    StyleBox["\[NotVerticalBar]", Magnification -> 2.5]]]]

TraditionalForm[Style[a^2 \[NotVerticalBar] b, FontSize -> 18]]

small

TraditionalForm[Style[a^2 \[NotVerticalBar] b, FontSize -> 24]]

big

If you want this to be in StandardForm, you'd have to replace TraditionalForm by StandardForm everywhere above, and the result would look like this:

Style[a^2 \[NotVerticalBar] b, FontSize -> 24]

standard

Jens
  • 97,245
  • 7
  • 213
  • 499
  • This is not suitable for direct manual entry in WYSIWYG style, it's more like Kuba's approach... – Jens Jul 29 '13 at 23:32