texstudio-org / texstudio

TeXstudio is a fully featured LaTeX editor. Our goal is to make writing LaTeX documents as easy and comfortable as possible.
http://www.texstudio.org/
GNU General Public License v3.0
2.82k stars 345 forks source link

Enhancement/Discussion: Live-compilation based on current preview system. #701

Open kbauer opened 5 years ago

kbauer commented 5 years ago

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

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

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

Desirable behavior

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

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

Environment

kbauer commented 5 years ago

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.

mykter commented 4 years ago

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?

sunderme commented 4 years ago

or you can just press "compile" as txs saves the current document then

octaeder commented 7 months ago

Duplicates

Ad sub-issue 3: c.f. #2197 (no change will be done) Ad sub-issue 4: c.f. #3220