Skip to main content
2 of 5
deleted 1 character in body
Szabolcs
  • 236.5k
  • 31
  • 641
  • 1.3k

Try setting TextPadding -> True. It does more or less the same as the builtin ContentPadding. It is described in SciDrawGuide.pdf.

Example:

<< SciDraw`

labelFun[x_, _] := 
  Module[{frac = Rationalize[x/Pi] Pi, num, den},
    num = Numerator[frac];
    den = Denominator[frac];
    If[den == 1,
      num,
      StringForm["``/``", num, den]
    ]
  ]

Figure[
 FigurePanel[{FigGraphics@Plot[Cos[ωt]^2, {ωt, 0, 2 π}];}, 
  XPlotRange -> {0, 2 π}, 
  XTicks -> LinTicks[-2 Pi, 2 Pi, Pi/2, 4, TickLabelFunction -> labelFun],
  TextPadding -> True,
  XExtendRange -> 0.02, YExtendRange -> 0.04
  ],
 CanvasSize -> {5, 3}]

I'm not sure what the best way is to get correct spacing around the / sign, but the following works: replace the string in StringForm with "\!\(TraditionalForm\```/``\)". This is a string representation of boxes. I obtained it by writing a single character into a string, selecting it, then pressing Command-Shift-T to convert it to TraditionalForm. This created a traditional form environment within the string. Then I deleted the character and typed what I wanted instead.

enter image description here

Szabolcs
  • 236.5k
  • 31
  • 641
  • 1.3k