Alignment Problem

Cptn

New member
Joined
Sep 11, 2012
Messages
5
My apologies if this is the incorrect place for this post.


I have 2 variables. We can call them;
Total_Width()
Block_Width()


In the following example there are 5 "Blocks." (A,B,C,D,E)
Total_Width() is the width from X through Z.
Block_Width() is the width of any single Block. All Blocks share the same Block_Width().
The left of Block A must remain affixed to X. The right of Block E must remain affixed to Z.


XA B C D EZ


I need some guidance on an equation for positioning B, C, and D, that would keep equal spacing between the Blocks.
Let me know if I've made no sense whatsoever. I appreciate any help.
 
Hello, Cptn!

I hope I understand the problem.


I have 2 variables.
We can call them: Total Width and Block Width.

In the following example there are 5 "Blocks." (A,B,C,D,E)
Total Width is the width from X to Z.
Block Width is the width of any single Block; all Blocks have the same width.
The left of Block A must remain affixed to X.
The right of Block E must remain affixed to Z.

XA B C D EZ

Position B, C, and D to keep equal spacing between the Blocks.

I assume that \(\displaystyle X\) and \(\displaystyle Z\) are not blocks and have no widths.
They are simply "bookends", flanking the blocks.
Hence, "Total Width" is the distance between \(\displaystyle X\) and \(\displaystyle Z.\)

So we have: .\(\displaystyle \bullet\underbrace{A \,\_\,B\,\_\,C\,\_\,D\,\_\,E}_{Total\;Width} \bullet \)

The space between the blocks is: .\(\displaystyle \dfrac{\text{(Total Width)} - 5\!\times\!\text{(Block Width)}}{4}\)
 
Hello soroban. Thank you for the help. I appreciate it.

Your assumption regarding X and Z was correct.

What I need is the equation for the starting position of (A,B,C,D,E).

Using your equation for calculating the width of the spaces, I come up with this:

A=0
B=Block_Width + ((Total_Width - (5 x Block_Width)) / 4)
C=(2 x Block_Width) + (2 x ((Total_Width - (5 x Block_Width)) / 4))
D=(3 x Block_Width) + (3 x ((Total_Width - (5 x Block_Width)) / 4))
E=Total_Width - Block_Width

Sorry for the linear formatting.

Is this the simplest way of finding the values I need?
 
Top