# LaTeX typeset for the frame ticks

Following this site, I inserted a LaTeX type set for the frame ticks. Following is the sample code.

Plot[
Sin[x], {x, 0, \[Pi]},
Frame -> True, FrameStyle -> Directive[Black],
FrameTicks ->
{
{{-1, -0.5, 0, -0, 0.5, 1}, None},
{With[{ticks = Pi/4 Range[0, 4]}, Thread[{ticks, MaTeX[ticks, "DisplayStyle" -> False]}]], None}
},
Axes -> {False, False},
PlotRange -> {{0.0, \[Pi]}, {-1, 1}},
AxesLabel -> {x, "E"}, LabelStyle -> {GrayLevel[0]}
]


Below is the obtained plot:

How to change the size of the x-axis frame tick labels and make them bold?

• Why do you need LaTex for this? Just do FrameTicks -> {{Automatic, None}, {Range[0, Pi, Pi/4], None}} May 18, 2023 at 21:24
• @rhomboidRhipper OP had question before on doing this using Mathematica without Latex. He must wanted now to do the same using Latex in Mathematica. May 18, 2023 at 22:38

How to change the size of the x-axis frame tick labels and make them bold?

## Code

<< MaTeX
myNiceBigTicks =
With[{ticks = Pi/4 Range[0, 4]},
{#, MaTeX["\\boldsymbol{" <> ToString@TeXForm[#] <> "}",
"DisplayStyle" -> False, Magnification -> 2]} & /@ ticks];

Plot[Sin[x], {x, 0, Pi},
Frame -> True,
FrameStyle -> Directive[Black],
FrameTicks ->
{
{{-1, -0.5, 0, -0, 0.5, 1}, None},
{myNiceBigTicks, None}
},
Axes -> {False, False}, PlotRange -> {{0.0, Pi}, {-1, 1}},
AxesLabel -> {x, "E"}, LabelStyle -> {GrayLevel[0]}
]


Is it also possible to bold the y-axis numbers together with x- axis?

The same thing can be done:

<< MaTeX
myX = With[{ticks =
Pi/4 Range[0, 4]}, {#,
MaTeX["\\boldsymbol{" <> ToString@TeXForm[#] <> "}",
"DisplayStyle" -> False, Magnification -> 1.5]} & /@ ticks];
myY = With[{ticks =
Range[-1, 1, 1/2]}, {#,
MaTeX["\\boldsymbol{" <> ToString@TeXForm[#] <> "}",
"DisplayStyle" -> False, Magnification -> 1.5]} & /@ ticks];

Plot[Sin[x], {x, 0, Pi}, Frame -> True,
FrameStyle -> Directive[Black], GridLines -> Automatic,
GridLinesStyle -> LightGray, PlotStyle -> Red,
FrameTicks -> {{myY, None}, {myX, None}}, Axes -> {False, False},
PlotRange -> {{0.0, Pi}, {-1, 1}}, AxesLabel -> {x, "E"},
LabelStyle -> {GrayLevel[0]}]


Notice, this is not automated and need to manually give the range each time. Also Mathematica writes 1. as 1 for labels and 1/2 as 0.5. If you want the same you can add more code to do this. This is left as an exercise. The problem is that using Range[-1,1,.5] will produce {-1., -0.5, 0., 0.5, 1.} and not {-1, -0.5, 0, 0.5, 1} like mathematica does. So just need special formatting added, that is why I used Range[-1, 1, 1/2] instead.

• Thanks! Is it also possible to bold the y-axis numbers together with x- axis? May 19, 2023 at 0:49
• @Rakesh fyi, updated. May 19, 2023 at 2:01
• For the y-axis, I want to use Mathematica font. If I use "FrameTicksStyle -> Directive[Bold, 9, Black, Thickness[.003]]", it doesn't look uniform in color for both the x-axis and y-axis. Is there a way, to make y-axis numbers bold with mathematical font? May 19, 2023 at 2:50
• As mentioned above, if I use "FrameTicksStyle -> Directive[Bold, 9, Black, Thickness[.003]]", some tick lines become thick and some become slightly thicker. May 19, 2023 at 2:52
• @Rakesh it is not good idea to use Latex for one axis and Mathematica for another. They will not look same. MaTeX uses pdflatex to compile, and that uses the Computer Modern typeface family by default. You have to decide, either use Latex for ticks labels on everything, or use Mathematica's own typesetting. I think you asked in another question about using Mathematica for this. Anyway, I do not think I can help more I am afraid on this. good luck. May 19, 2023 at 4:56