[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help with a macro
From: |
Valeriy E. Ushakov |
Subject: |
Re: Help with a macro |
Date: |
Fri, 5 May 1995 18:25:06 +0400 (MSD) |
On Tue, 2 May 1995 address@hidden wrote to the list:
> What follows is a definition I use to create a title on documents. The
> intent is something like
>
> =============
> This is Title
>
> name
> date
> ------
>
> Where the top horizontal line is as long as the title text, the bottom is
> half that. What I have lays things out properly, but does not adapt to
> the width of the text.
>
> Does anyone have any magic to make it do so? Or am I hoping for something
> beyond the scope of Lout?
[definition skipped]
> Another interesting variant on this would be to center everything line
> by line even if the right parameter t requires more than one line. Again
> the HLine lengths should be adaptable...
>
> Thanks,
> Ed
def @MakeTitle
named topthickness { 1.50 pt }
named botthickness { 0.75 pt }
named author {}
named date { @Date @Format { @Month @DayNum, @Year } }
right title
{
# First come the helpers
# This one is blindly copied from `dl'
def @LWidth
left lw
{
lw @Case {
"" @Yield ""
else @Yield { lw "setlinewidth" }
}
}
# This is a more elaborated variant of @HLine
def @HRule
named linewidth {}
named from { 0 }
named to { 1 }
{
{
"xsize" from "mul 0 moveto"
"xsize" to "mul 0"
linewidth @LWidth "lineto stroke"
}
@Graphic {}
}
# The following code answers your original request
address@hidden {
# @HRule linewidth { topthickness }
# //0.50v title
# //1.00v author
# //0.25v date
# //0.50v @HRule from { 0.25 } to { 0.75 }
# linewidth { botthickness }
#}
# This code address your request for centering
@Center @HContract {
@HRule linewidth { topthickness }
//0.50v clines @Break title
//1.00v clines @Break author
//0.25v clines @Break date
//0.50v @HRule from { 0.25 } to { 0.75 }
linewidth { botthickness }
}
}
So to try, put this into `mydefs' file and format smth like this:
@SysInclude { doc }
@Doc @Text @Begin
@MakeTitle author {A.U.Thor}
{
Sample Title
That Goes Several Lines Long Long Long
With Paragraph Breaking etc etc etc
Oh! How Bored am I to Type This in.
}
@End @Text
Hope it helps.
Best regards!
SY, Uwe.
--------
Valeriy E. Ushakov (aka Uwe) | Zu Grunde kommen
address@hidden | Ist zu Grunde gehen