1

I also posted the following as a diagrams-doc issue, but I thought it might be more appropriate here.

The user manual says this:

One situation in which output units can be particularly useful is when preparing a document (paper, blog post, etc.) with multiple embedded diagrams of various physical sizes. Using the same output value for the line width (or arrowhead length, arrow gap, font size, etc.) of every diagram ensures that the diagrams will all look consistent.

This is exactly what I'd like to do. I am making a webpage with multiple diagrams-generated svg files of different sizes inline, and I'd like the line widths, arrowhead sizes, and circle radii to be consistent. But I'm not sure how. How would I pass the same output value to all the arrows, arrowheads, circles, etc.? And when I ultimately render with renderPretty, what would I set size to in the SVGOptions argument so that it just makes the svg whatever size its contents are?

Joshua Meyers
  • 619
  • 1
  • 8
  • 17

1 Answers1

0

I finally managed to figure this out.

I had some arrows: for these I used the arrowOpts:

(with & arrowHead .~ myTri
      & arrowTail .~ lineTail
      & lengths .~ output 15
      & arrowShaft .~ idShaft offset
      & shaftStyle %~ lwO 1)

For SVG rendering I used renderPretty' outFile svgOpt diagram with

svgOpt :: Num n => Options SVG V2 n
svgOpt = SVGOptions {
  _size = absolute,
  _idPrefix = empty,
  _svgDefinitions = Nothing,
  _svgAttributes = [],
  _generateDoctype = False
}

The crucial part is setting _size = absolute, which causes the resulting svg to not be scaled at all.

I'm still trying to track down the other measurements that aren't output yet.

Joshua Meyers
  • 619
  • 1
  • 8
  • 17