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], 
    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?

  • $\begingroup$ I heavily suspect this might be OS dependent. Also what version of Mathematica are you using? $\endgroup$ – chuy Apr 22 '16 at 18:45
  • $\begingroup$ This is v10.4.0 on Ubuntu 15.10. I don't have access to any other OSs, though. $\endgroup$ – Emilio Pisanty Apr 22 '16 at 18:57
  • $\begingroup$ On Windows (with M- 10.4) the arrow is blunted in the front end $\endgroup$ – chuy Apr 22 '16 at 19:03
  • $\begingroup$ @chuy Thanks. That probably means I'm banking on buggy behaviour, then =|. $\endgroup$ – Emilio Pisanty Apr 22 '16 at 19:08
  • $\begingroup$ 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. $\endgroup$ – 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[{
   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

enter image description here

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.