[HN Gopher] What If LaTeX Had Instant Preview?
___________________________________________________________________
What If LaTeX Had Instant Preview?
Author : laurmaedje
Score : 35 points
Date : 2022-10-16 09:29 UTC (13 hours ago)
(HTM) web link (laurmaedje.github.io)
(TXT) w3m dump (laurmaedje.github.io)
| suyjuris wrote:
| Instant typesetting would be very welcome - I have often wished
| for exactly this. But I do not think that it is a technical
| problem. TeX is very fast, after all. (As you would expect with
| software that age.) Rather, people do complicated things and
| those become slow at some point. If you cannot do complicated
| things, the system will likely not be popular, and the popularity
| of LaTeX is its main appeal, I think. Everything is just a
| package away. Perhaps it is possible to aim at another point on
| the pareto frontier and have something fast with fewer features,
| similar to the relationship between C and C++. Anyway, I hope I
| am wrong and wish you the best of luck!
| varun_chopra wrote:
| This is great! I made LatexResume[1] very recently to solve a
| problem I'd been having as a first time LaTeX user and wrote
| about it as well. [2]
|
| The app allows you to see what you're writing as soon as you
| click preview (no auto-reloads because I probably won't be able
| to handle the traffic) and the API lets me generate a PDF as soon
| as I push my resume to GitHub:
|
| curl --fail --show-error -X 'POST'
| 'https://latexresume.com/api/v1/resume' -F 'file=@resume.tex'
| --output resume.pdf
|
| [1] https://latexresume.com/
|
| [2] https://varunchopra.vc/posts/latex-resume/
| kkfx wrote:
| I honestly do not care about instant preview... On one side I
| prefer to focus on my writing in text, witch means my LaTeX
| sources are well formatted for human readability and well spread
| as needed for the same reason when (rarely for me) I write not so
| short stuff, I have my collection of templates for almost
| anything and anything I need something different I collect the
| LaTeX structure a bit, even if trivial, in an org-mode note, to
| have ready made stuff as needed.
|
| On the "final" step looking for produced pdf issues I have to
| recompile sometimes, mostly on tables/TiKz stuff, but the little
| build time does not disturb me... The only a bit annoying part is
| the "like-a-lisp" default interaction mode in case of error
| finding it essentially useless since I have to correct the
| sources anyway.
| Anunayj wrote:
| yes I agree, however as a student working with LaTeX for the
| first time, instant preview is awesome, it allows me to
| instantly see what my changes do to the preview, and greatly
| increases productivity when I'm not sure what I am doing and
| constantly checking the output for what it did.
| jen_h wrote:
| For writing, it's great not to have the distraction.
|
| But for publishing (especially book/e-book publishing, which
| always requires a lot of fiddling to get perfect!), it's
| really, really useful. My current workflow is TeXStudio with a
| lot of F5ing, which works pretty well...but that final run-
| through would be so much faster if I could see changes as
| they're made.
| Vanit wrote:
| This is a great usecase for diff tracking.
|
| 1) Store all actions by a user as as an array of add/remove
| commands (where a change is remove+add).
|
| 2) Whenever you need to re-render take the cached version from
| the last render and perform the new add/remove commands that
| happened since the last render.
|
| 3) Cache the result for the next render and repeat.
| laurmaedje wrote:
| If I understand correctly, you mean manually writing code that
| patches the result of an action to the last output.
|
| That seems like a great approach for a simple transformation
| pipeline. For a full compiler it seems harder to pull off.
| That's the great thing about memorization: It more or less
| let's you write the compiler like you would have done without
| it.
| hdjjhhvvhga wrote:
| I believe it sort of has had for some decades - it's called LyX:
|
| https://www.lyx.org/
|
| LaTeX code is not edited directly by LyX, though: you need to
| import and export it.
| akvadrako wrote:
| LyX is great - it's what I used in college for physics papers.
| It's been a while but I think it was just LaTeX, so I'm not
| sure what your second point means.
|
| Sadly it never took off. These days I would choose Jypter
| notebooks or markdown files with embedded LaTeX math, which
| also gives you instant previews.
| hdjjhhvvhga wrote:
| > I always thought it was just LaTeX, so I'm not sure what
| your second point means.
|
| LyX uses .lyx files but is able to import and output .tex
| files - and the fact that you remember it as "just LaTeX"
| means the integration is good enough.
|
| From their Features Poll[0] page:
|
| "By a general consensus of the developers, using LaTeX as a
| native format of LyX is no option. Query the lyx-devel
| archieves for details."
|
| [0] https://wiki.lyx.org/LyX/FeaturePoll2#toc8
| tgvaughan wrote:
| LyX has the best system for entering maths into a computer that
| I've ever used. The combination of (a) understanding standard
| LaTeX (and amsmath etc) commands, (b) keeping track of grouping
| for me (no need to manually deal with curly braces) and (c)
| seeing everything appearing immediately means that I often use
| this over pen+paper for moderately complex derivations. Even if
| though I've never really used it for full LaTeX documents, for
| me it's worth having around just for this.
| webel0 wrote:
| I used to lecture with lyx. Think about trying to express how
| you're solving an algebra problem. Set up a keyboard shortcut
| for "duplicate previous line" and you're off to the races.
| necovek wrote:
| How does multi-pass stuff work in Typst and specifically for
| instant preview?
|
| In particular, things like ToC generation, figure and formula
| numbering and back- and forward-referencing?
|
| I was always intrigued by creating a TeX-like typesetting
| language that has similar properties, but I was always put off by
| having to reimplement the gist of the typesetting engine (entire
| box model and font support, especially math typesetting).
|
| It'd also be nice to support more advanced data structures other
| than 255 registers to allow moving away from external file use in
| all the multi-pass processing features.
|
| While I was heavily involved with typesetting in TeX, I mostly
| had my own PlainTeX macros for all of the above stuff (including
| syntax highlighted code listings with cross-page continuation
| logic), but that was 25 years ago when Unicode support was mostly
| very rudimentary: I don't have a need for a typesetting engine of
| the sort today, though I would love to switch my blog into a more
| semantic language with nice support for maths and programming
| that would allow instant print previews (and printouts) with TeX
| like formatting quality.
|
| I would also love it if you open source your stuff, but I
| understand that you are likely trying to build a business around
| this too.
| laurmaedje wrote:
| These are great points. I'll try to address all of them.
|
| Multi-pass: We also do multiple passes, but thanks to comemo we
| can reuse most of the stuff from previous passes. The change
| tracking detects if a dependency on some other part of the
| document requires updating. This doesn't require file writing
| and reading; Typst has a built-in user-facing interface for
| these kinds of tasks.
|
| Data structures: Typst has typical data types you'd expect from
| a modern programming language and also typical imperative
| control flow like if, for, and while. What's a bit non-standard
| is that Typst enforces that all user-defined functions are pure
| (else we'd break incremental).
|
| Open Source: We do plan to open source the Typst compiler and
| CLI! Just not the collaborative web app.
| necovek wrote:
| Thanks, that sounds great! As long as the compiler and CLI
| are open source, I'd be happy to try out the web app at some
| point too!
___________________________________________________________________
(page generated 2022-10-16 23:01 UTC)