9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] troff macro II
@ 2011-03-24 16:54 Rudolf Sykora
       [not found] ` <AANLkTin9Kh3O6qP-tw2VEUSiQsq+K97LXEsCgGOvcwHC@mail.gmail.com>
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Rudolf Sykora @ 2011-03-24 16:54 UTC (permalink / raw)


Hello 9fans,

since in the previous thread started by me ('troff macros for
typesetting books/longer texts') nobody touched my question about
producing wanted headings, I started experimenting, but so far has not
been quite successful.

Since text to appear in my headings is to mirror section names, like
'1.2', and a beginning of such a section appears somewhere lower on a
page---definitely below the page heading---, I must create a page
heading just after the very page is filled, i.e., as I feel, the
heading could actually be produced when the ms .BT macro (usually used
to typeset footings) is called. So I naively tried to redefine the .BT
macro, actually, by just appending 4 extra lines:

.de BT
.nr PX \\n(.s
.nr PF \\n(.f
.ft 1
.ps \\n(PS
'lt \\n(LTu
.po \\n(POu
.if \\n%>0 .tl \(ts\\*(LF\(ts\\*(CF\(ts\\*(RF\(ts
.ft \\n(PF
.ps \\n(PX
.\"  ABOVE IS THE ORIGINAL, BELOW MY APPENDIX
.mk
\v'|0.5i'
.tl 'a'b'c'
.rt
..

Please consider this just as an experiment (no point-size changes,...).
This for some reason doesn't work.
Since some of you probably have experience, could sb. tell what is wrong?

Thank you
Ruda



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [9fans] troff macro II
       [not found]   ` <AANLkTint2rqA6PxTGxaUa49DVaPD-Ocgpy8y4UEVG84z@mail.gmail.com>
@ 2011-03-24 17:36     ` Gregory Pavelcak
  2011-03-25 18:21       ` Rudolf Sykora
  0 siblings, 1 reply; 8+ messages in thread
From: Gregory Pavelcak @ 2011-03-24 17:36 UTC (permalink / raw)


Typing from phone so I'll be brief.

Just put the header at the bottom of the page and pipe the .ps output
through sed to change the vertical position.

I found this easier than moving back up the page in troff.

Greg

On Mar 24, 2011 12:56 PM, "Rudolf Sykora" <rudolf.sykora at gmail.com> wrote:

Hello 9fans,

