texstudio
texstudio copied to clipboard
Enhancement/Discussion: Live-compilation based on current preview system.
Related to https://sourceforge.net/p/texstudio/feature-requests/91/
The preview-facility of TexStudio already does a wonderful job of providing fast previews of parts of the document. Given sufficiently powerful hardware and sufficiently small documents, it is already possible to get live-compilation of the whole document with good performance. Some issues are however holding this feature back.
This issue is meant to outline enhancement, that could turn the previewer feature into an effective "live compilation" feature, as a basis for discussion on whether it would be viable.
Sub-Issue 1: SyncTex in document preview.
Configure the previewer to display the preview in the embedded viewer and create some example document. Select all text between \begin{document} and \end{document} for previewing. Try to use SyncTeX forward and inverse search.
Observed behavior
- Inverse search opens them temporary document created by the previewer.
- Forward search shows the last compiled state, and doesn't affect the preview.
As a consequence, whenever a many-pages-long preview is created, the user has to scroll to the correct position, and likewise has to manually search for the correct source-code position.
Desirable behavior
- Inverse search should point to the original location in the file.
- Forward search should navigate to the preview.
In practice, this might only be viable if assuming that the whole file is being previewed?
Sub-Issue 2: \input files don't trigger recompilation.
To reproduce, create a file that \inputs another, e.g.
=== main.tex ===
\documentclass{article}
\begin{document}
Hello world.
\input{bye}
\end{document}
=== bye.tex ===
Bye world.
Mark the text between \begin{document} and \end{document} for preview. Change text in bye.tex and within the highlighted text in main.tex.
Observed behavior
- Changing text in
main.texwill update the preview. - Changing text in
bye.texwill not.
Desirable behavior
- When previewing a segment that contains commands known to TexStudio to refer to files (according to the .cwl files), changes to those files should trigger updates to the preview.
Sub-Issue 3: No convenient way to preview the whole file or document.
In order to preview the whole document, the user has to manually select the contents between \begin{document} and \end{document}.
Desirable options
- A hotkey/menu entry for previewing the whole document, that automates this manual selection.
- A hotkey/menu entry for "preview whole document, up to cursor position".
Sub-Issue 4: Preview ignores auxiliary files? (e.g. \cite)
Consider the following file:
\documentclass{article}
\begin{document}
Hello world. \cite{Hello2000}
\begin{thebibliography}{1}
\bibitem[1]{Hello2000} Hello world. Foo bar journal of electronics.
\end{thebibliography}
\end{document}
When compiled, the reference will be correctly typeset as [1] on the second pass. In the preview, the reference will never be respected, since every preview uses a new file and thus ignores existing auxiliary files.
Desirable behavior
- It is not desirable for the previewer to do a full multi-pass compilation due to performance constraints.
- It might however be desirable for the previewer to load the auxiliary files created for the document file in order to give a better approximation of the final document.
Environment
- TeXstudio: 2.12.10
- Qt: 5.9.7, compiled with Qt 5.9.7 R
- OS: Open Suse Leap (15.1)
- TeX distribution: Tex Live
I just realized: Most of the issue could actually be solved by making the "whole document preview" nothing more than a time that triggers regular "save and compile" in the same manner, the preview function currently triggers recompilation of the preview.
Performance improvements are of lesser importance and can largely be implemented by users themselves through the use of \includeonly, manually precompiled preambles, or wrapper scripts that do the preamble caching.
Compile on save is exactly the feature I am looking for. Should I make a separate issue for that or do you want to convert this one into that?
or you can just press "compile" as txs saves the current document then
TeXpresso provides live rendering and is based on the Tectonic engine. However, the viewer uses SDL and doesn't just render the entire PDF on each update.
Adding support for just one TeX engine might be too much effort, especially since it's early in development, but maybe in the future this could become standardized and supported by LuaTeX and other engines.
Duplicates
Ad sub-issue 3: c.f. #2197 (no change will be done) Ad sub-issue 4: c.f. #3220