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

pdf and bib file outside build_dir #1355

Closed
xarthurx opened this issue Apr 4, 2019 · 14 comments
Closed

pdf and bib file outside build_dir #1355

xarthurx opened this issue Apr 4, 2019 · 14 comments

Comments

@xarthurx
Copy link

xarthurx commented Apr 4, 2019

I've set the build_dir as suggested in the help folder, but have a question relating to separate pdf/bib file from all the other files.

Once I set the build_dir, all compiled files except for the original *.tex file will be generated in that folder, and I also have to put reference files in that folder too.

My question is, is it possible to get another variables so that all the compile-related file is put into the build_dir folder, while make *.pdf and *.bib or whatever I need to the same location of the *.tex file?

In this way, I can make the project really clean for large projects.

@lervag
Copy link
Owner

lervag commented Apr 5, 2019

and I also have to put reference files in that folder too.

No, you don't. Move this file to the same folder as the .tex file.

My question is, is it possible to get another variables so that all the compile-related file is put into the build_dir folder, while make *.pdf and *.bib or whatever I need to the same location of the *.tex file?

Yes, partly. You can use g:vimtex_view_use_temp_files, which will make a copy of the generated PDF file on successful compiles.

IMHO: Although I understand that you like to get the PDF file in the same location as the .tex file, you should remember that this file is also purely a generated file. As such, it makes sense to keep it in the same build directory, so as to keep the source files separated from the built files.

@lervag lervag closed this as completed Apr 5, 2019
@xarthurx
Copy link
Author

xarthurx commented Apr 6, 2019

@lervag Hi, thank you for your quick respond and thorough explanation.
Yes, the bib part works, as I don't need to put it in the build_dir folder.
And I agree that *.pdf is also generated from compilation and should be put into the build_dir folder.

One last question: I tried to set the g:vimtex_view_use_temp_files to either 1 or 2, but nothing seems happened...

@xarthurx
Copy link
Author

xarthurx commented Apr 8, 2019

@lervag
Hi, After rebooting neovim, now it seems everything works fine.
Thx.

@lervag
Copy link
Owner

lervag commented Apr 8, 2019

Great, happy to hear things work for you now!

@xarthurx
Copy link
Author

xarthurx commented Apr 8, 2019

The only issue left is:
vimtex will not automatically open the pdf after compilation. And when conducting vimtexview command, it will then report cannot find the pdf file, but the sumatraPDF do open the xxx_vimtex.pdf file in the main folder.

I'm not sure if this is a vimtex bug.

I feel it make more sense to open the pdf in the build folder as it will help with automatic updates.

@lervag
Copy link
Owner

lervag commented Apr 8, 2019

I can confirm that with these settings, vimtex does not automatically open the pdf after compilation with the general viewer. However, it should work when you do \lv or :VimtexView. What do you mean with the following?

And when conducting vimtexview command, it will then report cannot find the pdf file, but the sumatraPDF do open the xxx_vimtex.pdf file in the main folder.

If you turn off the g:vimtex_view_use_temp_files option (it is off by default, so simply remove from your config), then I would assume that things work as expected. Right?

Note: When you update vimtex settings, please restart Vim/neovim.

@xarthurx
Copy link
Author

xarthurx commented Apr 8, 2019

I mean:
image

So on my computer, after successful compilation, no file is copied out of the build_dir.
But when using :VimtexView, vim report the above command, and it seems will automatically copy the pdf and synctex.gz two files out into the project folder, and open the pdf accordingly.

@lervag
Copy link
Owner

lervag commented Apr 8, 2019

I've tried to fix this, can you test latest version?

@xarthurx
Copy link
Author

xarthurx commented Apr 8, 2019

Thank you for this instant respond.

Got this during the compilation process:
image

The :VimtexView command works the same as my last comment.

lervag added a commit that referenced this issue Apr 9, 2019
@lervag
Copy link
Owner

lervag commented Apr 9, 2019

Sorry, my mistake. Try again?

@xarthurx
Copy link
Author

xarthurx commented Apr 9, 2019

Yes, now it works.

  1. pdf is open automatically.
  2. The file.pdf inside build_dir got updated every time new changes are made.
  3. The file_vimtex.pdf inside project folder cannot get updated.

Are 3 normal?
How about the pdf viewer open the pdf inside build_dir rather than the copied one?

Besides, may I ask why file_vimtex.synctex.gz also got copied out?

Sorry for so many questions.

@lervag
Copy link
Owner

lervag commented Apr 10, 2019

No, 3 is not normal, file_vimtex.pdf is supposed to be updated according to the g:vimtex_view_use_temp_files setting (see help).

If you want to open the pdf inside the build_dir, then disable g:vimtex_view_use_temp_files (i.e., remove the option).

Besides, may I ask why file_vimtex.synctex.gz also got copied out?

Of course. It is copied in order for backward and forward search to work, because this relies on synctex, and the synctex file must be present.

Sorry for so many questions.

No problem! :)

@xarthurx
Copy link
Author

Well, then I guess it is a bug?
When changing the text and vimtex auto compile and refresh the pdf, the pdf viewer DO pop-up and highlights the line I changed, but the text is not modified and remained the same.

The pdf in the build_dir is changed though.

I guess there's something wrong either with vimtex or sumatraPDF...

@lervag
Copy link
Owner

lervag commented Apr 11, 2019

If so, please open a new issue to describe the problem in a reproducible manner, and please adhere to the issue template.

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

2 participants