## Re: [xsl] Need Math Help: How to Convert Proportional Column Widths to Real Values?

 Subject: Re: [xsl] Need Math Help: How to Convert Proportional Column Widths to Real Values? From: Graydon Date: Fri, 7 Mar 2014 19:08:36 -0500
```On Fri, Mar 07, 2014 at 05:51:10PM -0600, Eliot Kimber scripsit:
> I'm converting CALS tables into InDesign tables where I need to specify
> actual measurements. I know the width available to all the proportional
> columns and I know the CALS proportional values, e.g. "1*", "1.38*", etc.
>
> My puzzle is, how do I go from 1.38 to the correct fraction of the
> available width?
>
> For example, say that I have two proportional columns of width "1*" and
> "1.39*" and the available width is 240pt.
>
> How do I determine fraction of 240 each of these proportions get?

Proportional works by "shares", so "2*" is twice as large as "1*".

You need to total the proportional widths (carefully expunging the *
before asking XSLT to do math on the values!) to get the total number of
shares, divide that into the available width in points to get a single
share in points, and then start multiplying the proportional width
values by that single-share size to get the final sizes.

This sort of thing often gets fraught because of rounding, you're not
necessarily going to get the full 240 pts of available width.

In this specific case, it's

shareSize = 240/(1 + 1.39) ~= 100.42

So    1* = 1 x \$shareSize = 100.42

1.39* = 1.39 x \$shareSize ~= 139.58

So with rounding you would get 240pts this time.

-- Graydon

```