since in the previous thread started by me ('troff macros for
typesetting books/longer texts') nobody touched my question about
producing wanted headings, I started experimenting, but so far has not
been quite successful.

Since text to appear in my headings is to mirror section names, like
'1.2', and a beginning of such a section appears somewhere lower on a
page---definitely below the page heading---, I must create a page
heading just after the very page is filled, i.e., as I feel, the
heading could actually be produced when the ms .BT macro (usually used
to typeset footings) is called. So I naively tried to redefine the .BT
macro, actually, by just appending 4 extra lines:

.de BT
.nr PX \\n(.s
.nr PF \\n(.f
.ft 1
.ps \\n(PS
'lt \\n(LTu
.po \\n(POu
.if \\n%>0 .tl \(ts\\*(LF\(ts\\*(CF\(ts\\*(RF\(ts
.ft \\n(PF
.ps \\n(PX
.\"  ABOVE IS THE ORIGINAL, BELOW MY APPENDIX
.mk
\v'|0.5i'
.tl 'a'b'c'
.rt
..

Please consider this just as an experiment (no point-size changes,...).
This for some reason doesn't work.
Since some of you probably have experience, could sb. tell what is wrong?

Thank you
Ruda
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.9fans.net/private/9fans/attachments/20110324/90fd9693/attachment.html>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [9fans] troff macro II
  2011-03-24 17:36     ` Gregory Pavelcak
@ 2011-03-25 18:21       ` Rudolf Sykora
  0 siblings, 0 replies; 8+ messages in thread
From: Rudolf Sykora @ 2011-03-25 18:21 UTC (permalink / raw)


> Just put the header at the bottom of the page and pipe the .ps output
> through sed to change the vertical position.

Ok. That's a 'dirty' solution, a hack. Though possible.
I am looking for a solution within troff, if possible.

Thanks anyway
Ruda



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [9fans] troff macro II
  2011-03-24 16:54 [9fans] troff macro II Rudolf Sykora
       [not found] ` <AANLkTin9Kh3O6qP-tw2VEUSiQsq+K97LXEsCgGOvcwHC@mail.gmail.com>
@ 2011-03-25 20:49 ` pmarin
  2011-03-25 21:52 ` pmarin
  2 siblings, 0 replies; 8+ messages in thread
From: pmarin @ 2011-03-25 20:49 UTC (permalink / raw)


Read carefully the section 9, 10 and 11 of "A TROFF Tutorial"[1]. I
think is exactly what you are looking for.

[1] http://www.kohala.com/start/troff/v7man/trofftut/trofftut.ps



On Thu, Mar 24, 2011 at 5:54 PM, Rudolf Sykora <rudolf.sykora at gmail.com> wrote:
> Hello 9fans,
>
> since in the previous thread started by me ('troff macros for
> typesetting books/longer texts') nobody touched my question about
> producing wanted headings, I started experimenting, but so far has not
> been quite successful.
>
> Since text to appear in my headings is to mirror section names, like
> '1.2', and a beginning of such a section appears somewhere lower on a
> page---definitely below the page heading---, I must create a page
> heading just after the very page is filled, i.e., as I feel, the
> heading could actually be produced when the ms .BT macro (usually used
> to typeset footings) is called. So I naively tried to redefine the .BT
> macro, actually, by just appending 4 extra lines:
>
> .de BT
> .nr PX \\n(.s
> .nr PF \\n(.f
> .ft 1
> .ps \\n(PS
> 'lt \\n(LTu
> .po \\n(POu
> .if \\n%>0 .tl \(ts\\*(LF\(ts\\*(CF\(ts\\*(RF\(ts
> .ft \\n(PF
> .ps \\n(PX
> .\" ?ABOVE IS THE ORIGINAL, BELOW MY APPENDIX
> .mk
> \v'|0.5i'
> .tl 'a'b'c'
> .rt
> ..
>
> Please consider this just as an experiment (no point-size changes,...).
> This for some reason doesn't work.
> Since some of you probably have experience, could sb. tell what is wrong?
>
> Thank you
> Ruda
>
>



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [9fans] troff macro II
  2011-03-24 16:54 [9fans] troff macro II Rudolf Sykora
       [not found] ` <AANLkTin9Kh3O6qP-tw2VEUSiQsq+K97LXEsCgGOvcwHC@mail.gmail.com>
  2011-03-25 20:49 ` pmarin
@ 2011-03-25 21:52 ` pmarin
  2011-03-26  0:10   ` Rudolf Sykora
  2 siblings, 1 reply; 8+ messages in thread
From: pmarin @ 2011-03-25 21:52 UTC (permalink / raw)


DONE!
Try the attached code. I am not using the ms macros. You will to
change the ms macros to get something similar.

troff test.ms | tr2post | psfonts > test.ps

Cheers.
pmarin


On Thu, Mar 24, 2011 at 5:54 PM, Rudolf Sykora <rudolf.sykora at gmail.com> wrote:
> Hello 9fans,
>
> since in the previous thread started by me ('troff macros for
> typesetting books/longer texts') nobody touched my question about
> producing wanted headings, I started experimenting, but so far has not
> been quite successful.
>
> Since text to appear in my headings is to mirror section names, like
> '1.2', and a beginning of such a section appears somewhere lower on a
> page---definitely below the page heading---, I must create a page
> heading just after the very page is filled, i.e., as I feel, the
> heading could actually be produced when the ms .BT macro (usually used
> to typeset footings) is called. So I naively tried to redefine the .BT
> macro, actually, by just appending 4 extra lines:
>
> .de BT
> .nr PX \\n(.s
> .nr PF \\n(.f
> .ft 1
> .ps \\n(PS
> 'lt \\n(LTu
> .po \\n(POu
> .if \\n%>0 .tl \(ts\\*(LF\(ts\\*(CF\(ts\\*(RF\(ts
> .ft \\n(PF
> .ps \\n(PX
> .\" ?ABOVE IS THE ORIGINAL, BELOW MY APPENDIX
> .mk
> \v'|0.5i'
> .tl 'a'b'c'
> .rt
> ..
>
> Please consider this just as an experiment (no point-size changes,...).
> This for some reason doesn't work.
> Since some of you probably have experience, could sb. tell what is wrong?
>
> Thank you
> Ruda
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.ms
Type: application/x-troff-ms
Size: 394 bytes
Desc: not available
URL: <http://mail.9fans.net/private/9fans/attachments/20110325/445f026b/attachment.ms>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [9fans] troff macro II
  2011-03-25 21:52 ` pmarin
@ 2011-03-26  0:10   ` Rudolf Sykora
  2011-03-26  1:02     ` pmarin
  0 siblings, 1 reply; 8+ messages in thread
From: Rudolf Sykora @ 2011-03-26  0:10 UTC (permalink / raw)


On 25 March 2011 22:52, pmarin <pmarin.mail at gmail.com> wrote:
> DONE!
> Try the attached code. I am not using the ms macros. You will to
> change the ms macros to get something similar.
>
> troff test.ms | tr2post | psfonts > test.ps
>
> Cheers.
> pmarin

Yes. This works. Actually, my problem has always only been: how to get
back to the top of a page; to have a correct string prepared to put
there has been easy for me. Note what I wrote in my 1st post of this
thread:
.
.\"  ABOVE IS THE ORIGINAL, BELOW MY APPENDIX
.mk
\v'|0.5i'
.tl 'a'b'c'
.rt
..

and it comes in a modified .BT macro (which is somewhat equivalent to
your .NP; ms actually sets [as far as I know] 3 traps on a page, 1 at
the top [.NP] and 2 at the bottom [.FO a .BT]). If I had written just
.
.\"  ABOVE IS THE ORIGINAL, BELOW MY APPENDIX
.tl '\v'-10.5i'a'b'c\v'+10.5i''
..

as you have, it would have basically done what I want. So now the
question is why
.tl '\v'-10.5i'a'b'c\v'+10.5i''
moves back and does the work, whilst
.mk
\v'|0.5i'
.tl 'a'b'c'
.rt
does not.
Nor does this, for instance:
\v'-10.5i'
.tl 'a'b'c'
\v'+10.5i'

Thanks for your help
Ruda



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [9fans] troff macro II
  2011-03-26  0:10   ` Rudolf Sykora
@ 2011-03-26  1:02     ` pmarin
  2011-03-26  1:14       ` pmarin
  0 siblings, 1 reply; 8+ messages in thread
From: pmarin @ 2011-03-26  1:02 UTC (permalink / raw)


Becouse "The backslash character \ is used to introduce troff commands
and special characters *within* a line of text" (from the Troff
tutorial)

Try:
.\"  ABOVE IS THE ORIGINAL, BELOW MY APPENDIX
.mk
.tl '\v'-10.5i'a'b'c\v'+10.5i''
.rt
..

On Sat, Mar 26, 2011 at 1:10 AM, Rudolf Sykora <rudolf.sykora at gmail.com> wrote:
> On 25 March 2011 22:52, pmarin <pmarin.mail at gmail.com> wrote:
>> DONE!
>> Try the attached code. I am not using the ms macros. You will to
>> change the ms macros to get something similar.
>>
>> troff test.ms | tr2post | psfonts > test.ps
>>
>> Cheers.
>> pmarin
>
> Yes. This works. Actually, my problem has always only been: how to get
> back to the top of a page; to have a correct string prepared to put
> there has been easy for me. Note what I wrote in my 1st post of this
> thread:
> .
> .\" ?ABOVE IS THE ORIGINAL, BELOW MY APPENDIX
> .mk
> \v'|0.5i'
> .tl 'a'b'c'
> .rt
> ..
>
> and it comes in a modified .BT macro (which is somewhat equivalent to
> your .NP; ms actually sets [as far as I know] 3 traps on a page, 1 at
> the top [.NP] and 2 at the bottom [.FO a .BT]). If I had written just
> .
> .\" ?ABOVE IS THE ORIGINAL, BELOW MY APPENDIX
> .tl '\v'-10.5i'a'b'c\v'+10.5i''
> ..
>
> as you have, it would have basically done what I want. So now the
> question is why
> .tl '\v'-10.5i'a'b'c\v'+10.5i''
> moves back and does the work, whilst
> .mk
> \v'|0.5i'
> .tl 'a'b'c'
> .rt
> does not.
> Nor does this, for instance:
> \v'-10.5i'
> .tl 'a'b'c'
> \v'+10.5i'
>
> Thanks for your help
> Ruda
>
>



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [9fans] troff macro II
  2011-03-26  1:02     ` pmarin
@ 2011-03-26  1:14       ` pmarin
  0 siblings, 0 replies; 8+ messages in thread
From: pmarin @ 2011-03-26  1:14 UTC (permalink / raw)


Also to pay attention to the command .wh  in my example:

.wh -1i NP \" When you reach the final of the page less 1 inch call
the command .NP

On Sat, Mar 26, 2011 at 2:02 AM, pmarin <pmarin.mail at gmail.com> wrote:
> Becouse "The backslash character \ is used to introduce troff commands
> and special characters *within* a line of text" (from the Troff
> tutorial)
>
> Try:
> .\" ?ABOVE IS THE ORIGINAL, BELOW MY APPENDIX
> .mk
> .tl '\v'-10.5i'a'b'c\v'+10.5i''
> .rt
> ..
>
> On Sat, Mar 26, 2011 at 1:10 AM, Rudolf Sykora <rudolf.sykora at gmail.com> wrote:
>> On 25 March 2011 22:52, pmarin <pmarin.mail at gmail.com> wrote:
>>> DONE!
>>> Try the attached code. I am not using the ms macros. You will to
>>> change the ms macros to get something similar.
>>>
>>> troff test.ms | tr2post | psfonts > test.ps
>>>
>>> Cheers.
>>> pmarin
>>
>> Yes. This works. Actually, my problem has always only been: how to get
>> back to the top of a page; to have a correct string prepared to put
>> there has been easy for me. Note what I wrote in my 1st post of this
>> thread:
>> .
>> .\" ?ABOVE IS THE ORIGINAL, BELOW MY APPENDIX
>> .mk
>> \v'|0.5i'
>> .tl 'a'b'c'
>> .rt
>> ..
>>
>> and it comes in a modified .BT macro (which is somewhat equivalent to
>> your .NP; ms actually sets [as far as I know] 3 traps on a page, 1 at
>> the top [.NP] and 2 at the bottom [.FO a .BT]). If I had written just
>> .
>> .\" ?ABOVE IS THE ORIGINAL, BELOW MY APPENDIX
>> .tl '\v'-10.5i'a'b'c\v'+10.5i''
>> ..
>>
>> as you have, it would have basically done what I want. So now the
>> question is why
>> .tl '\v'-10.5i'a'b'c\v'+10.5i''
>> moves back and does the work, whilst
>> .mk
>> \v'|0.5i'
>> .tl 'a'b'c'
>> .rt
>> does not.
>> Nor does this, for instance:
>> \v'-10.5i'
>> .tl 'a'b'c'
>> \v'+10.5i'
>>
>> Thanks for your help
>> Ruda
>>
>>
>



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-03-26  1:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-24 16:54 [9fans] troff macro II Rudolf Sykora
     [not found] ` <AANLkTin9Kh3O6qP-tw2VEUSiQsq+K97LXEsCgGOvcwHC@mail.gmail.com>
     [not found]   ` <AANLkTint2rqA6PxTGxaUa49DVaPD-Ocgpy8y4UEVG84z@mail.gmail.com>
2011-03-24 17:36     ` Gregory Pavelcak
2011-03-25 18:21       ` Rudolf Sykora
2011-03-25 20:49 ` pmarin
2011-03-25 21:52 ` pmarin
2011-03-26  0:10   ` Rudolf Sykora
2011-03-26  1:02     ` pmarin
2011-03-26  1:14       ` pmarin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).