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

Displaying the results of a LaTeX run at the time? #537

Closed
amca01 opened this issue Sep 1, 2016 · 11 comments
Closed

Displaying the results of a LaTeX run at the time? #537

amca01 opened this issue Sep 1, 2016 · 11 comments

Comments

@amca01
Copy link

amca01 commented Sep 1, 2016

When I open up a new file, and run LaTeX (well, more properly latexmk) on it with \ll, is there any way I can check on the results of the compilation? What I'd want is either a pop-up window, or an automatic split of the vim window, one part of which would show the running compilation. My LaTeX workflow has generally involved my checking on a compile run, so that I can easily check for errors. I know I can check afterwards with \lo, but can I watch a compile in real time?

@lervag
Copy link
Owner

lervag commented Sep 1, 2016

I don't quite understand what you mean. Do you mean you want to see the output of \lo automatically when you start compilation with \ll, and that you want this to work sort of as a tail -f, i.e., that it automatically updates? Or do you mean that you want automatic feedback after compilation that opens the list of errors and warnings if there are any? The latter feature is already present...

@amca01
Copy link
Author

amca01 commented Sep 1, 2016

Yes, I want to see basically the terminal output of latexmk while it compiles, in other words the output of latexmk scrolling in a small terminal (say 10 lines). At the moment - unless I'm doing it wrong, which is more than likely - I don't even know when the compilation is finished. It would be nice if there was some sort of visual indication to let you know that the compilation was going on, and when it is finished. Does that make sense?

@heiderich
Copy link

heiderich commented Sep 7, 2016

I also think that what @amca01 proposes would be a useful option.

@nasenatmer
Copy link
Contributor

@amca01 wrote:

At the moment - unless I'm doing it wrong, which is more than likely - I don't even know when the compilation is finished. It would be nice if there was some sort of visual indication to let you know that the compilation was going on, and when it is finished.

You don't see the message latexmk compile: started in your vim status line after you have started compilation with \ll and latexmk compile: fail|success respectively? Unless I'm totally mistaken this should be standard behaviour, maybe something in your vim setup prevents these messages?

@lervag
Copy link
Owner

lervag commented Sep 12, 2016

@amca01 I think @nasenatmer has a good question, although partly unrelated to your request. The point is that it may seem like you are working with vimtex without the callback feature, which would provide feedback to your Vim session when each compilation is finished.

Thanks for adding your vote, @heiderich.

I'll see what I can do about the asked feature. I can at least add an option to open the output buffer automatically. Having the buffer automatically updating is more difficult, perhaps not even possible. But I'll see what I can do.

@lervag
Copy link
Owner

lervag commented Sep 20, 2016

Ok, I've done part of this now. If you open the output buffer and return to the tex buffer, the output buffer should now update in a more streamlined manner. If the callback is active, it will update the output buffer directly. Else there are several autocmds that update the buffer. It is sort of hackish, but it seems to work pretty well (especially with the callbacks).

It remains to add an option to automatically open the output buffer after compilation has started. I would still appreciate feedback on the updated output buffer.

@lervag
Copy link
Owner

lervag commented Sep 26, 2016

Ok, I've now added events that should solve this for you. You can add this to your vimrc file:

augroup MyVimtex
  au!
  autocmd User VimtexEventCompileStarted call vimtex#latexmk#output()
augroup END

This will open the output window when compilation has started. You can customize this further, e.g. return the cursor to the previous window/split by appending | wincmd w.

I think this approach is good, since it allows anyone to customize things to their own preferences.

@lervag lervag closed this as completed Sep 26, 2016
@heiderich
Copy link

Without any changes to my .vimrc I recently experience sometimes the following: After compilation starts, a new window with the output of latexmk opens and gets the focus.

Even though I supported this feature request earlier, I consider this behavior a bit annoying.

Can I turn this off?

I would consider it more useful if

  1. this new window would not get the focus (not sure if "focus" is the correct vim-terminology),
  2. this window would always show the tail of the logfile and periodically update and
  3. this new window would open below the file one is currently editing and be smaller in size (maybe about 10 percent of the total height). (In my case this window opens above the current one and takes about 50 percent of the height).

@lervag
Copy link
Owner

lervag commented Sep 29, 2016

This is strange. Are you sure you are on the most recent version of vimtex? The output window should not open unless you add the autocommand that I suggested to your vimrc file. If you did, then I already explained that the autocommand was a simple suggestion that you can further enhance to get the desired behaviour. For instance, to also keep the focus in the TeX buffer, you can do:

augroup MyVimtex
  au!
  autocmd User VimtexEventCompileStarted
    \   call vimtex#latexmk#output()
    \ | wincmd w
augroup END

This will open the output buffer and then return the cursor to the TeX buffer when compilation starts.

The point of all of this is that the autocommand allows you to have full control. You could create a function that sets both the position, size and everything. The following is an example that I think just might work.

augroup MyVimtex
  au!
  autocmd User VimtexEventCompileStarted call MyVimtexOutputter()
augroup END

function! MyVimtexOutputter()
  call vimtex#latexmk#output()

  " Move window to bottom
  wincmd J

  " Set window height
  resize 20

  " Return to LaTeX buffer
  wincmd w
endfunction

@heiderich
Copy link

heiderich commented Sep 30, 2016

Yes, I was on the latest vimtex version. But: I actually did add the autocommand you proposed to my vimrc and then it seems that I totally forgot about it. I am so sorry!

Your modified version of the autocommand takes into account my first and third concern. I guess it would be difficult to implement a solution for the second, right?

@lervag
Copy link
Owner

lervag commented Sep 30, 2016

Yes, the second is more difficult. However, if you have callbacks enabled, then the output window should update whenever a compilation is completed and issues a callback. Thus, it is not near perfect, but it should be better than nothing.

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

No branches or pull requests

4 participants