groff
[Top][All Lists]
Advanced

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

[Groff] TeX-like line breaking: bugs fixed. Just need a good algo ;-)


From: Thomas Baruchel
Subject: [Groff] TeX-like line breaking: bugs fixed. Just need a good algo ;-)
Date: Sun, 11 Mar 2001 14:29:29 +0100
User-agent: Mutt/1.2.5i

Hi, just fixed the bugs. Try to compile that (the compilation-time infos) can
be disable by setting the verbose level register Vl to 0.
.\" ***********************************
.\" * Macro PP: début d'un paragraphe *
.\" ***********************************
.\"
.\" Registres modifiables par l'utilisateur :
.\" =========================================
.ds     Ns R     \" style normal (roman)
.nr     PI 12p   \" indentation par défaut
.nr     Pi 1     \" par défaut: indentation de tous les paragraphes
.nr     PD 4p    \" espace précédant un paragraphe
.nr     PS 12    \" taille par défaut des caractères
.nr     VS 14.5p \" hauteur d'une ligne
.nr     PO 72p   \" page offset
.nr     LL 452p  \" line length
.nr     QI 0u    \" indentation pour les citations
.nr     QS 11    \" taille des caractères dans les citations
.nr     Qv 12.5p \" hauteur d'une ligne dans les citations
.ds     Qs I     \" style des indentations
.nr     QM 24p   \" marge des citations
.nr     Q1 6p    \" espace avant une citation (à la place de PD)
.nr     Q2 2p    \" espace après une citation (en plus du PD suivant éventuel)
.nr     Vl 0     \" verbose level
.\"
.\" Registres en lecture seule
.\" ==========================
.nr     Pn 0 \" par défaut: aucun nombre de lignes
.\"
.\" Registres internes
.\" ==================
.nr     Pz 0 \" par défaut: aucun paragraphe n'est ouvert
.\"
.\" Définition des macros
.\" =====================
.de PP
.if \\n(Pz \{ .br \" si un paragraphe est ouvert :
.    di PX \" PX est une diversion de travail
.    ad l  \" justification à gauche
.    dt \\n(.du+\\n(P7u P1
.    P0
.    br
.    di
.    \" Affichage du paragraphe
.    \" =======================
.        ie \\n(Pz-1 .sp \\n(Q1u \" espace précédant le paragraphe
.        el          .sp \\n(PDu
.        ad b       \" justification des deux côtés
.        P0
.        if \\n(Vl-2 .tm Paragraph beginning line \\n(P8 has \\n(Pn line(s)
.        ie \\n(Pz-1 .sp \\n(Q2u \" espace précédant le paragraphe
.\} \" fin de la fermeture du paragraphe
.\" indentation du paragraphe dans le registre P2
.    if '\\n(Pi'0'   .nr P2 0
.    if '\\n(Pi'1'   .nr P2 \\n(PI
.    if '\\$1'0'     .nr P2 0
.    if '\\$1'1'     .nr P2 \\n(PI
.\" marges et autres paramètres
.    nr P3 \\n(PO
.    nr P4 \\n(LL
.    nr P5 \\n(PS
.    ds P6 \\*(Ns
.    nr P7 \\n(VS
.    nr Pz 1
.    nr P8 \\n(.c \" current input line 
.    if '\\$1'quote' \{\
.        nr P2 \\n(QI
.        nr P3 +\\n(QM
.        nr P4 -\\n(QM+\\n(QM
.        nr P5 \\n(QS
.        nr Pz 2
.        nr P7 \\n(Qv
.        ds P6 \\*(Qs \}
.ie !'\\$1'flush' \{\
.    \" un nouveau paragraphe doit commencer
.    nr Pn 0 \" remise à 0 du compteur de lignes
.    de P0 PP
\\.      ti \\n(P2u
\\.      po \\n(P3u
\\.      ll \\n(P4u
\\.      ps \\n(P5
\\.      ft \\*(P6
\\.      vs \\n(P7u \}
.el \{ .nr Pz 0 \" fin d'un paragraphe
.rm    P0
.rm    P2
.rm    P3
.rm    P4
.rm    P5
.rm    P6
.rm    P7
.rm    P8
.\}
..
.\"
.\" Macro P1: ligne à ligne dans un paragraphe
.\" ==========================================
.de P1 \" cette macro est exécutée à chaque ligne d'un paragraphe
.dt \\n(.du+\\n(P7u P1
.nr Pn +1
..
.\" ********************************
.\" * End of the macros definition *
.\" ********************************
.nr Vl 3
.PP
This is the first paragraph of this document. The most interesting thing about 
it is that it has been keeped in memory and handled without having been 
\fIformatted\fR before. The number of the lines in it have been counted and put 
in the register Pn. By doing this, you can know that this paragraph has 
\\n(Pn\~lines in it.
.PP 0
This is the second paragraph of this document. It is much shorter than the 
other one, since it only has \\n(Pn\~lines in it. I used the .PP macro with 0 
as argument in order to have ni initial indentation.
.PP
This paragraph of \\n(Pn\~lines is still shorter.
.PP quote
This is a quotation. It has \\n(Pn\~lines. The size of the characters, the 
style is automatically changed. The request is\|\|: .PP quote
.PP
Verbose levels have been defined. Level\~1 should be TeX-like: it will give 
warnings when a paragraph has long inter-words spaces. Level\~3 will tell all 
informations, for instance the number of lines of each paragraph. These 
informations are rinted on the standard error stream.
.PP
Of course, the main interest of this package is that it will try to break the 
lines of the paragraphs in a TeX-like manner. Verbose level\~2 will tell which 
paragraph has been affected (if the new disposition is pretty; if itsn't, the 
warning will be printed even with level\~1). The .ss request will be use with 
traps to do that. Several diversions will be tried and the best one will be 
kept.
.PP flush

reply via email to

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