From: Marc Battyani
Subject: cl-typesetting news
Date: 
Message-ID: <bkurt6$tk@library1.airnews.net>
Some new tests for cl-typesettings

New features:
    color support
    micro-justification (small amount of interletter spacing)
    user defined boxes (the user provides a Lisp function to draw the
internal content of the box.)

The new example is here: (See the Lisp source code for it at the end)
http://www.fractalconcept.com/ex.pdf

I will release this under a FreeBSD license as soon as it's usable.
Volunteers to help are welcomed!

Marc

(in-package typeset)

(defparameter *par1* "Lisp is a family of languages ...")

(defparameter *par2* "MacLisp improved...")

(defparameter *par3* "Interlisp introduced many...")

(defparameter *par4* "Although the first implementations...")

(defparameter *par5* "The Lisp machine concept...")

(defun draw-block (content x y dx dy rotation)
  (pdf:with-saved-state
      (pdf:translate x y)
    (pdf:rotate rotation)
    (pdf:set-gray-fill 1)
    (pdf:basic-rect -5 0 (+ dx 10) (- dy))
    (pdf:fill-and-stroke)
    (pdf:set-gray-fill 0)
    (let ((box (make-filled-vbox content dx dy)))
      (push box *boxes*)
      (stroke box 0 0))))

;; example of extension

(defclass rotated-char-box (soft-box h-mode-mixin)
  ((boxed-char :accessor boxed-char :initarg :boxed-char)
   (rotation :accessor rotation :initarg :rotation)))

(defun put-rotated-char-string (string)
  (loop for char across string
 do (add-box (make-instance 'rotated-char-box :dx *font-size*
       :dy *font-size* :boxed-char char
       :rotation (- (random 120) 60)))
 (incf *char-rotation* *char-rotation-inc*)))

(defmethod stroke ((box rotated-char-box) x y)
  (let ((dx (dx box))(dy (dy box))
 (width (pdf:get-char-width (boxed-char box) *font* *font-size*)))
    (pdf:with-saved-state
      (pdf:translate (+ x (* dx 0.5))(- y (* dy 0.8)))
      (pdf:circle 0 0 (* dx 0.45))
      (pdf:stroke)
      (pdf:rotate (rotation box))
      (pdf:in-text-mode
       (pdf:move-text (* -0.5 width)(* -0.18 *font-size*))
       (pdf:set-font *font* *font-size*)
       (pdf::show-text (make-string 1 :initial-element (boxed-char box)))))))

;;example document

