this post was submitted on 21 Apr 2024
35 points (97.3% liked)

Linux

47952 readers
1939 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

Hey people! I want to learn typst, a modern alternative to LaTeX written in Rust.

screenshot

Typst can incrementally compile the files to PDF.

Ironically, there is no incrementally refreshing PDF viewer afaik. So for direct visual output of my progress, I would like the fastest, smoothest PDF viewer.

It can be as small and minimal for that task as possible.

Priorities:

  1. No flicker (no text re-alignment, no disappearing scroll bars, no changing UI)
  2. Fast refresh
  3. Smooth text refresh (maybe with a fade in)
  4. Generally solid

To test:

  • evince / GNOME Document viewer
  • atril
  • mupdf
  • zathura
  • gv

Barebones:

Somehow monitor for changes

  • pipdf (GTK4, but unmaintained)
  • pdf_render (very minimal, maintained)
  • pdf2pwg (needs cargo add and cargo build, only A4 pages which seems totally sufficient)
  • pdf_renderer (security focused, pure Rust, may crash, incomplete)
all 27 comments
sorted by: hot top controversial new old
[–] Ephera@lemmy.ml 6 points 6 months ago* (last edited 6 months ago) (1 children)

If by "nonremovable popup" in Okular, you mean that little toast-like notification in the top-left, that can be turned off in Settings → Configure Okular... → General → "Show hints and info messages".

Not sure, what you mean by "dancing text". I'm using Okular for my Lilypond escapades, which is basically Latex for sheet music, so not a ton of text that could be dancing, but well, it doesn't.
You might be able to improve Okular's (text rendering) speed by tweaking the settings in Settings → Configure Okular... → Performance...

[–] boredsquirrel 1 points 6 months ago (3 children)

This is the flicker I meant

Thanks for the tip about the dialog! I will add that to the FR as a solution. It is not good to generally disable all warnings though.

[–] Ephera@lemmy.ml 2 points 6 months ago (1 children)

Ah, it does look like that for me, too. Yeah, the Okular icon is a bit weird there...

[–] boredsquirrel 1 points 6 months ago

Like, performancewise, why would you render an image in between 2 renders?

Or I suppose that may be a placeholder canvas with the icon.

Still, this is a stopper for future smooth transitions.

[–] skweintn2b@discuss.online 6 points 6 months ago

I use zathura for that. It's very minimal and one can use vim keybindings for navigation which I like

[–] pmk@lemmy.sdf.org 5 points 6 months ago (1 children)

I use the Gnome document viewer, and every time I recompile it automatically refreshes and keeps position etc. I compile with $ luatex <myfile.tex>, not sure if that matters.

[–] boredsquirrel 1 points 6 months ago (1 children)

I have tried that too, but not for this task. Well packaged, so I will compare it.

You know, I am looking for something that doesnt flicker, at all.

[–] pmk@lemmy.sdf.org 2 points 6 months ago (1 children)

I don't know about flicker, since I only recompile once in a while.

[–] boredsquirrel 1 points 6 months ago (1 children)

Yeah, that is likely the best way when you are more knowledgeable, but currently I would explore how to do everything with direct feedback.

[–] pmk@lemmy.sdf.org 2 points 6 months ago (1 children)

Oh yes, same for me if I'm positioning an image or making a table, I compile to double check every little edit to the code :) I just mostly have plain old text so no surprises.

[–] boredsquirrel 1 points 6 months ago (1 children)

Same. I really need to learn typst, it is very cool.

Markdown is kinda useless, because

  1. Always when I want to make notes, I want WYSIWYG to actually work with them. I dont write them for someone else or something. Pandocs defaults using texlive are bad, Okulars markdown style is also not very nice.
  2. I need something more powerful for actual papers, just like Typst. Possibly other candidates too, but it needs pagination and more.
[–] pmk@lemmy.sdf.org 2 points 6 months ago* (last edited 6 months ago)

