Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

producing fancy text

by BernieC (Pilgrim)
on Aug 21, 2020 at 14:35 UTC ( [id://11120962]=perlquestion: print w/replies, xml ) Need Help??

BernieC has asked for the wisdom of the Perl Monks concerning the following question:

Is there a {easy?} way to generate "fancy" documents from Perl. The kind of things I'm looking for is fonts, italics, tables. Nothing really fancy {like automatic tables of contents or indexes}. Two ways come to mind that might to work: one is to generate a LaTeX file and then format it with LaTeX. The other is to generate HTML I find LaTeX a bit too fussy and messy, but it would be doable, but I'm leaning toward that latter one. HTML isn't particularly nice for making hardcopy {or PDFs} since I don't *think* there's any notion of things like page breaks, headers and footers, etc, in HTML but it is awfully easy to generate. Has anyone found a way to do this kind of thing?

Replies are listed 'Best First'.
Re: producing fancy text
by aitap (Curate) on Aug 21, 2020 at 16:05 UTC
    You can also consider Markdown or any other "lightweight" markup supported by pandoc if you can afford a Haskell binary as a dependency.
Re:producing fancy text
by LanX (Saint) on Aug 21, 2020 at 18:09 UTC
    It depends on your notion of "fancy" and your tolerance of dependencies.

    Modern CSS can do all of this, but you'll need a browser like app to produce PDF.

    Since HTML is NOT supposed to be a print format you'll end up with the same entropy like LaTeX.

    I'm using Emacs org-mode to have nice markup translated to LaTeX/PDF, also for beamer presentations.

    This hides the boilerplate for me, but LaTeX is not particularly fast.

    But without more clarification about your requirements it's a rather fuzzy question.

    Edit

    And of course it has been discussed before for many times. Just search the archives.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      I looked through the archives -- looks like I couldn't guess the right search terms { sigh, story of my life }.

      It sounds like LaTex might be the "easiest" option. If you're not doing anything too crazy LaTex isn't *too* bad. And if I pound on it hard enough I can get Perl-constructs that really do hide the strangeness.

      NB: I did this kind of thing for HTML years and years ago {this long before the advent of AJAX and all the super-fancy cgi packages}. Part of my job was writing CGI programs and I put together a little meta-package to make things easier {and the HTML less broken} I don't remember quite what I had done back-then any more, but it was handy things like italic(text) button(label, what to do), etc.

      I was mostly asking in general - e.g., I have a .txt file that is, basically, a long table. I was thinking it'd be nice if I could have it be nicer to read/use version but still have a simple/flat txt file that I can easily edit. I wondered if there was some XML stuff that might do that. As I said, I think that LaTex is probably the easiest path -- it is even worse than Word in terms of idiosyncrasies, but can easily figure it out and then I can have a simple source file and let Perl just handle making it LaTeX friendly.

        Maybe take a look at asciidoc, I found it useful some years ago.

        poj

Re: producing fancy text
by perlfan (Vicar) on Aug 22, 2020 at 13:18 UTC
    In additional to the suggestion of asciidoc below, there's also docbook (SGML based) - a good starting point may be Pod::DocBook. A MetaCPAN search for SGML is also a good starting point. Here is a pretty comprehensive list of mark up languages. SGML is the basis for some of them (e.g., docbook, linuxdoc), but certainly not all. I'd be remiss to not mention that quite a few things have been published using the old unix *roff family of text formatters.
Re: producing fancy text
by karlgoethebier (Abbot) on Aug 22, 2020 at 14:47 UTC

    LaTeX. See also

    «The Crux of the Biscuit is the Apostrophe»

    perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11120962]
Approved by Corion
Front-paged by haukex
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2024-04-19 11:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found