[texhax] Vertical leaders alignment / Actual line width
lilliantadros at hotmail.com
lilliantadros at hotmail.com
Mon Sep 8 16:19:29 CEST 2008
in case anyone's interested, I found a solution, though admittedly imperfect:
In essence, I calculate the TOTAL line width, if all the title were to be put on one line, then keep subtracting the MAXIMUM line width allowed, till I end up with a sort of "mod" line width for the last line. The only problem with this approach is that it doesn't take the actual WORDS into account, so it assumes Latex will just break the line at any point, which isn't the point of course. This way, the width calculated for the last line will always be <= the line width Latex will end up giving us. Still it gives a good estimate, and I just added some fixed extra width to the line to account for that. Here's the code:
%save chapter title in a box, all on one line
%maximum allowed width
%actual width of the chapter title, possibly longer than the maximum allowed width
%keep subtracting the width of one line from the chapter title, until left with the width of the last line
%the width of the bottom rule is the maximum width minus the width of the last line of the chapter title
%extra space, because last line width will always be larger than total text width %(number of lines - 1)
%now set the title in a parbox of width=maximum width
Hope this helps someone somewhere!
Hi, I'm trying to format chapter titles in a frame, where the title text is aligned bottom-right, and where the bottom line of the frame is vertically aligned with the baseline (thus the title text) and also ends right before the text startes, so it looks something like this:
If anyone is familiar with the "Glenn" style in the fncychap package, this looks basically the same...
Anyway, I got up to that point, the trouble is when the text of the chapter title doesn't fit on one line. Ideally, I would want it to look like this:
| A very long chapter|
| title which spans|
I got as far as putting it (right-aligned) in a parbox, and adjusting the vertical lengths. The trouble is with the bottom horizonal line: I give the maximum length for par-width, so doing it with rule+hfill+parbox like with single lines results in a zero-length rule, because the parbox takes up all the width. I checked out the pbox package, but it doesn't give me the width of the last line which is the one I'm interested in, and which is mostly the shortest.
I have several thoughts but I'm not exactly sure whether they make sense or how to implement them:
- If I could only find out the actual width of the last line, I could manually set the width of the bottom rule. But, like I said, pbox didn't calculate that.
- One could integrate the bottom line INSIDE the parbox, like with leaders or something. It's the closest I got, but then it's aligned with the first par line of course. Is there a way to indicate the vertical alignment of the leaders, so I could say it should point to the bottom line?
- One idea is to manually separate the lines of the parbox, but I'm not sure how, and is prob way difficult and not very clean...
- I tried setting the parbox first, vskipping and hskipping back to where the bottom line should start, and then rule+fill, but of course it then ignores the parbox altogether and goes the whole textwidth (right acros the bottom line).
- I thought maybe a white hrule or underline or something in the bottom of the parbox (are white chars processed at all or just ignored? Not even sure...) to overwrite the bottom rule where the bottom text is ("several lines"), but again not sure how...
ANY ideas are appreciated!!
Thanks in advance.
Stay up to date on your PC, the Web, and your mobile phone with Windows Live.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the texhax