groff
[Top][All Lists]
Advanced

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

[Groff] Vertical justification: my ideas on the subject


From: Thomas Baruchel
Subject: [Groff] Vertical justification: my ideas on the subject
Date: Wed, 15 Aug 2001 13:10:58 +0200
User-agent: Mutt/1.2.5i

Brest, le mercredi 15 août

Hi, I don't have much time to write groff macros, because my
wife use the computer to write her thesis (with -mm, but she
doesn't know it; she only uses .P , \fI and \fR, I do the
rest). Anyway, I played a little with groff and found that
the following thing is possible:

  The main idea is to control the vertical justification,
  by changing the vertical space between two lines, AND
  (wich is in mi opnion the most interesting) to give
  a coefficient to some places in the page in order
  to put later (when the justification is done) more
  space to this spaces than to the 'normal' lines. I
  explain it with an example: imagine a very simple page
  with the end of a long paragraph and the beginning of another
  long paragraph, and nothing else. Say you have 35 lines on
  your page, and imagine you should add 4pts of vertical space
  in order to have a pretty justification: you could divide
  4pts by 34 spaces and you would know how much space much be
! added between each line, BUT with my system you could also
! do this: set a number register for each special 'object'.
! Separation between two paragraphes is such an object, and
! so are spaces before and after displays, before and after
! the separation line of footnotes, etc. Say you set the
! register for paragraph-separaration-space to 2. Then in the
! same example, vertical justification will divide the 4pts by
! 35 (33 spaces between ordinary lines and a space with a value
! of 2 between last line of the paragraph and first line of the
  following one). You see what I mean ? Why this choice ?
  Because there are some places in a document where you can add
  more vertical space in order to avoid too big spaces between
  ordinary lines.

  How would I do ?
  I tried it and it works, but the macros are so dirty that I
  won't show them to you. The idea is to print line by line
  (the single trap of my system is a line by line diversion
  trap:   .dt \n(.du+1u xxx   ) your text. You can know how
  many lines you have, and the same line by line macro can decide
  to launch the vertical justification process, to change the
! pages, etc. What is ORIGINAL is that vertical space is 0u
! (  .vs 0u  ), and that the position of each line is controlled
! with \x'n' (space before a paragraph can be controlled with
  \x'-n' ). It means that the last command of the line by line
  macro is always something like: \x'n'\c
! When you want to give to a place a coefficient, you can do
! it very easely: print 3 lines with .vs 0 and no \x'n' ...
! It won't take any place, but it will create 3 'virtual lines'
  An empty line is created like that: never use .br but put
  an horizontal line with the size of a line. For the same
  reason, you shouldn't use .br in your text, but redefine
  a .BR macro which will look at your current horizontal
  position \n(.k and add some horizontal space.
  The size of a line can never change, but you can use .ti and .in

  The vertical justification is then very simple: you can
  see the height of your diversion, see the height that the user
  wants, see the difference and divide it by the number of
  'true lines + virtual lines'. Then print the document with
  .vs (Dh / num.lines)u     instead of     .vs 0u
  See what I mean ? You will have the base line of your last
  line exactly where you want.

  You could also have a macro that the user can launch by himself:
  instead of an ordinary .bp, why not use a macro that can do
  some vertical justification if necessary?

  Everything works, but I didn't write a set of macros to do it.
  I wrote a mess around an example, and saw that it works fine.
  I would be very happy if someone makes something with my idea,
  but I don't have the time to do it by myself.

-- 
        ,--._
      .'o    `-.__
      |     (~'   ~~--.__
      ),-.'  `. '' ,,    ~`-.
     //   \    ( ,,  ,, ''   `)    Thomas Baruchel
    //     `.   `. ,,  ,,'' .'
   //        ~.   `._,,   ,'  <address@hidden>
   '   _tb_    `-.___.,-~'
                   \  \                 Brest
                  _/ _/

reply via email to

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