# Ticks length in FrameTicks not correct

I need ticks with equal lenghts to the outside (plen) and to the inside (mlen) of the frame of a plot. I have:

plen=0.0015;
mlen=0.0015;
xTicks = Table[{i, i, {plen, mlen}}, {i, 0, 4, 0.2}];


and I am using Frame -> {{True, False}, {False, True}}, FrameTicks -> {xTicks, Automatic}.

The problem is, the ticks in the resulting image, as seen after exporting to pdf and zoomed in, do not have the same lenght in both directions.

This works if I use Ticks instead, or if the value is changed to 0.003 or above, but I need to use a frame, as I don't know how to force the ticks labels out of the frame by using Ticks, and I need them to be less than 0.003, as I want to distinguish them from other ticks (placed elsewhere) which are about the same lenght.

EDIT: Example code:

Export["amazingplot.pdf",
Plot[x^2, {x, 0, 4}, Frame -> {{True, False}, {False, True}},
FrameTicks -> {xTicks, Automatic}, ImageSize -> 1000]]

• This seems OK in Mathematica 10.1 under Windows. What version/platform are you using? Jun 5, 2020 at 21:31
• @Mr.Wizard: I am using Mathematica 12 under Windows 10. Meanwhile, I played around a bit and found out that using Union[Table[{i, , {0, 0.0015}}, {i, 0, 4, 0.02}], Table[{i, , {0, -0.0015}}, {i, 0, 4, 0.02}]] (essentially adding out and in ticks separately) seems to work. Jun 5, 2020 at 21:37
• In MMA 12.0 on Win10-64 I get shorter outward ticks when I use your lengths (which, by the way, is TINY). If I use longer ticks, e.g. plen = mlen = 0.005, then everything seems to work. So, at your size, I can reproduce the problem, but at a longer length it goes away. So it's some awful tricky corner case perhaps in the conversion to PDF. What about other formats (e.g. raster PNG vs. vector SVG)? Jun 5, 2020 at 21:38
• @MarcoB: I'll try. In the meanwhile, I found a workaround, so I'd say it is not a PDF issue. EDIT: Confirmed, it's not. Jun 5, 2020 at 21:40
• @xihiro What's the workaround? You might want to put it in a self-answer to this question for others in the future. Jun 5, 2020 at 21:41

outxTicks = Table[{i, i, {0,  0.0015}}, {i, 0, 4, 0.02}];