3
$\begingroup$

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?

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

1 Answer 1

5
$\begingroup$

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

enter image description here

$\endgroup$
1
  • $\begingroup$ Thanks, that works like a charm. $\endgroup$ Commented Apr 22, 2016 at 20:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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