Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for --follow behaviour like dvipng #211

Open
tecosaur opened this issue Jan 5, 2023 · 3 comments
Open

Request for --follow behaviour like dvipng #211

tecosaur opened this issue Jan 5, 2023 · 3 comments
Assignees
Labels
feature feature request

Comments

@tecosaur
Copy link

tecosaur commented Jan 5, 2023

Hello again,

When using dvisvgm to generate a whole batch of previews to apply to a file when opened it's nice to have the images start showing up as fast as possible. Currently, dvipng is significantly better in this regard thanks to it's support for a --follow flag that allows it to watch an incomplete DVI file and spit out results as pages are appended to it.

 --follow
     Wait for data at end-of-file. One of the benefits of dvipng is that it does not read the postamble,
     so it can be started before TeX finishes. This switch makes dvipng wait at end-of-file for further
     output, unless it finds the POST marker that indicates the end of the DVI. This is similar to tail -f
     but for DVI-to-PNG conversion.

If dvisvgm could support this behaviour too, that would be quite nice.

@mgieseki mgieseki self-assigned this Jan 5, 2023
@mgieseki mgieseki added the feature feature request label Jan 5, 2023
@mgieseki
Copy link
Owner

mgieseki commented Jan 5, 2023

Unfortunately, this is not so easy to do. There are several DVI extensions/specials that require information from following pages, like link targets, annotation data from PDF specials etc. In order to retrieve that information, it's necessary to pre-scan the entire DVI file before the actual conversion. The collected data also speed up the conversion of selected pages and page sequences because it's not necessary to process all DVI commands of skipped pages.
With the current implementation, it's not easily possible to add a --follow option, as this would require a different processing model, which I can't afford to implement at the moment due to lack of time.

@tecosaur
Copy link
Author

tecosaur commented Jan 6, 2023

Hmm, I don't suppose it would be possible to support this under the assumption that each page can be processed independently?

@mgieseki
Copy link
Owner

mgieseki commented Jan 6, 2023

I don't think so. For example, if the page contains a hyperref link pointing to a location on a page further back in the document, the SVG can't be generated before the information on the link target (i.e. page number an position on that page) is available. There are a couple of further specials like this that prevent a conversion on-the-fly.
Also, not all basic data required to convert a certain page is stored between the corresponding BOP/EOP pair in the DVI file. E.g. font definitions occurring on a page are still valid on all following pages and must not be repeated. That means, to convert a single page, all preceding pages must be processed as well. Alternatively, the collected font definitions present in the postamble can be used.
As far as I can tell, a "follow functionality" would only be possible for a subset of currently supported DVI files that don't make use of more demanding specials.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature feature request
Projects
None yet
Development

No branches or pull requests

2 participants