# Exporting sharp corners in Bézier curves to pdf

I'm a bit baffled by this. I have a number of arrows in a series of diagrams, and I'm defining the arrowheads using Bézier curves such as

test =  Graphics[{AbsoluteThickness[8],
BezierCurve[
3 {{-1, -0.5}, {-0.7, -0.2}, {-0.3, -0.07}, {0, 0}, {-0.3,
0.07}, {-0.7, 0.2}, {-1, 0.5}}]},
PlotRange -> {{-4, 1}, {-2, 2}}, ImageSize -> 200]


I would then like to export these diagrams, ideally to pdf since the display will be large and I want a vector version to use with pdflatex. However, exporting to pdf results in a blunt arrow:

Export["~/Desktop/test.pdf", test]


This is surprising because (i) the front end displays this with a sharp kink, and (ii) exporting to png does the same.

Export["~/Desktop/test.png", test]


Is there a way to get a sharp kink when exporting to pdf?

• I heavily suspect this might be OS dependent. Also what version of Mathematica are you using? – chuy Apr 22 '16 at 18:45
• This is v10.4.0 on Ubuntu 15.10. I don't have access to any other OSs, though. – Emilio Pisanty Apr 22 '16 at 18:57
• On Windows (with M- 10.4) the arrow is blunted in the front end – chuy Apr 22 '16 at 19:03
• @chuy Thanks. That probably means I'm banking on buggy behaviour, then =|. – Emilio Pisanty Apr 22 '16 at 19:08
• my thinking is the blunt end is the mathematically correct form. To achieve that corner in eps/pdf you need to render two separate curves that are joined so that the behavior is controlled by linejoin . Sorry I don't know off hand how to do that from within mathematica. – george2079 Apr 22 '16 at 20:20

On MMA 10.3 on OSX 10.10.5 I get the same behaviour as @chuy - blunt on the front end and both export formats.

I think the implementation is kind of buggy as one might expect the option JoinForm -> "Miter" to solve the problem, however it changes nothing.

However, using the additional option JoinForm -> {"Miter",d} does create the desired behaviour for sufficiently high d (which curiously can't be inf...):

test = Graphics[{
AbsoluteThickness[8],
JoinForm[{"Miter", 100}],
BezierCurve[3 {{-1, -0.5}, {-0.7, -0.2}, {-0.3, -0.07}, {0, 0}, {-0.3, 0.07}, {-0.7, 0.2}, {-1, 0.5}}]
}, PlotRange -> {{-4, 1}, {-2, 2}}, ImageSize -> 200]


Give for the front-end, PDF, and PNG

• Thanks, that works like a charm. – Emilio Pisanty Apr 22 '16 at 20:45