Skip to main content
1 of 5
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[\[Omega]t]^2, {\[Omega]t, -0.3, 2 \[Pi] + 0.3}]];}, 
  XPlotRange -> {-0.3, 2 \[Pi] + 0.3}, 
  XTicks -> 
   LinTicks[-2 Pi, 2 Pi, Pi/2, 4, TickLabelFunction -> labelFun],
  TextPadding -> True
  ],
 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