I started with LaTeX back in the day, but it was too hacky and complex, so I went to ConTeXt, which felt more consistent and planned out. Then I did OpTeX for a while and eventually I picked up the TeXbook by Knuth and it all just started to make sense to me. So now I use plain TeX with my own macro file to fill the gaps in functionality, I implemented colour support and picture support and small macros that I needed. I am very much into grid typesetting, so I need to know where all the vertical material comes from. There are areas that still scare me, like modifying the output routine or several \expandafter in a row, but usually that's not needed. With plain TeX I can know every detail of the code down to the primitives. Of course this is possible in LaTeX too, but, there's just a lot of code, layer upon layer, and I'm not smart enough to keep all that in my head.

[–] MonkderDritte@feddit.de 4 points 6 months ago* (last edited 6 months ago) (1 children)

I think Evince and Atril have a setting for that? Or was it mupdf? Else you could script something with inotifywait or watch.

Btw, just googled it, less automatically uses lesspipe with pdftotext, so watch -n 2 less your.pdf works. Then there's fbpdf and fbgs of fbi.

[–] boredsquirrel 1 points 6 months ago (1 children)

Could you explain? less would just monitor the binary PDF for changes and then pass that to any viewer?

I think this is really helpful for barebones renderers, thanks! That will be a very good piece of the puzzle for a minimal PDF reader for this task

[–] MonkderDritte@feddit.de 2 points 6 months ago

No, less has the LESSOPEN variable, which can be used to run input-preprocessors. lesspipe misuses that to run specific tools with specific mimetypes, in this case pdftotext for pdf files. It's basically equivalent to running pdftotext -layout <file.pdf> | less. Though no images, for that the other tools.

[–] barbara@lemmy.ml 4 points 6 months ago* (last edited 6 months ago) (1 children)

pulsar (atom successor) is great for it, vscodium should do it, evince (gnome pdf viewer) works good.

What nonremovable popup a d dancing text in okular?

[–] boredsquirrel 2 points 6 months ago* (last edited 6 months ago) (1 children)

Right, forgot about Pulsar. Also have Lapce installed but that may not have the needed tools.

VSCodium also installed in a Distrobox, but tbh I dont want to use it. It is slow, Electron, Microsoft etc. Just not an option.

I am currently trying to add syntax highlighting for typst to kate, but I read that XML and damn thats complex.

[–] barbara@lemmy.ml 1 points 6 months ago (1 children)

apparently there is a preview plugin for kate https://docs.kde.org/stable5/en/kate/kate/kate-application-plugin-preview.html , it's already preinstalled. It works with markdown files, I guess if someone would be down, he could extend the plugin to work with typst

[–] boredsquirrel 1 points 6 months ago

The preview plugin uses Okular, or at least some part of it.

On Kinoite Okular is no longer installed as system package, and it works well as Flatpak.

But yes, I should layer Okular again and try, because in my experience the preview had another issue (background follows system theme i.e. dark, causes flickers)

[–] gnuhaut@lemmy.ml 3 points 6 months ago

I know gv can auto-reload, though not sure if it's any faster or less flickery than evince or mupdf. Maybe worth testing.

[–] boredsquirrel 3 points 6 months ago

Btw that mockup paper is hillarious XD

[–] danielphan2003@lemm.ee 2 points 6 months ago

You might be interested in https://mupdf.com/wasm/demo/index.html?file=../../docs/mupdf_explored.pdf, as I've seen people recommend this for large PDFs that would lag out even native viewers. I don't know about flickering though as I haven't tried it out much.

[–] catloaf@lemm.ee 1 points 6 months ago (1 children)

Are you relaunching Firefox every time? You could just reload the file by refreshing.

But I don't think any viewer is going to support keeping your place in the document when it changes.

[–] boredsquirrel 1 points 6 months ago* (last edited 6 months ago)

No of course I was just refreshing. The problem is, the UI should stay completely still, just the render should refresh.

But I don't think any viewer is going to support keeping your place in the document when it changes.

Okular does that just fine. Tested with multiple pages.