lervag / vimtex

VimTeX: A modern Vim and neovim filetype plugin for LaTeX files.
MIT License
5.45k stars 388 forks source link

Real-time scrolling output of latexmk (or compiler) #2958

Closed ThSGM closed 4 months ago

ThSGM commented 4 months ago

Hi!

The last few weeks, I've been having significant lag problems whenever I try and compile a LaTeX document with vimtex compile. I'm not sure what is the issue, whether it is to do with vimtex at all (or could be something due to LSPs, Treesitter, etc.).

In trying to diagnose this, it would be really helpful if I could see the output of the latexmk or latex compiling output in a window with real-time scrolling of the output--essentially this is the typical console output that you would get if you just ran latexmk in the command line.

The real-time scrolling aspect is important because we can often judge what's the problem by gauging points where the compiler is stuck. Is there a way to get this functionality in vimtex? The current way that error/warning output is displayed, it only does so at the end of compilation. I find that you lose a lot of diagnostic information from not being able to watch the real-time output.

I suppose an alternative is to open a split window and just give the manual latexmk command, rather than using :vimtexcompile.

lervag commented 4 months ago

Are you aware of :VimtexCompileOutput? I believe it provides more or less what you are asking for. Although, to be fair, it is not fully "real time".

Still, if there is a lag with compilation, then my best suggestion would be to copy the latexmk command and run it in a terminal. You can find the precise command used by VimTeX with :VimtexInfo after you did \ll or :VimtexCompile.

ThSGM commented 4 months ago

Are you aware of :VimtexCompileOutput? I believe it provides more or less what you are asking for. Although, to be fair, it is not fully "real time".

Still, if there is a lag with compilation, then my best suggestion would be to copy the latexmk command and run it in a terminal. You can find the precise command used by VimTeX with :VimtexInfo after you did \ll or :VimtexCompile.

Hi, yes! I didn't know about :VimtexCompileOutput. It does work well towards this purpose!

By the way, I just want to remark that, regarding this issue, latexmk does return the appropriate error output on the bibliography file! This makes me wonder if the latexmk output is basically superior to the error output of the normal vimtex?

A couple of suggestions---I don't know enough to hardcode these hacks:

Can we make it so that the output of :VimtexCompileOutput:

I had a brief check with some additional errors, and at the very least, the output of latexmk seems just as good as the quickfix output. If some kind of syntax highlighting and pane control could be implemented, it might work very well.

lervag commented 4 months ago

Hi, yes! I didn't know about :VimtexCompileOutput. It does work well towards this purpose!

Great, glad to hear that.

By the way, I just want to remark that, regarding this issue, latexmk does return the appropriate error output on the bibliography file! This makes me wonder if the latexmk output is basically superior to the error output of the normal vimtex?

Well, in my opinion, it is not. The latexmk output is much more verbose and noisy. Also, the quickfix list has a lot of useful built-in features. Still, I do think that the latexmk output is very useful to be aware of - in addition to the output log file. Whenever I get error like behaviour that I don't immediately understand, I usually do check these locations to see if there is more information.

Can we make it so that the output of :VimtexCompileOutput:

  • Has some kind of coloured highlighting (minor). Even highlighting of "error" would be a good start.

Yes, this should be possible. I think it is a relatively good idea, as long as we can be pragmatic about the level at which we parse the output. E.g., highlighting error is trivial, but properly parsing everything is very non-trivial.

  • Can we ensure that the window pane created is of a custom size and similar to the usual error quickfix height? Basically would it be useful for this pane to be omnipresence, providing immediate feedback to the user?

This is harder, and not really something I want to do. I don't mind considering contributions (PRs), but for me, the latexmk output is something I only check rarely.

  • Is it possible to have the output of this pane be at a scaled font relative to the main pane?

No, that is generally not possible at all in Vim/Neovim.

I had a brief check with some additional errors, and at the very least, the output of latexmk seems just as good as the quickfix output. If some kind of syntax highlighting and pane control could be implemented, it might work very well.

I don't really agree with this. I would strongly suggest your read :help quickfix and :help 30.1. The quickfix feature is a very nice built-in feature that is relevant to many other scenarios (e.g. other filetypes) in Vim.


Could I kindly ask that you open a new issue (feature request) for the highlighting idea? Here it would be useful with a screenshot and possibly some ideas of what to highlight. I think you are right that this is a low-hangig fruit that may bring some good value without much work.

lervag commented 4 months ago

(Opening a new issue makes it easier for me to pick it up later. If I don't have the time to work on it for a few weeks, then having to read through the current dialogue may "scare me off" and thus prolongue the time until I actually implement it. ;)