Existing HTML & LaTeX (or Quad projects) #68

Open
opened 4 years ago by kgruschow · 5 comments
kgruschow commented 4 years ago (Migrated from github.com)

Hi,

I'm returning to a large project after a year, but this time i have a deadline so to speak. The goal of the project is having a single source file to output 3 overlapping versions of a software manual into both a nicely built website and a print edition that is formatted for print. Pollen seems by far the easiest, but I'm literally just a government employee trying to raise quality while making a system someone else can take over. (possibly even letting users have access to the manual via git?)

At least from my perspective, it should be relatively simple based on what Pollen is capable of. I have some simplistic proof of concept work together already.... but I don't look forward to re-implementing basics like heading levels and especially lists.

So is there any available project source for 1 or more sources.poly.pm, template.html, template.tex, and a pollen.rkt file that converts typical structures (numeric and bulleted lists, title, chapter, images, etc) to their most basic forms in html and tex?

Thanks!
Karl

Hi, I'm returning to a large project after a year, but this time i have a deadline so to speak. The goal of the project is having a single source file to output 3 overlapping versions of a software manual into both a nicely built website and a print edition that is formatted for print. Pollen seems by far the easiest, but I'm literally just a government employee trying to raise quality while making a system someone else can take over. (possibly even letting users have access to the manual via git?) At least from my perspective, it should be relatively simple based on what Pollen is capable of. I have some simplistic proof of concept work together already.... but I don't look forward to re-implementing basics like heading levels and especially lists. So is there any available project source for 1 or more sources.poly.pm, template.html, template.tex, and a pollen.rkt file that converts typical structures (numeric and bulleted lists, title, chapter, images, etc) to their most basic forms in html and tex? Thanks! Karl
privong commented 4 years ago (Migrated from github.com)

