groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Groff] Re: A TeX like paragraph formatter: I managed it; try it !!! [bu


From: Thomas Baruchel
Subject: [Groff] Re: A TeX like paragraph formatter: I managed it; try it !!! [bug fixed]
Date: Mon, 14 May 2001 19:35:46 +0200
User-agent: Mutt/1.2.5i

Two things.
I was asked why the two versions had exactly the same output. This was because
I tried it with french hyphenation. With english one, this had no effect
because the paragraph was formatted differently.
Anyway, there was a huge bug in the word-counter, which is now fixed
(the .fl requests were forgotten ;-)
Now, it should work. I formatted this piece without the french hyphenation.
Everybody should have the same output. I chose a small width, because
it is often when you write in a multi-columns document that you can see
differences.
===================================================================
.cp \" ### DEBUG
.po 72p \" ### DEBUG
.nr ^n 9999  \" Infinity spape
.nr ^a 21c   \" Maximum width of a word
.nr ^s 12    \" Normal space size defined with .ss
.nr ^v 4     \" Verbose level
.nr ^i 12p   \" First line indentation
.nr ^p 12    \" Point size of characters
.nr ^l 451p  \" Line length
.nr ^B 4500u \" maximum non-ugly space size ### mettre davantage après déboguage
.nr ^k 10    \" very ugly line factor
.\"
.\"
.\"
.de ^1
.if \\n(^v .tm Processing paragraph declared at line \\n(.c
.ss \\n(^s
.ps \\n(^p
.nr /0 \\w' '
.ds ~ \\h'\\n(/0u'
.na
.di ^x
.ss \\n(^n
.ll \\n(^au
.in 0u
.ti \\n(^iu
..
.de ^2
.br
.di
.rm ~
.ss \\n(^s
.ll \\n(^lu
.in 0u
.ti 0u
.nr /0 0
.nr ^z 0 \" forcer l'écriture de ^R (tableau des valeurs de .ss +1)
.nr ^b 0 \" badness
.nr ^K 0 \" best badness
.nr ^T 0 \" best badness line
.nr ^M \\w' '/\\n(^s \" multiplicateur pour l'espace
\\.de ^R \" registers array
\\..
.di ^y
.dt \\n(.du+1u ^S
.nr ^W -1
.nr ^D 0
.it 1 ^L
.^x
.it
.dt
.br
.if \\n(^v>2 \{\
.  tm | standard disposition has \\n(^D justified lines
.  tm | standard disposition has a badness of \\n(^b
.\}
.di
.fl
.if \\n(^D<2 .nr ^b 0 \" forcer l'impression d'un paragraphe d'une ligne just.
.ie \\n(^b \{\
.  nr ^K \\n(^b
.  ^F 1 \\n(^D
.  if \\n(^z \{\
.    nr ^z \\n(^T \" donne à ^z le numéro de la ligne à affecter
.    di ^y
.    ss \\n(^s
.    ad b
.    dt \\n(.du+1u ^S
.    nr ^W -1
.    nr ^D 0
.    if \\n(^z=1 \{\
.      ^R 1
.      ss \\n(^w
.      rr ^w
.    \}
.    it 1 ^L
.    ^x
.    it
.    dt
.    br
.    di
.    fl
.    ^y \}
.  el \{\
.    ad b
.    ^x
.  \}
.  if \\n(^v=1 .if \\n(^b .tm | badness is \\n(^b
.  if \\n(^v=2 .if \\n(^b=0 .tm | the badness has been removed
.br \" ###
\fI(obtenu avec mes macros)\fR
.br
.sp 24p \" ###
Standard disposition would be :\" ###
.br \" ###
.^x \" ###
.\}
.el \{\
.  ad b
.  ^x
.\}
.rr /0
.rr /1
.rr /2
.rr /3
.rr ^D
.rr ^K
.rr ^M
.\"rm ^R ###
.rm ^T
.rr ^W
.rr ^b
.rr ^z
.rm ^y
.rm ^x
..
.de ^F
.if \\n(^v>3 .tm | altering line \\$1
.nr ^z \\$1 \" ligne à altérer avec .ss
.nr /3 \\$1+1
.nr ^b 0
.di ^y
.ss \\n(^s
.dt \\n(.du+1u ^S
.nr ^W -1
.nr ^D 0
.if \\$1=1 \{\
.  ^R 1
.  ss \\n(^w
.  rr ^w
.\}
.it 1 ^L
.^x
.it
.dt
.br
.di
.fl
.if \\n(^b<\\n(^K \{\
.  nr ^K \\n(^b
.  nr ^T \\$1
.  if \\n(^v>2 .tm | found a disposition with a badness of \\n(^b
.\}
.if \\n(/3<\\$2 .^F \\n(/3 \\$2
..
.de ^L
.nr ^W +1
.nr /1 \\n(/0 \" this line and the next one allow detection of hyphenation in
.nr /0 \\n(.k \" the diversion macro ^S
.it 1 ^L
..
.de ^S
.nr ^D +1
.\"nr /2 \\n(/4*\\n(^M+\\n(.n-\\n(/1 \" /2 > 0 if last line is hyphenated
.nr /2 \\w'\\ '+\\n(.n-\\n(/1 \" /2 > 0 if last line is hyphenated
.nr ^W -1
.if \\n(/2 .nr ^W +1
.ie \\n(^W \{\
.  \" one space or more
.  nr ^Z \\n(^W*\\w'\\ ' \" extra-space
.  nr ^Z +\\n(.l-\\n(.n       \" standard space
.  nr ^Z \\n(^Z/\\n(^W        \" divided by number of spaces
.  if \\n(^Z>\\n(^B .nr ^b +\\n(^Z-\\n(^B
.  nr /2 \\n(^Z/\\n(^M+2
.  \"tm | ### DEBUG : Line \\n(^D has \\n(^W stretchable spaces (width = 
\\n(^Z, \\n(/2)
.\}
.el \{\
.  \" one word, no space
.  nr /2 \\n(.l-\\n(.n
.  nr /2 \\n(/2*\\n(^k \" very ugly line factor
.  nr ^b +\\n(/2
.  if \\n(.l-\\n(.n .tm Line \\n(^D is very ugly (only one word)
.  nr /2 \\n(^s
.\}
.if !\\n(^z \{\
.am ^R \" usage: .^R 4 will put in ^w the .ss value which will be bigger
\\.if \\\\$1=\\n(^D \\.nr ^w \\n(/2
\\..
.\}
.\"nr /4 \\n(^s
.ie \\n(^z=(\\n(^D+1) \{\
.  ^R \\n(^z \" met dans ^w la valeur de .ss qui fait tout basculer
.  ss \\n(^w
.  \"nr /4 \\n(^w
.  rr ^w
.\}
.el .ss \\n(^s
.nr ^W 0
.dt \\n(.du+1u ^S
.\"if \\n(^K .if \\n(^b>\\n(^K .dt \" ### make quicker ???
.rr ^Z
..
.\"
.\"
.\"
\fB\s16Comparaison de deux formattages d'un même paragraphe\fR\s12
.br
.sp 18p
.nr ^l 6c
.ll 6c
.^1
On peut ce me semble, avec meilleure raison distinguer l'amour, par l'estime 
qu'on fait de ce qu'on aime à comparaison de soi-même. Car lorsqu'on estime 
l'objet de son amour moins que soi, on n'a pour lui qu'une simple affection\|; 
lorsqu'on l'estime à l'égal de soi, cela se nomme amitié et lorsqu'on l'estime 
davantage, la passion qu'on a peut être nommée dévotion. Ainsi on peut avoir de 
l'affection pour une fleur, pour un oiseau, pour un cheval\|; mais, à moins que 
d'avoir l'esprit fort déréglé, on ne peut avoir de l'amitié que pour des hommes.
.^2

reply via email to

[Prev in Thread] Current Thread [Next in Thread]