(defun ex (&optional (file #P"/tmp/ex.pdf"))
  (pdf:with-document ()
    (pdf:with-page ()
      (pdf:with-outline-level ("Example" (pdf:register-page-reference))
 (pdf:set-line-width 0.1)
 (let ((content
        (compile-text ()
   (paragraph (:h-align :centered)
       (with-style (:font "Helvetica-Bold" :font-size 30 :color '(0.0 0 0.8))
         "cl-typesetting") :eol
       (with-style (:font "Times-Italic" :font-size 13)
         "The cool Common Lisp typesetting system"))
   (paragraph (:h-align :justified :top-margin 10 :first-line-indent 10)
       (with-style (:font "Times-Italic" :font-size 10)
         "This typesetting system's goal is to be an alternative to the TeX
typesetting system. It is written in Common Lisp and uses cl-pdf as its
backend. This will enable it to be powerful, extensible and fast. Though not
considered very difficult, it is already better than Word..."))
   (paragraph (:h-align :centered)
       (with-style (:font "Helvetica-BoldOblique" :font-size 20 :color '(1.0
0 0))
         "Now in Color!"))
   (paragraph (:h-align :centered)
       (with-style (:font "Times-Italic" :font-size 12 :color '(0.0 0.3 0.1))
         "And with user defined "
         (put-rotated-char-string "extensions")))
   (paragraph (:h-align :justified :top-margin 5 :first-line-indent 10 :color
'(0 0 0))
       (with-style (:font "Times-Roman" :font-size 10)
         *par1*))
   (paragraph (:h-align :left :top-margin 9 :first-line-indent 10
:left-margin 10)
       (with-style (:font "Helvetica" :font-size 10)
         *par2*))
   (paragraph (:h-align :centered :top-margin 9)
       (with-style (:font "Helvetica" :font-size 10)
         *par3*))
   (paragraph (:h-align :justified :top-margin 9 :first-line-indent 10)
       (with-style (:font "Helvetica-Oblique" :font-size 10)
         *par4*))
   (paragraph (:h-align :justified :top-margin 9 :first-line-indent 10)
       (with-style (:font "Helvetica-Oblique" :font-size 10)
         *par5*))
   (paragraph (:h-align :centered :top-margin 20)
       (with-style (:font "Times-Bold" :font-size 20)
         "Kerning test") :eol
       (with-style (:font "Helvetica" :font-size 40 :first-line-indent 10)
         "Yes, AWAY"))
   (paragraph (:h-align :centered :top-margin 20)
       (with-style (:font "Helvetica" :font-size 40 :color '(0.8 0 0))
         "Warning!") :eol
       (with-style (:font "Times-Italic" :font-size 12)
         "This test pdf file has been made with an early version 0.1 of
cl-typesetting. A lot of basic features, like a correct hypenation, are still
missing, though micro-typography is already there")))))
   (draw-block content 40 800 250 380 5)
   (draw-block content 50 425 250 380 -5)
   (draw-block content 330 800 250 380 -2)
   (draw-block content 310 400 250 380 2))))
    (pdf:write-document file)))

From: Eric Daniel
Subject: Re: cl-typesetting news
Date: 
Message-ID: <3f732b4d$1_3@corp.newsgroups.com>
In article <·········@library1.airnews.net>, Marc Battyani wrote:
>  Some new tests for cl-typesettings
>  
>  New features:
>      color support
>      micro-justification (small amount of interletter spacing)
>      user defined boxes (the user provides a Lisp function to draw the
>  internal content of the box.)
>  
>  The new example is here: (See the Lisp source code for it at the end)
>  http://www.fractalconcept.com/ex.pdf
>  
>  I will release this under a FreeBSD license as soon as it's usable.
>  Volunteers to help are welcomed!
[...]

This is pretty amazing! The API seems very easy to use. Obviously it isn't
suited for writing authoring articles etc. but it seems to me that a
translator from a latex-like syntax to sexps would be easy to write.

I've been using TeX in the past month for a writing newsletter, and the
thing that really bugs me is that past some point, there is no way to
modify TeX's hard-coded algorithms. If I want to change interletter
spacing for example, I'm out of luck. I can't tell from your example, but
I imagine that customizing the low-level parts of cl-typesetting will only
take a few defun's?

Eric Daniel


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 100,000 Newsgroups - 19 Different Servers! =-----
From: Marc Battyani
Subject: Re: cl-typesetting news
Date: 
Message-ID: <bkvcdi$8va@library1.airnews.net>
"Eric Daniel" <···········@barberic.vancouver.wa.us> wrote
> In article <·········@library1.airnews.net>, Marc Battyani wrote:
> >  Some new tests for cl-typesettings
> >
> >  New features:
> >      color support
> >      micro-justification (small amount of interletter spacing)
> >      user defined boxes (the user provides a Lisp function to draw the
> >  internal content of the box.)
> >
> >  The new example is here: (See the Lisp source code for it at the end)
> >  http://www.fractalconcept.com/ex.pdf
> >
> >  I will release this under a FreeBSD license as soon as it's usable.
> >  Volunteers to help are welcomed!
> [...]
>
> This is pretty amazing! The API seems very easy to use. Obviously it isn't
> suited for writing authoring articles etc. but it seems to me that a
> translator from a latex-like syntax to sexps would be easy to write.

This is what will be done :
User friendly and/or legacy syntaxes
=> Lisp syntax (macros, source transformation, annotations, etc...)
=> Low level representation (boxes of different types)
=> layout
=> pdf file

> I've been using TeX in the past month for a writing newsletter, and the
> thing that really bugs me is that past some point, there is no way to
> modify TeX's hard-coded algorithms. If I want to change interletter
> spacing for example, I'm out of luck. I can't tell from your example, but
> I imagine that customizing the low-level parts of cl-typesetting will only
> take a few defun's?

You don't even have to customize the internal (though you can) you can just
extend it by creating new kind of boxes.

Marc
From: Thomas F. Burdick
Subject: Re: cl-typesetting news
Date: 
Message-ID: <xcv3cekva7z.fsf@famine.OCF.Berkeley.EDU>
"Marc Battyani" <·············@fractalconcept.com> writes:

> Some new tests for cl-typesettings
> 
> New features:
>     color support
>     micro-justification (small amount of interletter spacing)
>     user defined boxes (the user provides a Lisp function to draw the
> internal content of the box.)
> 
> The new example is here: (See the Lisp source code for it at the end)
> http://www.fractalconcept.com/ex.pdf

That document is as exciting as it is tacky :-)  Good work!

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | No to Imperialist war |                        
     ,--'    _,'   | Wage class war!       |                        
    /       /      `-----------------------'                        
   (   -.  |                               
   |     ) |                               
  (`-.  '--.)                              
   `. )----'                               
From: Gareth McCaughan
Subject: Re: cl-typesetting news
Date: 
Message-ID: <8765jg3907.fsf@g.mccaughan.ntlworld.com>
Marc Battyani wrote:

> Some new tests for cl-typesettings
...
> New features:
>     color support
>     micro-justification (small amount of interletter spacing)

Please tell me that this can be turned off. :-)
You know what Eric Gill allegedly[1] said about
letterspacing...

    [1] i.e., he didn't really say it even though lots
        of people think he did.

>     user defined boxes (the user provides a Lisp function to draw the
> internal content of the box.)
> 
> The new example is here: (See the Lisp source code for it at the end)
> http://www.fractalconcept.com/ex.pdf

Whoa! Very nice.

-- 
Gareth McCaughan
.sig under construc
From: Marc Battyani
Subject: Re: cl-typesetting news
Date: 
Message-ID: <bkvkbv$6f4@library1.airnews.net>
"Gareth McCaughan" <················@pobox.com> wrote
> Marc Battyani wrote:
>
>> Some new tests for cl-typesettings
> ...
>> New features:
>>     color support
>>     micro-justification (small amount of interletter spacing)
>
> Please tell me that this can be turned off. :-)
> You know what Eric Gill allegedly[1] said about
> letterspacing...
>
>     [1] i.e., he didn't really say it even though lots
>         of people think he did.

No... Want did he say (if the language is compatible with a familly news
group as c.l.l)
BTW you are the second one to tell me that it is not a good thing.
Why ?
And what about the next micro-justification step i.e. glyph stretching ?

In both case we speak about very small amounts not big gaps between glyphs.

>>     user defined boxes (the user provides a Lisp function to draw the
>> internal content of the box.)
>>
>> The new example is here: (See the Lisp source code for it at the end)
>> http://www.fractalconcept.com/ex.pdf
>
> Whoa! Very nice.

Thanks, stay tuned...

Marc
From: Thomas F. Burdick
Subject: Re: cl-typesetting news
Date: 
Message-ID: <xcvzngstuw5.fsf@famine.OCF.Berkeley.EDU>
"Marc Battyani" <·············@fractalconcept.com> writes:

> "Gareth McCaughan" <················@pobox.com> wrote
> > Marc Battyani wrote:
> >
> >> Some new tests for cl-typesettings
> > ...
> >> New features:
> >>     color support
> >>     micro-justification (small amount of interletter spacing)
> >
> > Please tell me that this can be turned off. :-)
> > You know what Eric Gill allegedly[1] said about
> > letterspacing...
> >
> >     [1] i.e., he didn't really say it even though lots
> >         of people think he did.

He didn't?  Well then, *someone* said "any man who would letterspace
lower-case text would steal sheep."  FWIW, I have done this by hand,
but I can't imagine stealing sheep.  We were using really really big
lowercase instead of capitals, though -- I'm not sure if that makes it
better or worse :)

> No... Want did he say (if the language is compatible with a familly news
> group as c.l.l)
> BTW you are the second one to tell me that it is not a good thing.
> Why ?

Because a well designed font should have correct interletter spacing.
As litterate people, when we read, we recognize words we already know
by their overall shape, not by going one-by-one through their letters.
That's also why some typos slip through unnoticed (they don't mess
with the shape of the word), whereas some are easy to catch (they do).

> And what about the next micro-justification step i.e. glyph stretching ?

If you want to turn out garbage like Word, go for it.  If you want to
turn out TeX-quality stuff, well, there's a reason that TeX doesn't
use either of these.

> In both case we speak about very small amounts not big gaps between glyphs.

I do think that this could be a useful feature, if used *very*
carefully.  Having a mode that tells the typesetter to use icky
techniques like these, if it has no other choice, could help work
around the problem that TeX has, where you need to manually intervene
sometimes.  I prefer manual intervention over letterspaced/streached
justification, but I think some WYSIWYG-users would not.

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | No to Imperialist war |                        
     ,--'    _,'   | Wage class war!       |                        
    /       /      `-----------------------'                        
   (   -.  |                               
   |     ) |                               
  (`-.  '--.)                              
   `. )----'                               
From: Eric Daniel
Subject: Re: cl-typesetting news
Date: 
Message-ID: <3f737a37$1_3@corp.newsgroups.com>
In article <···············@famine.OCF.Berkeley.EDU>, Thomas F. Burdick wrote:
>  "Marc Battyani" <·············@fractalconcept.com> writes:
[...]
>  
> > In both case we speak about very small amounts not big gaps between glyphs.
>  
>  I do think that this could be a useful feature, if used *very*
>  carefully.  Having a mode that tells the typesetter to use icky
>  techniques like these, if it has no other choice, could help work
>  around the problem that TeX has, where you need to manually intervene
>  sometimes.  I prefer manual intervention over letterspaced/streached
>  justification, but I think some WYSIWYG-users would not.
>  
[...]

I think the point is that the system allows you to do this at all,
not necesarily that you would use it all over your text. Also, if
implemented the right way, it should let you insert anything at all
between letters (underline, overstrike, w|e|i|r|d  e|f|f|e|c|t|s etc.)
Hey, isn't it like lisp itself, which lets you shoot yourself in the
foot if you really want to?

There is a package called "soul.sty" for TeX. The author went through
great contortions to make it work, and yet it isn't perfect.

Eric Daniel


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 100,000 Newsgroups - 19 Different Servers! =-----
From: Thomas F. Burdick
Subject: Re: cl-typesetting news
Date: 
Message-ID: <xcv3cek2i3d.fsf@famine.OCF.Berkeley.EDU>
Eric Daniel <···········@barberic.vancouver.wa.us> writes:

> In article <···············@famine.OCF.Berkeley.EDU>, Thomas F. Burdick wrote:
> >  "Marc Battyani" <·············@fractalconcept.com> writes:
> [...]
> >  
> > > In both case we speak about very small amounts not big gaps between glyphs.
> >  
> >  I do think that this could be a useful feature, if used *very*
> >  carefully.  Having a mode that tells the typesetter to use icky
> >  techniques like these, if it has no other choice, could help work
> >  around the problem that TeX has, where you need to manually intervene
> >  sometimes.  I prefer manual intervention over letterspaced/streached
> >  justification, but I think some WYSIWYG-users would not.
> >  
> [...]
> 
> I think the point is that the system allows you to do this at all,
> not necesarily that you would use it all over your text. Also, if
> implemented the right way, it should let you insert anything at all
> between letters (underline, overstrike, w|e|i|r|d  e|f|f|e|c|t|s etc.)
> Hey, isn't it like lisp itself, which lets you shoot yourself in the
> foot if you really want to?

(For the record, I was trying to condemn letterspacing of normal text,
while still saying that it should be included, just carefully).

> There is a package called "soul.sty" for TeX. The author went through
> great contortions to make it work, and yet it isn't perfect.

Wow.  That gets the award for the most inappropriately named TeX
package I've seen.  (doesn't letterspacing have its origins in
*advertising*?)

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | No to Imperialist war |                        
     ,--'    _,'   | Wage class war!       |                        
    /       /      `-----------------------'                        
   (   -.  |                               
   |     ) |                               
  (`-.  '--.)                              
   `. )----'                               
From: Eric Daniel
Subject: Re: cl-typesetting news
Date: 
Message-ID: <3f73dee2$1_3@corp.newsgroups.com>
In article <···············@famine.OCF.Berkeley.EDU>, Thomas F. Burdick wrote:
>  Eric Daniel <···········@barberic.vancouver.wa.us> writes:
[...]
>  
> > There is a package called "soul.sty" for TeX. The author went through
> > great contortions to make it work, and yet it isn't perfect.
>  
>  Wow.  That gets the award for the most inappropriately named TeX
>  package I've seen.  (doesn't letterspacing have its origins in
>  *advertising*?)
>  

I think it stands for "strike-out/underline" or something like that.
Nothing metaphyisical :-)

Eric Daniel


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 100,000 Newsgroups - 19 Different Servers! =-----
From: Jesper Harder
Subject: Re: cl-typesetting news
Date: 
Message-ID: <m3zngs9td6.fsf@defun.localdomain>
"Marc Battyani" <·············@fractalconcept.com> writes:

> And what about the next micro-justification step i.e. glyph
> stretching ?

H�n Th�' Th�nh (of pdfTeX fame) discusses some of these
microtypographic issues in his dissertation:

  Microtypographic extensions to the TeX typesetting system�

It also includes some comments from Knuth and Hermann Zapf.


� http://www.pragma-ade.com/pdftex/thesis.pdf
From: Marc Battyani
Subject: Re: cl-typesetting news
Date: 
Message-ID: <bl0qqu$ito@library2.airnews.net>
"Jesper Harder" <······@myrealbox.com> wrote
> "Marc Battyani" <·············@fractalconcept.com> writes:
>
> > And what about the next micro-justification step i.e. glyph
> > stretching ?
>
> H�n Th�' Th�nh (of pdfTeX fame) discusses some of these
> microtypographic issues in his dissertation:
>
>   Microtypographic extensions to the TeX typesetting system�
>
> It also includes some comments from Knuth and Hermann Zapf.
>
>
> � http://www.pragma-ade.com/pdftex/thesis.pdf

I have it. It's in it that I have found the ideas of glyph stretching. There
is another good idea which I would to use : optical margin kerning

Marc
From: Gareth McCaughan
Subject: Re: cl-typesetting news
Date: 
Message-ID: <87r824yllg.fsf@g.mccaughan.ntlworld.com>
Marc Battyani wrote:

[I said, about "micro-justification":]
> > Please tell me that this can be turned off. :-)
> > You know what Eric Gill allegedly[1] said about
> > letterspacing...
> >
> >     [1] i.e., he didn't really say it even though lots
> >         of people think he did.

[Marc:]
> No... Want did he say (if the language is compatible with a familly
> news group as c.l.l)

He (allegedly) said: A man who would letterspace lowercase
would steal sheep.

>                      BTW you are the second one to tell me that it
> is not a good thing.  Why ?

Because (at least when not done very subtly) it looks
terrible, much worse than having a bit too much inter-word
spacing. The widths of letters -- especially lowercase
ones -- have, in a well constructed typeface, been
carefully chosen to make the text easy to read and
nice to look at. Letterspacing can mess that up very
effectively.

>                              And what about the next
> micro-justification step i.e. glyph stretching ?

Depends how you do it. There was a system once (search for
"Zapf" and "GX" and you might find it, IIRC) that carefully
stretched only the *counters* (i.e., the empty spaces within
letters), without changing the line thicknesses, in order
to improve justification a bit. That would be cool, though
I'm not entirely sure I approve. Similarly, if the letterspacing
you're applying is sufficiently subtle then maybe it's OK.
If you haven't got the TeX linebreaking algorithm (or some
other thing that optimizes at least per-paragraph) yet, then
I think you'll get better gains from implementing that.

> In both case we speak about very small amounts not big gaps between glyphs.

Right. That does make a difference; presumably the idea is
to have some carefully calibrated equivalent between a given
amount of letterspacing and a given amount of inter-word space,
and then to balance the two to minimize overall badness.
Provided the tradeoff is defined so that (1) no letterspacing
is done unless the alternative is quite a lot of extra
inter-word space and (2) there's never more than, say,
M/30 of intra-word space (that number is pulled out of
thin air and may be too large), it's probably a rather
good idea.

-- 
Gareth McCaughan
.sig under construc
From: Marc Battyani
Subject: Re: cl-typesetting news
Date: 
Message-ID: <bl1293$oof@library2.airnews.net>
"Gareth McCaughan" <················@pobox.com> wrote
> Marc Battyani wrote:
>
> >                      BTW you are the second one to tell me that it
> > is not a good thing.  Why ?
>
> Because (at least when not done very subtly) it looks
> terrible, much worse than having a bit too much inter-word
> spacing. The widths of letters -- especially lowercase
> ones -- have, in a well constructed typeface, been
> carefully chosen to make the text easy to read and
> nice to look at. Letterspacing can mess that up very
> effectively.

> >                              And what about the next
> > micro-justification step i.e. glyph stretching ?
>
> Depends how you do it. There was a system once (search for
> "Zapf" and "GX" and you might find it, IIRC) that carefully
> stretched only the *counters* (i.e., the empty spaces within
> letters), without changing the line thicknesses, in order
> to improve justification a bit. That would be cool, though
> I'm not entirely sure I approve. Similarly, if the letterspacing
> you're applying is sufficiently subtle then maybe it's OK.
> If you haven't got the TeX linebreaking algorithm (or some
> other thing that optimizes at least per-paragraph) yet, then
> I think you'll get better gains from implementing that.

Sure this is already underway.

> > In both case we speak about very small amounts not big gaps between
glyphs.
>
> Right. That does make a difference; presumably the idea is
> to have some carefully calibrated equivalent between a given
> amount of letterspacing and a given amount of inter-word space,
> and then to balance the two to minimize overall badness.
> Provided the tradeoff is defined so that (1) no letterspacing
> is done unless the alternative is quite a lot of extra
> inter-word space and (2) there's never more than, say,
> M/30 of intra-word space (that number is pulled out of
> thin air and may be too large), it's probably a rather
> good idea.

I have yet to fine tune this (or even better I will leave it tunable by the
user) but I still think it's a good idea.
BTW I don't have exactly the same box layout algorithm than TeX so thing that
are bad ideas in TeX can work here and vice versa.

Marc
From: Peter Seibel
Subject: Re: cl-typesetting news
Date: 
Message-ID: <m37k3we7d0.fsf@javamonkey.com>
"Marc Battyani" <·············@fractalconcept.com> writes:

> Some new tests for cl-typesettings
> 
> New features:
>     color support
>     micro-justification (small amount of interletter spacing)
>     user defined boxes (the user provides a Lisp function to draw the
> internal content of the box.)

Speaking of features, one feature that would be nice to have
out-of-the-box is an easy way to typeset source code: i.e. treat the
white space as significant (a la HTML's PRE tag.). I'm certainly no
TeX or LaTeX wizard, but when I did try to use it for something it
seemed a lot harder than it ought to be to just plop in some friggin
source code without it getting line wrapped, etc.

-Peter

-- 
Peter Seibel                                      ·····@javamonkey.com

         Lisp is the red pill. -- John Fraser, comp.lang.lisp
From: Marc Battyani
Subject: Re: cl-typesetting news
Date: 
Message-ID: <bl0t6g$kvv@library2.airnews.net>
"Peter Seibel" <·····@javamonkey.com> wrote
> "Marc Battyani" <·············@fractalconcept.com> writes:
>
> > Some new tests for cl-typesettings
> >
> > New features:
> >     color support
> >     micro-justification (small amount of interletter spacing)
> >     user defined boxes (the user provides a Lisp function to draw the
> > internal content of the box.)
>
> Speaking of features, one feature that would be nice to have
> out-of-the-box is an easy way to typeset source code: i.e. treat the
> white space as significant (a la HTML's PRE tag.). I'm certainly no
> TeX or LaTeX wizard, but when I did try to use it for something it
> seemed a lot harder than it ought to be to just plop in some friggin
> source code without it getting line wrapped, etc.

Yes, there is a verbatim mode.

Marc
From: Peter Seibel
Subject: Re: cl-typesetting news
Date: 
Message-ID: <m3smmjd0dz.fsf@javamonkey.com>
"Marc Battyani" <·············@fractalconcept.com> writes:

> "Peter Seibel" <·····@javamonkey.com> wrote
> > "Marc Battyani" <·············@fractalconcept.com> writes:
> >
> > > Some new tests for cl-typesettings
> > >
> > > New features:
> > >     color support
> > >     micro-justification (small amount of interletter spacing)
> > >     user defined boxes (the user provides a Lisp function to draw the
> > > internal content of the box.)
> >
> > Speaking of features, one feature that would be nice to have
> > out-of-the-box is an easy way to typeset source code: i.e. treat the
> > white space as significant (a la HTML's PRE tag.). I'm certainly no
> > TeX or LaTeX wizard, but when I did try to use it for something it
> > seemed a lot harder than it ought to be to just plop in some friggin
> > source code without it getting line wrapped, etc.
> 
> Yes, there is a verbatim mode.

Cool. BTW, I've been "typesetting" my book in yet another TeX like
markup language which I parse into s-exps which I then convert to
HTML. So I'm looking forward to the release of cl-typesetting so I can
make a PDF backend as well.

Another project that would round out the whole document production in
Lisp suite would be for someone to write an RTF backend. At some point
I'm going to have to deliver Word files to the publisher, with their
house stylesheet applied. I may be able to do it by generating HTML
with appropriate CSS styles and then importing it into Word but if I
could generate RTF that'd be fantastic. I may even try to write that
myself but if anyone else does it before then, I'd love to know about
it. I'm envisioning a Lisp document production stack that looks like
this:

  +---------------------------+-----------------------------------+  
  |    LaTex->SEXP parser     |   Various homebrew markup->sexp   |
  +---------------------------+--+--------------------------------+
  | SEXP document representation | SEXP stylesheet representation |
  +------------------------+-----+------------+-------------------+
  |     cl-typesetting     |    sexp->html    |    sexp->rtf      |
  +------------------------+------------------+-------------------+

FWIW, in my homebrew markup, I use \i{italic} style markup and the
parser is smart enough to treat {'s that aren't part of a \word{
constructs as normal text to make it easier to include verbatim C or
Java code with having to escape braces. I also parse blocks of plain
text into paragraphs (like TeX) and differentiate blocks of text that
are unindented, indented two spaces, or indented four spaces. This
allows me to easily include blockquotes (indented two spaces) and
verbatim code (four spaces) like this:

This is a regular paragraph. Blah blah blah. The quick brown fox jumps
over the lazy dog. This word is in \i{italic}. Blah blah blah.
As someone once said:

  This is a block quote and will generate a different s-exp than the
  paragraph above which I will later map to an HTML blockquote.

This is another paragraph:

    (defun foo ()
      ;; This is literal code and (if I generate HTML) will be marked
      ;; up with a PRE tag.
     (format t "~{~a~^, ~}~%" '(no problem with that brace)))


-Peter


-- 
Peter Seibel                                      ·····@javamonkey.com

         Lisp is the red pill. -- John Fraser, comp.lang.lisp
From: Ray Blaak
Subject: Re: cl-typesetting news
Date: 
Message-ID: <u4qz087wq.fsf@STRIPCAPStelus.net>
"Marc Battyani" <·············@fractalconcept.com> writes:
> Some new tests for cl-typesettings

Overall comments: the power seems to be there, but it is too verbose for
"normal" typing. There is too much tedious setup to do normal things.

To be fair, that might not be your concern for now, you might be relying on
higher layers to simply the user experience.

Still, it is telling that you separate the basic texts, e.g.

> (defparameter *par2* "MacLisp improved...")

from its usage:

>    (paragraph (:h-align :left :top-margin 9 :first-line-indent 10
> :left-margin 10)
>        (with-style (:font "Helvetica" :font-size 10)
>          *par2*))

What about somehow letting one name common settings and then use them:

  (defun par 
    (text &key (font "Helvetica") (font-size 10) (h-align :left) 
        (top-margin 9) (first-line-indent 10) (left-margin 10))
    (paragraph (:h-align h-align :top-margin top-margin 
                :first-line-indent first-line-indent :left-margin left-margin)
      (with-style (:font font :font-size 10)
        text)))
 
  (defun emph-par (text)
    (par :font "Helvetica-Oblique" text))

  ...
  (par "Lisp is a family of languages ...")
  (par "MacLisp improved...")
  (par :h-align :centered :top-margin 9
      "Interlisp introduced many...")
  (emph-par "Although the first implementations...")
  (emph-par "The Lisp machine concept...")
  ...etc...

Such easy to use things should be there by default. That is, define operators
that affect the current parameter/font settings, allowing normal text typing
to be as simple as possible, e.g. along the lines of (par "some text...").

-- 
Cheers,                                        The Rhythm is around me,
                                               The Rhythm has control.
Ray Blaak                                      The Rhythm is inside me,
········@STRIPCAPStelus.net                    The Rhythm has my soul.
From: Marc Battyani
Subject: Re: cl-typesetting news
Date: 
Message-ID: <bl0t2n$krv@library2.airnews.net>
"Ray Blaak" <········@STRIPCAPStelus.net> wrote
> "Marc Battyani" <·············@fractalconcept.com> writes:
> > Some new tests for cl-typesettings
>
> Overall comments: the power seems to be there, but it is too verbose for
> "normal" typing. There is too much tedious setup to do normal things.
>
> To be fair, that might not be your concern for now, you might be relying on
> higher layers to simply the user experience.

[snipped examples]

Yes, but again I think all this syntaxic sugar belongs to upper layers. For
now I'm working on the bare steel layer.
BTW as I told you, I rather liked the syntax you proposed earlier. I'm just
waiting for you to implement it... ;-)

Marc