From iso at wemba.edu.pl Thu Apr 12 21:25:38 2007 From: iso at wemba.edu.pl (iso at wemba.edu.pl) Date: Thu, 12 Apr 2007 23:25:38 +0200 (CEST) Subject: [cl-typesetting-devel] Vertical space at the top and bottom of a page Message-ID: I want to separate paragraphs with vertical space, so I use (paragraph (:h-align :left :top-margin 5 :bottom-margin 5) "some text") Unfortunately, when a page break falls between two paragraphs, there is extra space at the top of the page, which looks especially bad when I use a two-column layout. I think vertical space should disappear at the top of the page (it would be good if it could also disappear at the bottom, with the difference being made up for by expansible boxes). If I remember correctly, this is what TeX does. This problem is particularly severe with section heading lines, which I typeset as paragraphs with large top and bottom margins. It's crucial that they be aligned with the top of the page. I tried to set :top-margin to 0 and use only :bottom-margin, but it did not help. The vertical space separating paragraphs that appear on different pages is still visible, even at the top of the page. Any ideas how to deal with this? I was hoping to typeset a brochure with cl-typesetting, but the uneven pages look really bad. If the current version of cl-typesetting is unable to produce pages with the text starting always from the top of the page, where should I look to modify the code? TT::SPREAD-BOXES? Thanks, iso From jmckitrick at reedlarkeygroup.com Thu Apr 12 21:39:07 2007 From: jmckitrick at reedlarkeygroup.com (Jonathon McKitrick) Date: Thu, 12 Apr 2007 17:39:07 -0400 Subject: [cl-typesetting-devel] Vertical space at the top and bottom of a page In-Reply-To: References: Message-ID: Sorry I don't have an answer for you, but I didn't even know there was support for two-column layouts. How do you do that? By the way, would :vfill be helpful for you in your situation? It just occurred to me that might help. On Apr 12, 2007, at 5:25 PM, iso at wemba.edu.pl wrote: > I want to separate paragraphs with vertical space, so I use > > (paragraph (:h-align :left > :top-margin 5 > :bottom-margin 5) > "some text") > > Unfortunately, when a page break falls between two paragraphs, > there is extra space at the top of the page, which looks > especially bad when I use a two-column layout. I think > vertical space should disappear at the top of the page > (it would be good if it could also disappear at the bottom, > with the difference being made up for by expansible boxes). > If I remember correctly, this is what TeX does. > > This problem is particularly severe with section heading lines, > which I typeset as paragraphs with large top and bottom margins. > It's crucial that they be aligned with the top of the page. > > I tried to set :top-margin to 0 and use only :bottom-margin, > but it did not help. The vertical space separating paragraphs > that appear on different pages is still visible, even at the > top of the page. > > Any ideas how to deal with this? I was hoping to typeset > a brochure with cl-typesetting, but the uneven pages look > really bad. > > If the current version of cl-typesetting is unable to > produce pages with the text starting always from the > top of the page, where should I look to modify the code? > TT::SPREAD-BOXES? > > Thanks, > iso > > _______________________________________________ > cl-typesetting-devel site list > cl-typesetting-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/cl-typesetting-devel -- Jonathon McKitrick jmckitrick at reedlarkeygroup.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From marc.battyani at fractalconcept.com Thu Apr 12 22:49:31 2007 From: marc.battyani at fractalconcept.com (Marc Battyani) Date: Fri, 13 Apr 2007 00:49:31 +0200 Subject: [cl-typesetting-devel] Vertical space at the top and bottom of apage References: Message-ID: <117d01c77d54$d5a76230$1402a8c0@marcx2> wrote: >I want to separate paragraphs with vertical space, so I use > > (paragraph (:h-align :left > :top-margin 5 > :bottom-margin 5) > "some text") > > Unfortunately, when a page break falls between two paragraphs, > there is extra space at the top of the page, which looks > especially bad when I use a two-column layout. I think > vertical space should disappear at the top of the page > (it would be good if it could also disappear at the bottom, > with the difference being made up for by expansible boxes). > If I remember correctly, this is what TeX does. > > This problem is particularly severe with section heading lines, > which I typeset as paragraphs with large top and bottom margins. > It's crucial that they be aligned with the top of the page. > > I tried to set :top-margin to 0 and use only :bottom-margin, > but it did not help. The vertical space separating paragraphs > that appear on different pages is still visible, even at the > top of the page. > > Any ideas how to deal with this? I was hoping to typeset > a brochure with cl-typesetting, but the uneven pages look > really bad. > > If the current version of cl-typesetting is unable to > produce pages with the text starting always from the > top of the page, where should I look to modify the code? > TT::SPREAD-BOXES? I think you have a real issue here. Tomorrow, I will look at this and tell you where to look at. Marc From iso at wemba.edu.pl Thu Apr 12 22:55:41 2007 From: iso at wemba.edu.pl (iso at wemba.edu.pl) Date: Fri, 13 Apr 2007 00:55:41 +0200 (CEST) Subject: [cl-typesetting-devel] Vertical space at the top and bottom of a page Message-ID: > Sorry I don't have an answer for you, but I didn't even know there > was support for two-column layouts. How do you do that? I copied the idea from Peter Seibel's markup package. This is how I do it (this code is not tested; you will also have to define compile-header and compile-footer functions or comment out the appropriate lines in %draw-page-2-column) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun make-some-content () (compile-text () (paragraph (:h-align :left :top-margin 0 :bottom-margin 5) "some text") ;; add more stuff )) (defun two-columns () (tt:with-document () (let ((content (make-some-content))) (loop while (typeset::boxes content) do (%draw-page-2-column content :width 482 :height 708 :margins '(42 48 49 48) :header-height 36 :footer-height 36 ))) (tt:write-document "/tmp/two-columns.pdf"))) (defun %draw-page-2-column (content &key width height margins (header-height 12) (footer-height 12) (column-gap 10)) (destructuring-bind (left &optional (top left) (right left) (bottom top)) margins (let* ((x left) (y (- height top)) (content-width (- width left right)) (content-height (- height top bottom)) (column-width (/ (- content-width column-gap) 2.0)) (main-height (- content-height header-height footer-height))) (pdf:with-page (:bounds (vector 0 0 width height)) (pdf:with-saved-state (tt::stroke (make-filled-vbox content column-width main-height :top) x (- y header-height)) (tt::stroke (make-filled-vbox content column-width main-height :top) (+ x column-width column-gap) (- y header-height)) (typeset::stroke (compile-header content-width header-height) x y) (typeset::stroke (compile-footer content-width footer-height) x (+ bottom footer-height)) ))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > By the way, would :vfill be helpful for you in your situation? It > just occurred to me that might help. But where do I put it? I don't know where the page break will occur (I'm using the cl-typesetting engine to determine this). iso From iso at wemba.edu.pl Fri Apr 13 02:58:48 2007 From: iso at wemba.edu.pl (iso at wemba.edu.pl) Date: Fri, 13 Apr 2007 04:58:48 +0200 (CEST) Subject: [cl-typesetting-devel] Vertical space at the top and bottom of a page Message-ID: I seem to have a partial solution to the problem of v-spacing appearing at the top of a page, but it's a stab in the dark. I don't understand in detail how compile-text, fit-lines, do-layout and spread-boxes work, so I may have introduced a fatal bug. The idea is to discard one v-spacing box at the front of the list of boxes in a vbox and one at the rear if it comes before (resp. after) a text-line with dy > 0, hoping that it originated from a top or bottom margin of an element at which the pagebreak was inserted (or perhaps a vspace, which seems to have the same effect). It's not a perfect solution, since some pages (or columns) are shorter than they could be. The unwanted v-spacing boxes should probably be removed before the size of the box is measured, but I do not know how to do this. I have attached a complete example of a two-column document (run the TEST-DOCUMENT function). Of course, the problem of section headings appearing as the last thing at the bottom of the page (or column) remains unsolved. I wonder whether it would be possible to make a simple fix by adding a parameter to PARAGRAPH, called :forbidden-zone, which would specify the height of a special area at the bottom of the page (or vbox) where the paragraph must not start. Wouldn't this be simpler to implement than a "keep-together" option? This would not solve the problem of single lines at the top, but at least section headings would be kept together with the text. -------------- next part -------------- (in-package :cl-user) (eval-when (:compile-toplevel :load-toplevel :execute) (asdf:oos 'asdf:load-op :cl-typesetting) (use-package :tt)) (defun discard-unwanted-boxes (vbox) "Discard the first v-spacing box with dy > 0, but only if it comes before any text-line with dy > 0. Do the same thing at the end of the list of boxes." (when vbox (setf (tt::boxes vbox) (list-lobotomy #'discardable-box-p #'undiscardable-box-p (tt::boxes vbox))) vbox)) #+nil (defun discard-unwanted-boxes (vbox) vbox) (defmethod undiscardable-box-p ((b tt::text-line)) (not (zerop (tt::dy b)))) (defmethod undiscardable-box-p ((b t)) nil) (defmethod discardable-box-p ((b tt::v-spacing)) (not (zerop (tt::dy b)))) (defmethod discardable-box-p ((b t)) nil) (defun list-lobotomy (delete-what-p stop-when-p list) (list-tail-lobotomy delete-what-p stop-when-p (list-head-lobotomy delete-what-p stop-when-p list))) (defun list-head-lobotomy (delete-what-p stop-when-p list) "Delete elements satisfying DELETE-WHAT-P at the beginning of LIST before the first element satisfying STOP-WHEN-P." (if (funcall delete-what-p (car list)) (cdr list) (do ((rest list (cdr rest))) ((or (null rest) (funcall stop-when-p (car rest))) list) (let ((next (cadr rest))) (when (and next (funcall delete-what-p next)) (rplacd rest (cddr rest))))))) (defun list-tail-lobotomy (delete-what-p stop-when-p list) "Delete first (counting from the end) element of LIST that satisfies DELETE-WHAT-P if it comes after any element satisfying STOP-WHEN-P." (let ((unwanted (position-if delete-what-p list :from-end t)) (stopper (position-if stop-when-p list :from-end t))) (when (and stopper unwanted (< stopper unwanted)) (let ((l (nthcdr (1- unwanted) list))) (rplacd l (cddr l)))) list)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defparameter *some-text* "Compact setting of text should be avoided, except maybe for very small portions where a given area of white space must be used in a certain way and it would not be possible to fit the text into the area otherwise. Introduction of extra white space between lines of text was traditionally done through a process called leading. The typesetter inserted thin strips of brass with a known thickness between lines of type blocks in the printing frame to increase the distance between the baselines of his types.") (defun make-some-content () (compile-text () (dotimes (i 100) (paragraph (:h-align :left :top-margin 24 :bottom-margin 8 :font-size 14) (format-string "Section ~d" (1+ i))) (paragraph (:h-align :fill :top-margin 0 :bottom-margin 4 :font-size 9) *some-text* :hfill) ) :vfill)) (defun test-document (&optional (filename #P"/tmp/output.pdf")) (with-document () (let ((content (make-some-content))) (loop while (tt::boxes content) do (draw-page-2-column content :width 482 :height 708 :margins '(42 48 49 48) :header-height 3 :footer-height 3 ))) (write-document filename))) (defun draw-page-2-column (content &key width height margins (header-height 12) (footer-height 12) (column-gap 16) ) (destructuring-bind (left &optional (top left) (right left) (bottom top)) margins (let* ((x left) (y (- height top)) (content-width (- width left right)) (content-height (- height top bottom)) (column-width (/ (- content-width column-gap) 2.0)) (main-height (- content-height header-height footer-height))) (pdf:with-page (:bounds (vector 0 0 width height)) (pdf:with-saved-state (tt::stroke (discard-unwanted-boxes (make-filled-vbox content column-width main-height :top)) x (- y header-height)) (tt::stroke (discard-unwanted-boxes (make-filled-vbox content column-width main-height :top)) (+ x column-width column-gap) (- y header-height)) (pdf::move-to x y) (pdf::line-to (+ x content-width) y) (pdf::move-to x bottom) (pdf::line-to (+ x content-width) bottom) (pdf::set-line-width .3) (pdf::stroke) ))))) From marc.battyani at fractalconcept.com Fri Apr 27 21:15:33 2007 From: marc.battyani at fractalconcept.com (Marc Battyani) Date: Fri, 27 Apr 2007 23:15:33 +0200 Subject: [cl-typesetting-devel] Re: [cl-pdf-devel] Exscribe + CL-Typesetting References: <653bea160704270105j586e1100y3a23831f781ea072@mail.gmail.com> Message-ID: <2e0201c78911$3443b3d0$1402a8c0@marcx2> [cc'ed to cl-typesetting-devel] "Far?" wrote: >I have just released version 0.94 of Exscribe, which thanks to the >work of Denis Mashkevich, now includes a working cl-typesetting >backend. > >The typesetting backend is very feature poor and slow, but it's there >and it works well enough to typeset some simple articles. > > http://cliki.net/Exscribe Great! Thanks to Denis. Marc From nedenis at gmail.com Fri Apr 27 22:32:57 2007 From: nedenis at gmail.com (Denis Mashkevich) Date: Sat, 28 Apr 2007 01:32:57 +0300 Subject: [cl-typesetting-devel] Re: [cl-pdf-devel] Exscribe + CL-Typesetting In-Reply-To: <2e0201c78911$3443b3d0$1402a8c0@marcx2> References: <653bea160704270105j586e1100y3a23831f781ea072@mail.gmail.com> <2e0201c78911$3443b3d0$1402a8c0@marcx2> Message-ID: <1ddc94910704271532h3afebc12p5227279ab431b0a4@mail.gmail.com> I have to add that there's nothing to be excited about at the moment - this is just a quick hack to get _some_ pdf output out of exscribe; that said, development is under way, please expect major changes in the coming weeks. Hopefully this will complement cl-typesetting functionality nicely. One major shortcoming of cl-typesetting that is holding exscribe-typesetting back is the lack of the mechanism to place footnotes on the page they belong. If nothing is planned in this regard by cl-typesetting developers, I will implement it - and I will be grateful for any thoughts and pointers on how to go about it (concering algorithms and cl-typesetting architecture). Thanks to Marc and other cl-pdf and cl-typestting developers for the wonderful libraries; same to Far? for exscribe. Denis. [cc'ed to cl-pdf-devel] On 4/28/07, Marc Battyani wrote: > [cc'ed to cl-typesetting-devel] > > "Far?" wrote: > > >I have just released version 0.94 of Exscribe, which thanks to the > >work of Denis Mashkevich, now includes a working cl-typesetting > >backend. > > > >The typesetting backend is very feature poor and slow, but it's there > >and it works well enough to typeset some simple articles. > > > > http://cliki.net/Exscribe > > Great! Thanks to Denis. > > Marc > > > _______________________________________________ > cl-pdf-devel site list > cl-pdf-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/cl-pdf-devel > From divanov at aha.ru Sat Apr 28 05:12:16 2007 From: divanov at aha.ru (Dmitriy Ivanov) Date: Sat, 28 Apr 2007 09:12:16 +0400 Subject: [cl-typesetting-devel] Re: [cl-pdf-devel] Exscribe + CL-Typesetting References: <653bea160704270105j586e1100y3a23831f781ea072@mail.gmail.com><2e0201c78911$3443b3d0$1402a8c0@marcx2> <1ddc94910704271532h3afebc12p5227279ab431b0a4@mail.gmail.com> Message-ID: <001701c78953$d320c6e0$8100a8c0@digo> Hello Denis, | I have to add that there's nothing to be excited about at the moment - | this is just a quick hack to get _some_ pdf output out of exscribe; | that said, development is under way, please expect major changes in | the coming weeks. Hopefully this will complement cl-typesetting | functionality nicely. | | One major shortcoming of cl-typesetting that is holding | exscribe-typesetting back is the lack of the mechanism to place | footnotes on the page they belong. If nothing is planned in this | regard by cl-typesetting developers, I will implement it - and I will | be grateful for any thoughts and pointers on how to go about it | (concering algorithms and cl-typesetting architecture). Good initiative! Personally, I have been concentrating on generating reports rather than large books and manuals and do not have many thoughts :-) Definitely, It would be nice having a style system similar to CSS. I think it is worth keeping "cl-typesetting light" engine away from heavyweight features. For example, I usually exclude the hyphenation module and pre/post-decoration from my production version as they make things several times slower. (You can make a difference by simply commenting out the methods and in stroke.lisp.) -- Sincerely, Dmitriy Ivanov lisp.ystok.ru From hmaseko at gmail.com Sat Apr 28 17:36:55 2007 From: hmaseko at gmail.com (Harrison Maseko) Date: Sat, 28 Apr 2007 19:36:55 +0200 Subject: [cl-typesetting-devel] Newbie needs Message-ID: <46338640.7dbfbb69.6be0.33da@mx.google.com> Hello cl-typesetters, I am totally new here and just trying to learn cl-typesetting. A quick question: How do I load cl-typesetting into my LispWorks personal edition running on Windows? Harrison No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.467 / Virus Database: 269.6.1/778 - Release Date: 4/27/2007 1:39 PM -------------- next part -------------- An HTML attachment was scrubbed... URL: From marc.battyani at fractalconcept.com Sat Apr 28 20:31:54 2007 From: marc.battyani at fractalconcept.com (Marc Battyani) Date: Sat, 28 Apr 2007 22:31:54 +0200 Subject: [cl-typesetting-devel] Newbie needs References: <46338640.7dbfbb69.6be0.33da@mx.google.com> Message-ID: <318801c789d4$42618d70$1402a8c0@marcx2> Harrison Maseko wrote: >I am totally new here and just trying to learn cl-typesetting. >A quick question: How do I load cl-typesetting into my LispWorks >personal edition running on Windows? First you need to load cl-pdf which is needed by cl-typesetting. There is are .asd files for asdf for cl-pdf and cl-typesetting. In any case you need to learn about ADSF as most libraries use it: http://www.cl-user.net/asp/libs/ASDF LW is sure to be OK. Marc From brian.sorg at liberatinginsight.com Sun Apr 29 18:18:19 2007 From: brian.sorg at liberatinginsight.com (Brian Sorg) Date: Sun, 29 Apr 2007 14:18:19 -0400 Subject: [cl-typesetting-devel] Newbie needs In-Reply-To: <46338640.7dbfbb69.6be0.33da@mx.google.com> References: <46338640.7dbfbb69.6be0.33da@mx.google.com> Message-ID: <1177870699.4066.8.camel@melody.liberating> Harrison - I am working on developing some introductory documentation to the cl-pdf and cl-typesetting systems. It is still pretty rough, but should help get you started. The initial sections are included in the cl-typesetting directory called documentation, which has a "Getting Started" chapter which should help. Also I am right in the middle of adding another chapter so I haven't updated the official release yet, but you can download the current version of the documentation from my website at http://www.liberatinginsight.com/cl-pdf/cl-pdf-doc.tar.gz (It has around 5 extra pages of new material. that is not yet released) Hope that helps and good luck. Brian Sorg On Sat, 2007-04-28 at 19:36 +0200, Harrison Maseko wrote: > Hello cl-typesetters, > > I am totally new here and just trying to learn cl-typesetting. A quick > question: How do I load cl-typesetting into my LispWorks personal > edition running on Windows? > > > > Harrison > > > > > > No virus found in this outgoing message. > Checked by AVG Free Edition. > Version: 7.5.467 / Virus Database: 269.6.1/778 - Release Date: > 4/27/2007 1:39 PM > > > _______________________________________________ > cl-typesetting-devel site list > cl-typesetting-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/cl-typesetting-devel -- Brian Sorg Director & Founder Liberating Insight LLC brian.sorg at liberatinginsight.com Mobile: 260-602-1086 Office: 260-918-0490