This may be heretical here (and I'd love to be corrected) but to be honest, you might try pandoc. It sounds like you don't need the advanced tagging features of pollen or the "book is a program" power. If you have a deadline and only need varied section levels, lists, and image inclusion, writing something in Markdown and using pandoc to convert to other output formats might be your best bet. You'll still need to create a template.tex file that's appropriate to your publishing specs of course.

This may be heretical here (and I'd love to be corrected) but to be honest, you might try `pandoc`. It sounds like you don't need the advanced tagging features of pollen or the "book is a program" power. If you have a deadline and only need varied section levels, lists, and image inclusion, writing something in Markdown and using `pandoc` to convert to other output formats might be your best bet. You'll still need to create a template.tex file that's appropriate to your publishing specs of course.
kgruschow commented 4 years ago (Migrated from github.com)

I actually tried pandoc quite a bit, and I don't think it works well for this. The overlap in material between versions (that have to be maintained) is complicated, sometimes a sentence that is slightly differently worded, but also completely different screenshots, sometimes different chapters, etc.

I already have a method (basically pass the POLLEN environment variable into raco pollen on the commandline, then compile/rendering/starting, that allows quickly generated static web pages and/or LaTeX/PDF as desired.) While i felt like i was fighting Pollen's extension system too much, this was still easier than the equivalents. especially because the markup is way simpler.

From what I've seen pandoc does not cope well with that use case, because the things you do to have the conditions in the source, do not translate between html and latex. Pollen seems at least conceptually aimed at addressing this problem, avoiding the limitations of output formats, by enabling expressive semantic coding of the source.

Also I am intending to implement some other features that ive not seen pandoc handle well, such as generating table of contents and topic indices, etc for the html in addition to the LaTeX.
(while keeping the source file simple enough that someone can write it without understanding anything other than ◊index{})

I guess I'm just wanting to clarify, it's not that I want a quick dirty system to do the conversions, pandoc already is that. Rather, simply looking for if anyone else had a similar project to build form, to avoid having to spend lots of time essentially implementing the basics that pandoc does, before I can demonstrate why pollen is the better choice.

If anyone has an example of pandoc handling my use case and looking good, im happy to do that instead...

I actually tried pandoc quite a bit, and I don't think it works well for this. The overlap in material between versions (that have to be maintained) is complicated, sometimes a sentence that is slightly differently worded, but also completely different screenshots, sometimes different chapters, etc. I already have a method (basically pass the POLLEN environment variable into raco pollen on the commandline, then compile/rendering/starting, that allows quickly generated static web pages and/or LaTeX/PDF as desired.) While i felt like i was fighting Pollen's extension system too much, this was still easier than the equivalents. especially because the markup is way simpler. From what I've seen pandoc does not cope well with that use case, because the things you do to have the conditions in the source, do not translate between html and latex. Pollen seems at least conceptually aimed at addressing this problem, avoiding the limitations of output formats, by enabling expressive semantic coding of the source. Also I am intending to implement some other features that ive not seen pandoc handle well, such as generating table of contents and topic indices, etc for the html in addition to the LaTeX. (while keeping the source file simple enough that someone can write it without understanding anything other than ◊index{}) I guess I'm just wanting to clarify, it's not that I want a quick dirty system to do the conversions, pandoc already is that. Rather, simply looking for if anyone else had a similar project to build form, to avoid having to spend lots of time essentially implementing the basics that pandoc does, before I can demonstrate why pollen is the better choice. If anyone has an example of pandoc handling my use case and looking good, im happy to do that instead...
privong commented 4 years ago (Migrated from github.com)

Gotcha, I misunderstood your first post and the scope of the document. I can see where pandoc might be cumbersome for that.

I'm still quite new to pollen myself, but @otherjoel Has some example pollen projects, including: https://github.com/otherjoel/try-pollen . Perhaps one of those would help?

Gotcha, I misunderstood your first post and the scope of the document. I can see where pandoc might be cumbersome for that. I'm still quite new to pollen myself, but @otherjoel Has some example pollen projects, including: https://github.com/otherjoel/try-pollen . Perhaps one of those would help?
kgruschow commented 4 years ago (Migrated from github.com)

@privong thanks, I'd seen the TFL sources a bit, however the examples from @otherjoel are a lot closer to some of my use case and contain a lot of exactly the boiler plate that I was looking for:

(define (ul . elements)
  (case (current-poly-target)
    [(ltx pdf) `(txt "\\begin{itemize}" ,@elements "\\end{itemize}")]
    [else `(ul ,@elements)]))
(define (li . elements)
  (case (current-poly-target)
    [(ltx pdf) `(txt "\\item " ,@elements)]
    [else `(li ,@elements)]))

perfect thanks!!!

@privong thanks, I'd seen the TFL sources a bit, however the examples from @otherjoel are a lot closer to some of my use case and contain a lot of exactly the boiler plate that I was looking for: ``` (define (ul . elements) (case (current-poly-target) [(ltx pdf) `(txt "\\begin{itemize}" ,@elements "\\end{itemize}")] [else `(ul ,@elements)])) (define (li . elements) (case (current-poly-target) [(ltx pdf) `(txt "\\item " ,@elements)] [else `(li ,@elements)])) ``` perfect thanks!!!
otherjoel commented 4 years ago (Migrated from github.com)

Hope you find it useful! One thing to note: as you see, in these tag functions I emit the LaTeX inside either a txt or a txt-noescape X-expression rather than just as strings. This is so I can handle LaTeX escaping differently inside certain tags (using multiple passes of decode inside root). If you didn't need this capability, you could just emit strings, for example:

(define (ul . elements)
  (case (current-poly-target)
    [(ltx pdf) (format "\\begin{itemize}~a\\end{itemize}" (string-append* elements))]
    [else `(ul ,@elements)]))

(define (li . elements)
  (case (current-poly-target)
    [(ltx pdf) (format "\\item ~a" (string-append* elements))]
    [else `(li ,@elements)]))

Another thing is that in that repo I have separate LaTeX and PDF targets/templates, but these are mostly redundant to each other. The PDF one essentially does the same thing but automates the step of running xelatex to compile the PDF.

Hope you find it useful! One thing to note: as you see, in these tag functions I emit the LaTeX inside either a `txt` or a `txt-noescape` X-expression rather than just as strings. This is so I can handle LaTeX escaping differently inside certain tags (using multiple passes of `decode` inside `root`). If you didn't need this capability, you could just emit strings, for example: ```racket (define (ul . elements) (case (current-poly-target) [(ltx pdf) (format "\\begin{itemize}~a\\end{itemize}" (string-append* elements))] [else `(ul ,@elements)])) (define (li . elements) (case (current-poly-target) [(ltx pdf) (format "\\item ~a" (string-append* elements))] [else `(li ,@elements)])) ``` Another thing is that in that repo I have separate LaTeX and PDF targets/templates, but these are mostly redundant to each other. The PDF one essentially does the same thing but automates the step of running xelatex to compile the PDF.
This repo is archived. You cannot comment on issues.
No Milestone
No project
No Assignees
1 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: mbutterick/pollen-users#68
Loading…
There is no content yet.