this post was submitted on 10 Oct 2024
9 points (100.0% liked)

Technology

35129 readers
85 users here now

This is the official technology community of Lemmy.ml for all news related to creation and use of technology, and to facilitate civil, meaningful discussion around it.


Ask in DM before posting product reviews or ads. All such posts otherwise are subject to removal.


Rules:

1: All Lemmy rules apply

2: Do not post low effort posts

3: NEVER post naziped*gore stuff

4: Always post article URLs or their archived version URLs as sources, NOT screenshots. Help the blind users.

5: personal rants of Big Tech CEOs like Elon Musk are unwelcome (does not include posts about their companies affecting wide range of people)

6: no advertisement posts unless verified as legitimate and non-exploitative/non-consumerist

7: crypto related posts, unless essential, are disallowed

founded 5 years ago
MODERATORS
 

{Solved Thanks}

Would there be any interest? header tags are used to make table of contents, anchor tags create Index entries, all the formatting tags (tables, un-numbered and numbered lists etc) do basic print formatting. All the bold/underline/italic also render to paper. Sort of like a poor man's TeX.

Has anyone done this?

top 9 comments
sorted by: hot top controversial new old
[–] [email protected] 2 points 2 months ago

Thanks all - It seems there are many ways to do this, or perhaps just write the document in markdown and print it that way. I mean I guess I could always install and lear TeX (again) too.

[–] [email protected] 1 points 2 months ago

I write business letters in HTML. I have a custom letter.css and a base letter.html+.js that loads individual letters into a template. I have some custom tags for date, address and similar. The individual docs are super clean. I can export compiled html files with embedded css (no js needed) and images that render perfectly and are even smaller then the pdfs I export (print) and those are small too.

Two downsides. The biggest problem, I didn't find a way to do proper multi page docs. And especially Firefox has limited print css support.

Second: everything is crudely hacked together and in no way usable by others...

maybe chatgpt can rewrite the code better, so I can publish it?

[–] [email protected] 2 points 2 months ago

I use this one, and it's pretty nice: https://weasyprint.org/. They implement their own rendering engine so its support of new features and edge cases isn't the best, but every problem I've run into with it has been solvable with a little work. I really like it for laying out printed forms!

[–] [email protected] 6 points 2 months ago

There's a lot of libraries that convert html to markdown (and in the process get rid of all the javascript spyware).

The android app markdownr can do this on the fly, and I had an idea to create a markdown web browser using that as a base, but no time to work on it.

[–] [email protected] 4 points 2 months ago

Yes this is a thing and it's been around for quite some time. If you're trying to approximate TeX, you may also be interested in MathML.

I need to go lay down; I'm having flashbacks to the good old days of "XML everywhere for everything all the time".

[–] [email protected] 4 points 2 months ago

I mean you can do HTML -> TeX -> PDF with Pandoc, or to any other format pretty much. I would say writing markdown and passing it to TeX or directly to PDF is the most practical.

[–] [email protected] 15 points 2 months ago (2 children)

This sounds like the CSS @media print with extra steps

[–] [email protected] 2 points 2 months ago

Always frustrates me how underutilized @media print is. Always liked crafting some good CSS for it on sites, especially ones that I worked on that were document heavy.

[–] [email protected] 7 points 2 months ago* (last edited 2 months ago)

I used to write my papers in HTML and a custom print CSS file I made so it fits the school's formatting requirements. It worked surprisingly well. Just write HTML, and then just print it, as basic as it gets. That was easier than bending LaTeX to the school's template which was in MS Office format.