Re: [9fans] drawterm bug
On Mon Mar 21 11:38:22 EDT 2011, quans...@quanstro.net wrote: this is drawterm on osx 10.6 to plan 9. i don't have time to investigate right now, but here's the bug looks like sign extension. minooka; cp /mnt/term/tmp/file.gz . cp: error reading /mnt/term/tmp/file.gz: negative i/o offset minooka; ls -l --rw-r--r-- M 1638 xxx xxx 2147483648 Mar 21 11:05 file.gz it wasn't hard to get a reproducer: ; dd -iseek 2147483640 -count 10 -if /mnt/term/dev/zero -of fubar -bs 1 read: negative i/o offset 8+0 records in 8+0 records out this smelled like a sign extension bug, and sure enough, it was in the first place i looked hg diff include/fcall.h diff -r 005885bfe3f2 include/fcall.h --- a/include/fcall.h Tue Dec 28 16:40:27 2010 -0500 +++ b/include/fcall.h Tue Mar 22 10:28:00 2011 -0400 @@ -37,7 +37,7 @@ #defineGBIT8(p)((p)[0]) #defineGBIT16(p) ((p)[0]|((p)[1]8)) #defineGBIT32(p) ((p)[0]|((p)[1]8)|((p)[2]16)|((p)[3]24)) -#defineGBIT64(p) ((vlong)((p)[0]|((p)[1]8)|((p)[2]16)|((p)[3]24)) |\ +#defineGBIT64(p) ((u32int)((p)[0]|((p)[1]8)|((p)[2]16)|((p)[3]24)) |\ ((vlong)((p)[4]|((p)[5]8)|((p)[6]16)|((p)[7]24)) 32)) #definePBIT8(p,v) (p)[0]=(v) hg is a pain, so the drawterm-fixes patch queue broke as soon as russ pulled in some changes. i'll try to work out how to get this up while causing minimal chaos. - erik
[9fans] troff macros for typesetting books/longer texts
Hello everyone, please, does somebody know of any troff macros that were used to typeset books? Can one get hold of e.g. macros used to typeset e.g. The AWK Programming Language by Aho, Kernighan and Weinberger, or “The Unix Programming Environment” by Kernighan and Pike? I want to particularly know how headings were programmed. I.e., how the name of a chapter that is only to appear on a page gets to its heading. I feel that either the file must be processed twice, or one must write a heading of a page only when the page is about to be completed (one would then back up to the heading position, write it, and only then continue). Thanks Ruda
Re: [9fans] troff macros for typesetting books/longer texts
http://troff.org has some good information. I especially recommend Richard Stevens' notes on typesetting (TCP Illustrated et al) at http://www.kohala.com/start/ (see the 'Typesetting' section towards the end of that page). --lyndon
Re: [9fans] drawterm bug
that was an ordeal. here's the patch queue https://bitbucket.org/quanstro/drawterm-fixes/changesets - erik
Re: [9fans] troff macros for typesetting books/longer texts
On 22 March 2011 18:30, Lyndon Nerenberg lyn...@orthanc.ca wrote: http://troff.org has some good information. I especially recommend Richard Stevens' notes on typesetting (TCP Illustrated et al) at http://www.kohala.com/start/ (see the 'Typesetting' section towards the end Actually, I know of both mentioned places. But, as far as I know, the very macros are not discussed anywhere. But I may be, of course, wrong. Thanks Ruda
Re: [9fans] drawterm bug
On Mar 22, 2011, at 9:40 AM, erik quanstrom wrote: hg is a pain, so the drawterm-fixes patch queue broke as soon as russ pulled in some changes. i'll try to work out how to get this up while causing minimal chaos. I've found that using hg mq stacks of patches are a pain. But that's just my experience with the tool. It's all too easy to think that a patch is applied out of some mq managed stack just to find that it clearly is not once attempting to submit it upstream. Pull, try to update just to realize that you've got to hg qpop -a first, then remember to stuff things back in the right order. Needs work, well, time, it takes time. -jas
Re: [9fans] drawterm bug
back in the right order. Needs work, well, time, it takes time. hey, wait a second ... i thought that was the whole point of hg, to save time. :-) there were some definate gotchas - hg diff doesn't do the right thing with a patch queue. - hg qpush is terribly misnamed; and hg push --mq is just a poke in the eye. - bitbucket tracks qupdate not qcommit. i don't understand this. - erik
Re: [9fans] drawterm bug
On Mar 22, 2011, at 12:51 PM, erik quanstrom wrote: back in the right order. Needs work, well, time, it takes time. hey, wait a second ... i thought that was the whole point of hg, to save time. :-) It does, as long as you don't use certain extensions. there were some definate gotchas - hg diff doesn't do the right thing with a patch queue. - hg qpush is terribly misnamed; and hg push --mq is just a poke in the eye. - bitbucket tracks qupdate not qcommit. i don't understand this. Cloning and not using quilted patch queues does man you can work along in your branch of code as needed. Flush out a change, diff it w/ someone other revision/tip/repository and go to town. Export the changes upstream and it is a bit easier, even push them. I've just not taken the time to fully grok the way Bitbucket and a few others use mq. Too much complexity triggers the trap. -jas
Re: [9fans] troff macros for typesetting books/longer texts
Actually, I know of both mentioned places. But, as far as I know, the very macros are not discussed anywhere. But I may be, of course, wrong. My guess is these works fall into two categories: 1) the author uses (say) ms, and extends it with macros in the document source code to achieve the bits that pure ms doesn't provide. 2) the author starts with (say) ms, then customizes it for the specific task at hand. In either case, the customizations are locked in with the document source and don't get distributed. Or they are so tied in with a specific document that they're of no practical use as standalone tools. I've done both when writing documentation, and in all those years I've never come up with a macro package specifically for that task. The reason being there is too much variablity in what I need. The effort it would require to write a general purpose macro package to encompass all those variations would be self defeating. It's considerably faster (for me) to do these customizations on a per-document basis. Over the years I have developed patterns in how I design these one-offs, but the results are never quite the same between any two documents. I usually use ms as the scaffolding, writing additional macros to provide the higher level concepts (e.g. chapters). While it's possible to muck around inside the ms macros themselves, the result isn't portable. I've learned to be careful not to get too caught up in trying to make ms do things it doesn't want to. Sometimes it's easier to just write your own macro set for the specific task at hand. (Re-implementing basics like .LP, .PP, .IP, .SH, etc. is quite easy if you don't require all the generalizations ms provides.) --lyndon
Re: [9fans] troff macros for typesetting books/longer texts
On Tue, Mar 22, 2011 at 11:21:55AM -0700, Lyndon Nerenberg wrote: [...] In either case, the customizations are locked in with the document source and don't get distributed. Or they are so tied in with a specific document that they're of no practical use as standalone tools. [...] This is a general pattern. I'm not a troff but a TeX user, and just seeing that learning how to use the full potential of TeX to match my own needs was easier, shorter in time, and less expensive---because of D.E. Knuth's TeXbook---than trying to learn how to _use_ some instance of LaTeX, I still don't understand why others... I know that it is less effort to climb a mountain via a lengther but less sloping road... but it must not be endless because flat and must reach the top. The best thing I learnt while aging is not how to do more efficiently, but how to have time doing knowing where to look for the needle stopping to search the internet hay stack. If there is no good short authoritative book on troff, and if you are not already proficient in troff, try TeX instead simply because of the TeXbook if not something else. -- Thierry Laronde tlaronde +AT+ polynum +dot+ com http://www.kergis.com/ Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C
Re: [9fans] troff macros for typesetting books/longer texts
On Tue, Mar 22, 2011 at 07:46:17PM +0100, tlaronde wrote: If there is no good short authoritative book on troff, and if you are not already proficient in troff, try TeX instead simply because of the TeXbook if not something else. And mind you, I know for sure there is TeX for Plan9---even if I'm the only one interested in it; but it is published as a side effect of my own needs, not as a goal. -- Thierry Laronde tlaronde +AT+ polynum +dot+ com http://www.kergis.com/ Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C
Re: [9fans] troff macros for typesetting books/longer texts
If there is no good short authoritative book on troff, and if you are not already proficient in troff, try TeX instead simply because of the TeXbook if not something else. And mind you, I know for sure there is TeX for Plan9---even if I'm the only one interested in it; but it is published as a side effect of my own needs, not as a goal. the Teχbook may be authoratative, but it's by no means short. - erik
Re: [9fans] troff macros for typesetting books/longer texts
On Tue, Mar 22, 2011 at 02:48:58PM -0400, erik quanstrom wrote: If there is no good short authoritative book on troff, and if you are not already proficient in troff, try TeX instead simply because of the TeXbook if not something else. And mind you, I know for sure there is TeX for Plan9---even if I'm the only one interested in it; but it is published as a side effect of my own needs, not as a goal. the Te?book may be authoratative, but it's by no means short. You can get started with the very first chapters. And once you stumble upon something more special, you pick up the book. 300 pages without the appendices, and with exercices it's short; and exhaustive. Compare with books about LaTeX. -- Thierry Laronde tlaronde +AT+ polynum +dot+ com http://www.kergis.com/ Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C
Re: [9fans] drawterm bug
i feel your pain. i went through the process for a patch queue to support ARM. FYI, when i mentioned this to Russ, he said I could email him the patch. I think if it's small enough it's probably the best way. unfortunately, i need this patch asap. it's causing real problems on machines i can't compile for. it's interesting that all these problems could be viewed as self-inflicted. a plan 9 program would be automaticly updated for everybody on the fs. and i could trivally compile for other machines. - erik
Re: [9fans] troff macros for typesetting books/longer texts
On Tue, 22 Mar 2011 19:46:17 BST tlaro...@polynum.com wrote: If there is no good short authoritative book on troff, and if you are not already proficient in troff, try TeX instead simply because of the TeXbook if not something else. Most TeX users are actually latex users, not raw TeX so the TeXbook is not terribly useful. But there are good books on latex and there is a wealth of material online ( many packages that work with latex). With TeXworks and TeXshop on the Mac writing latex docs has become more pleasant. Still, it is much easier to learn to use troff (speaking as a user; never tried writing a macro package for it). A lot of things just work.
Re: [9fans] troff macros for typesetting books/longer texts
On Tue, Mar 22, 2011 at 12:08:21PM -0700, Bakul Shah wrote: Most TeX users are actually latex users, not raw TeX so the TeXbook is not terribly useful. But there are good books on latex and there is a wealth of material online ( many packages that work with latex). With TeXworks and TeXshop on the Mac writing latex docs has become more pleasant. Still, it is much easier to learn to use troff (speaking as a user; never tried writing a macro package for it). A lot of things just work. I'm not an integrist, and as long as someone is comfortable with troff, I don't see why he should switch to TeX. The converse is true. But most of the difficulties with TeX come precisely because this is not plain TeX: plain TeX (i.e. the macros from D.E. Knuth) just work too. But TeX is hidden---see the comments I received at first: why do you want to make a TeX package? People only use LaTeX... And I think that I have the right to say that if some people had really grasped TeX and al., they would never have done the mess the distributions of the system are now. -- Thierry Laronde tlaronde +AT+ polynum +dot+ com http://www.kergis.com/ Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C
Re: [9fans] troff macros for typesetting books/longer texts
the Te?book may be authoratative, but it's by no means short. You can get started with the very first chapters. And once you stumble upon something more special, you pick up the book. 300 pages without the appendices, and with exercices it's short; and exhaustive. Compare with books about LaTeX. i'm going to call this the latin is easy theory. cantonese and arabic are much harder to learn. ☺ But most of the difficulties with TeX come precisely because this is not plain TeX: plain TeX (i.e. the macros from D.E. Knuth) just work too. But TeX is hidden---see the comments I received at first: why do you want to make a TeX package? People only use LaTeX... most of the difficulties of teχ are because it's a macro language. macros don't scale. dek did a wonderful job, but you just can't paper over the fact that all this wierd macro expansion is going on. - erik
Re: [9fans] troff macros for typesetting books/longer texts
There's 'Document formatting and Typesetting on the Unix System, Vol. I II' by Narain Gehani and Steven Lally. They're available on alibris at a cheap price. I unfortunately haven't had time to read them yet. I know there's also more listed at troff.org. On Mar 22, 2011 2:46 PM, tlaro...@polynum.com wrote: On Tue, Mar 22, 2011 at 11:21:55AM -0700, Lyndon Nerenberg wrote: [...] In either case, the customizations are locked in with the document source and don't get distributed. Or they are so tied in with a specific document that they're of no practical use as standalone tools. [...] This is a general pattern. I'm not a troff but a TeX user, and just seeing that learning how to use the full potential of TeX to match my own needs was easier, shorter in time, and less expensive---because of D.E. Knuth's TeXbook---than trying to learn how to _use_ some instance of LaTeX, I still don't understand why others... I know that it is less effort to climb a mountain via a lengther but less sloping road... but it must not be endless because flat and must reach the top. The best thing I learnt while aging is not how to do more efficiently, but how to have time doing knowing where to look for the needle stopping to search the internet hay stack. If there is no good short authoritative book on troff, and if you are not already proficient in troff, try TeX instead simply because of the TeXbook if not something else. -- Thierry Laronde tlaronde +AT+ polynum +dot+ com http://www.kergis.com/ Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C
Re: [9fans] troff macros for typesetting books/longer texts
On Mar 22, 2011, at 3:50 PM, Jacob Todd wrote: There's 'Document formatting and Typesetting on the Unix System, Vol. I II' by Narain Gehani and Steven Lally. They're available on alibris at a cheap price. I unfortunately haven't had time to read them yet. I know there's also more listed at troff.org. I've read Volume I (yay local libraries). It's good - works well for both introduction and reference, in different parts. I can't compare it to any books in the TeX world, not having read them. Anthony PGP.sig Description: This is a digitally signed message part
Re: [9fans] troff macros for typesetting books/longer texts
A very gentle introduction about Troff macros is A TROFF Tutorial by Kernighan. (http://www.kohala.com/start/troff/troff.html) A great and complete book with macros like you are looking for is Unix Text Processing. You can download it from http://oreilly.com/openbook/utp/ On Tue, Mar 22, 2011 at 6:10 PM, Rudolf Sykora rudolf.syk...@gmail.com wrote: Hello everyone, please, does somebody know of any troff macros that were used to typeset books? Can one get hold of e.g. macros used to typeset e.g. The AWK Programming Language by Aho, Kernighan and Weinberger, or “The Unix Programming Environment” by Kernighan and Pike? I want to particularly know how headings were programmed. I.e., how the name of a chapter that is only to appear on a page gets to its heading. I feel that either the file must be processed twice, or one must write a heading of a page only when the page is about to be completed (one would then back up to the heading position, write it, and only then continue). Thanks Ruda
Re: [9fans] troff macros for typesetting books/longer texts
the Teχbook may be authoratative, but it's by no means short. This is the argument I'd stand by. I read the TeXBook and used (plain)Tex much before ever touching troff, thus I have a good idea about how it is written and explained. Being a physicist, I use latex for writing articles. I have discovered troff much later, basically because of plan9 (I had known of troff's existence, sure, but never thought of trying it out). Basically, seeing the conciseness and lucidity of works by Kernighan (eqn, tbl documentation)---few extremely nice pages you can read over a coffee---made me plunge into the troff's waters. As I said many times, TeX is superior in (mainly math) quality. However, troff and its preprocessors (eqn, tbl, grap,...) seem smaller and more elegant to me. Eqn input is rather legible in the source (even more with the ability to use utf-8 letters in place of e.g. alpha; but this I think is now possible in some versions of TeX, too, I believe). Note, that neither plainTex nor troff handle cross-references, automatic equation numbering, footnote numbering, table of contents, etc. Nonetheless, mainly these listed features are often so needed. One way out has been latex, which shows, in my opinion, how things should not be done. There is also eplain, a much better choice for me (plain extended with the mentioned almost always wanted features, and some most frequent latex macros like graphix). What I am trying to get is something like eplain, but for troff. And I wanted to have a look at how some things are to be done. And to not invent a wheel, I asked for some *simple* macros, which must have been used e.g. in the mentioned books in my 1st contribution. Just now I am reading Unix Text Processing by Dale Dougherty and Tim O'Reilly, a freely available book (pmartin proposes it as well). There are several chapters on the topic, so perhaps I'll get what I want in the end. Thanks Ruda
Re: [9fans] troff macros for typesetting books/longer texts
On Tue, Mar 22, 2011 at 10:00:12PM +0100, Rudolf Sykora wrote: Note, that neither plainTex nor troff handle cross-references, automatic equation numbering, footnote numbering, table of contents, etc. Nonetheless, mainly these listed features are often so needed. Well I use a package called... MisTeX (my own), that is simply some macros doing this and ridding piggy-back on plain TeX. (And BibTeX added to kerTeX is compatible with plain TeX; cross references for pdf are here with a macro file and support from dvips(1); the footnote are explained in the TeXbook etc.) But as I said before, this is not for me a religious case. It happens that I made my way with TeX (LaTeX was not my cup of tea from the very beginning) without knowing troff. Stevens' books were made with troff and ed(1) IIRC, and they are worth reading for Unix/POSIX programming, and pleasant to read due to their presentation/formatting. -- Thierry Laronde tlaronde +AT+ polynum +dot+ com http://www.kergis.com/ Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C
Re: [9fans] troff macros for typesetting books/longer texts
But as I said before, this is not for me a religious case. It happens that I made my way with TeX (LaTeX was not my cup of tea from the very beginning) without knowing troff. Anyway, I do keep an eye on what you do with KerTeX. I appreciate this. Having seen those 1GB TeX distributions out now... it's definitely uplifting to see something saner. Ruda
Re: [9fans] troff macros for typesetting books/longer texts
Just now I am reading Unix Text Processing by Dale Dougherty and Tim O'Reilly, a freely available book (pmartin proposes it as well). There are several chapters on the topic, so perhaps I'll get what I want in the end. I was going to mention that one, but I figured it was so long out of print as to be unobtainable. I should know better, though. abebooks.com has found me a wealth of long out-of-print UNIX material. My moment of truly understanding troff was when I stopped thinking of it as a typesetting program, and instead recognized it as a programming language. After that little epiphany, much of the smoke cleared. If you re-read the troff paper in that light, a syntax that initially appears to be line noise magically transforms itself into a concise and elegantly consistent language. There's no denying it's cryptic, though. But once you recognize the consistency of the syntax, it's a marvel to behold. There's no denying it has its warts. Number registers that are strings still offends my sensibilities, but as with irregular verbs, pretty soon you just learn to accept them and carry. But the one bit of troff black magic I still can't get my head around, even after 25 years, is how the hell .wh page-bottom traps are supposed to work :-P As for indexes, the me macro package provides macros for generating index entries: .(x and .)x. You can look in /sys/lib/tmac/tmac.e to see how they are defined. Plan 9 doesn't seem to provide any documentation for the me macros, though. I'm pretty sure Stevens talked about index creation on his web site, and you might want to check Brian Kernighan's web pages as well. --lyndon
Re: [9fans] troff macros for typesetting books/longer texts
Hello everyone, please, does somebody know of any troff macros that were used to typeset books? Can one get hold of e.g. macros used to typeset e.g. The AWK Programming Language by Aho, Kernighan and Weinberger, or “The Unix Programming Environment” by Kernighan and Pike? I want to particularly know how headings were programmed. I.e., how the name of a chapter that is only to appear on a page gets to its heading. I feel that either the file must be processed twice, or one must write a heading of a page only when the page is about to be completed (one would then back up to the heading position, write it, and only then continue). I'm currently in the process of re-typesetting my books using troff. Once completed, I plan to make the troff sources and build system available alongside the output. The links mentioned in this thread are basically the same documents I've worked from during this process. In addition, I purchased the Gehani books a while back; they contain a lot of helpful information, although Gehani seems to favor mm over ms. -sl
Re: [9fans] troff macros for typesetting books/longer texts
seem to provide any documentation for the me macros, though. I'm pretty sure Stevens talked about index creation on his web site, and you might want to check Brian Kernighan's web pages as well. --lyndon Yes, that's true. He discusses an index production. Basically, if I remember, he uses software described in Tools for printing indexes by Bentley Kernighan. Ruda
Re: [9fans] troff macros for typesetting books/longer texts
Note, that neither plainTex nor troff handle cross-references, automatic equation numbering, footnote numbering, table of contents, etc. Nonetheless, mainly these listed features are often so needed. ... What I am trying to get is something like eplain, but for troff. And I wanted to have a look at how some things are to be done. And to not invent a wheel, I asked for some *simple* macros, which must have been used e.g. in the mentioned books in my 1st contribution. I'd suggest digging around for macro sets people created for various schools' thesis and dissertation formats. I expect several of us have done that and have included auto numbering of chapters, sections, equations, tables, figures, etc. If I look hard enough, I might even be able to find the ones I did 20 some-odd years ago for my master's thesis, but I'm pretty sure I won't get able to get to it until at least this weekend. BLS
Re: [9fans] troff macros for typesetting books/longer texts
I have only hesitated over the way (as described in my original, 1st, post) how references that *depend on physical placement* of certain text are to be coped with. (As with my page headings; or---probably even harder so that at least 2-runs of troff are inevitable---references to page numbers where sth is mentioned. But I really need just the headings now.) For page headers and footers, the tutorial section in the Troff paper should have enough to get you going (/sys/doc/troff.ps, pages 34 on). For section and index cross-references to page numbers, you pretty much have to do two passes, writing the xref data to an external file that gets read in the table of contents or index sections as appropriate. (You read and write the xref data file from inside troff itself using .so and .tm.) For what it's worth, spending a couple of days studying the ms macro package source code should give you a lot of ideas. And a headache ;-) --lyndon
Re: [9fans] troff macros for typesetting books/longer texts
I believe it won't be hard to write a script to translate bibtech references to refer's I have a refer contrib package, mostly based on forsyth's port but which includes a few tweeks and bib2ref.c which attempts, rather naïvely, to do this translation. -Steve
Re: [9fans] troff macros for typesetting books/longer texts
I believe it won't be hard to write a script to translate bibtech references to refer's I have a refer contrib package, mostly based on forsyth's port but which includes a few tweeks and bib2ref.c which attempts, rather naïvely, to do this translation. i put both on my system last year for iwp9, but they were in such poor shape (at least the copies i got), that i removed them. i think everybody would appreciate one xor the other cleaned up, de-pccified and added to the distribution. - erik