Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Perl Typesetting

by crenz (Priest)
on Aug 28, 2002 at 09:42 UTC ( [id://193398]=perlmeditation: print w/replies, xml ) Need Help??

Fellow Monks,

I'm in the midst of the woes of writing a project report/thesis, using LaTeX, of course. And using an own document class. Anyone having used LaTeX can probably testify that

  • it is a very powerful and nice tool
  • it can drive you utterly insane when trying to accomplish simple design tasks
  • The syntax is appalling, once you have to deal with the internals

I'm fighting with things like aligning a picture next to a paragraph, having a horizontal line in the header with the name of the current section *below* it, etc. The motto seems to be: "Make the complicated things easier, and the easy things impossible". Still, it is the best alternative for scientific publishing...

One of the worst features of LaTeX, from my point of view, is it's modality. Too often you find that your solution will work e.g. in the text body, but not if you place it inside the page header, in a math mode environment or table. In its error messages, LaTeX will bombard you with weird code fragments that result from macro expansion etc. and you have a hard time finding out what's going on. *sigh*.

Then I started dreaming...

I dream of a typesetting system that doesn't get in my way. I dream of a system that allows me to express my design ideas in plaintext files, and converts it them to beautiful PDFs (well, somebody can create a GUI if they want). This system will not attempt to think for me, it will just do what I want. It is flexible and extensible. While it truly separates form from content, it allows for the same amount of graphical flexibility like Quark or Pagemaker. Without requiring a PhD in abstraction and programming. It will support layers and allow me to place objects at arbitrary positions because I want them to be there, yet at the same time help me position objects whose location I don't care about in a nice and beautiful way.

Then it ocurred to me that Perl has most if not all the components needed: PDF file generation, (Truetype) font handling, interfaces to graphics files, spell checkers, Unicode... Heck, it could even format your XML data for you. And of course it handles plaintext parsing well. Plus having perl embededd for document creation would be wonderful...

Any takers for designing a sensible language and glueing it all together? :-)

Replies are listed 'Best First'.
Re: Perl Typesetting
by JaWi (Hermit) on Aug 28, 2002 at 10:26 UTC
    I feel your problem brother! I've had the same idea a while ago, but dropped it because I had to dive deeper into the dark internals of LaTeX which gave me a much better insight of ``how things should be done''.

    I don't think you shouldn't create yet another layer around LaTeX (which itself is a layer around the even more cryptic TeX) nor try to create a complete new typesetting language. LaTeX is around for so long and most people who know it have used it. Either they loved it -and are still using it-, or they hated it -and now are using Word or something similar-.

    What I do would like to see is a wrapper which filters the -indeed- cryptic errors of LaTeX and translate them into plain English. Nothing fancy, just something like:

    line 24: unexpected tag '{'.
    Well, these are my $0.02...

    -- JaWi

    "A chicken is an egg's way of producing more eggs."

Re: Perl Typesetting
by Abigail-II (Bishop) on Aug 28, 2002 at 13:27 UTC
    Any takers for designing a sensible language and glueing it all together? :-)
    It took Knuth the better part of a decade to write TeX, the system LATeX is build on top off. Knuth isn't J. Random Coder. How much time do you think it will take you to write something "better"?

    Abigail

      It took Knuth the better part of a decade ...
      I don't think that should stop anybody from taking a stab at it, though.

      In that decade, Knuth developed versions of TeX in Sail, Pascal, and finally even built his own "Web" programming system (Tangle/Weave) around the Pascal implementation. He also developed Metafont, and did three generations of Computer Modern typefaces. I know of at least one student of his whose Ph.D. topic was related to working on TeX (the hyphenation algorithms). Not to mention he carried on the rest of his academic work (although he did take sabbaticals). In typical Knuthian fashion, his analysis carried him from a relatively simple task (fix the poor printed quality of Volume 1) to a huge multi-year endeavor.

      I know a great example for this, but I can't seem to find a link. I clearly recall a sidebar to the "Literate Programming" paper by Knuth that appeared in Comm. of ACM. Knuth developed a three- or four-page program to show how something would look in Web (actually, it was a little cheating, because what was published was actually the Weave output, not the original input text). Immediately following it was a short critique by Jon Bentley (of "Programming Pearls"). He developed a three-line shell script that accomplished the same thing. Granted, it wasn't publication-worthy, but it got the job done in a fraction of the time.

      So while I agree with you that it will probably take more than the 15 years it took Knuth to duplicate what he did, I disagree that something "better" implies "bigger" -- quite the opposite, really. (Not to imply that I think developing a good typesetting program is easy or quick.)

      If a certain Finnish student had believed that about operating systems, the computing landscape would look different today!

      I'm aware of that and I respect both Donald Knuth and Leslie Lamport's work. That's why I consider it the best tool available and use it myself, and why I didn't suggest I could do something "better".

      On the other hand and as a matter of personal taste, I find the tool still quite arcane in structure*. "Built on top" is a word that describes a lot of concepts in TeX/LaTeX too well. And seeing the vast array of technologies that are available for perl right now (and that weren't when Knuth started to work on TeX), I do find the dream of a perl-based, modular typesetting system that is more suited to my thought process quite tempting.

      *I could say the same about (Microsoft|Open)Office, by the way. Pen and paper are a very natural interface, but the abstractions chosen by either technology don't even come close.

Re: Perl Typesetting
by Django (Pilgrim) on Aug 28, 2002 at 23:57 UTC

    My profession started out with grafic design and typography is one of my passions. Now I'm working with monospaced code most of my time, and I'm often trying to link those fields in one way or another.

    Considering the rational, informational aspect of visual/written communication, I think that less is more. We need only a few simple, structural elements and one most readable font family. Data structures might be POD (very sexy ;), XML (flexible), HTML (quick & dirty), you name it... To keep things straight, most of the actual visual interpretation should be left to the user. He's interested primarily in the information, not our visual style.

    When you're up for individual, high quality design however, you will need specialized tools that let you do the design, not the markup (thinking of QuarkXpress, Freehand, Photoshop etc.)

    Keep it straight and simple!

    ~Django
    "Why don't we ever challenge the spherical earth theory?"

      We need only a few simple, structural elements and one most readable font family.

      I agree, but these are easy things, so they should be easy to implement, right? Sometimes, they are not. See the examples I gave.

      When you're up for individual, high quality design however, you will need specialized tools that let you do the design, not the markup (thinking of QuarkXpress, Freehand, Photoshop etc.)

      However, these tools defy automatization. Sure, Photoshop has it's own scripts, but it cannot be scripted from outside, using e.g. perl. LaTeX is used a lot these days to generate documents that need to use a certain fixed layout. For example, think of generating a couple hundred PDF spec sheets for products out of a database.

      Tools like LaTeX are not suitable for one-page, "screaming ad"-like design. They are meant for designs that are reused (like in a thesis). And that is where I think we need a tool that doesn't suck.

        For example, think of generating a couple hundred PDF spec sheets for products out of a database.

        I think XML to PDF is a good approach to that. I've done that with XSLT and FO ("Formatting Objects"), using Resin and Apaches FOP. The W3 specs for FO are exactly what you need when formatting for print, but unfortunately some essentials are not supported by the current FOP implementation. So it's still impossible to make your PDFs look really good with FOP. I don't know about the alternatives in perl, but I'd rather help improving existing tools, than trying to develop another incomplete solution from scratch.

        ~Django

        "Why don't we ever challenge the spherical earth theory?"

Re: Perl Typesetting
by FoxtrotUniform (Prior) on Aug 28, 2002 at 20:58 UTC

    Heh. After dealing with RTF, LaTeX seems like a pillar of elegance and grace. (Don't do RTF, kids. It'll rot your mind.)

    I don't know about you, but almost everything I write has very basic formatting needs: section headings, bold/italic/underline control, maybe some font selection control, and bulleted (and numbered) lists are a plus. I already have code (patched HTML::FromText -- one of these days I'll even finish it and release it!) to take casually formatted (*bold*, _underline_, etc) text and turn it into acceptable HTML; it shouldn't be terribly difficult to adapt that to produce LaTeX (or ?roff) markup, instead. Start small....

    --
    F o x t r o t U n i f o r m
    Found a typo in this node? /msg me
    The hell with paco, vote for Erudil!

      And there's always Pod::Parser. :-) The Camel book even was written in POD..

      Makeshifts last the longest.

Re: Perl Typesetting
by John M. Dlugosz (Monsignor) on Aug 28, 2002 at 20:03 UTC
    After learning and using regular TeX, I looked at LaTeX and found it too nasty.

    Eventually, I gave up on TeX, thinking I'd rather have copious documentation than the most beautiful documentation.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://193398]
Approved by erikharrison
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-19 16:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found