0

I followed the same procedure as in the answer to this question to download and install latex-vim. But when I compile a tex file, I get the following error message:

|| I can't find file `Rapport'. Rapport  sur la structure des groupes des units.tex
|| Emergency stop. Rapport  sur la structure des groupes des units.tex
||  ==> Fatal error occurred, no output PDF file produced!

It seems that I cannot compile files with spaces in the name, but, using other applications like sublime text, it all works quite fine.

I am using a mac el capitan, and both the vim in terminal and the mac vim fail to compile correctly the tex files, while other functionalities such as folding and indenting are all good and fine.

I am new to the world of vim, so thanks sincerely in advance for any help and reference, in advance.

4
  • To open a file with space you can escape space, like ` vim file\ 2.tex` for file 2.tex
    – SibiCoder
    Aug 10, 2016 at 13:06
  • I can open the file normally, but cannot compile the file. I think I might need to change some vim script, but I don't know where the problem is.
    – awllower
    Aug 10, 2016 at 13:10
  • 4
    It sounds like you need to open an issue with vim-latex so that it handles files with spaces in the path properly.
    – jamessan
    Aug 10, 2016 at 13:42
  • @jamessan Thanks for the suggestion. I shall do so later. :)
    – awllower
    Aug 11, 2016 at 3:37

2 Answers 2

1

Until an official fix is available, you can do the following: Edit the ftplugin/latex-suite/compiler.vim and change the lines

let mainfname = expand('%:p:t')

and

let mainfname = Tex_GetMainFileName(':p:t')

to

let mainfname = fnameescape(expand('%:p:t'))

and

let mainfname = fnameescape(Tex_GetMainFileName(':p:t'))

repectively.

This seems to fix the problem.

3
  • Now I receive this message Error detected while processing function Tex_RunLaTeX[53]..Tex_SetupErrorWindow[ 16]..Tex_UpdatePreviewWindow[1]..Tex_PositionPreviewWindow: line 65: E172: Only one file name allowed: bot pedit +0 But it seems that the file is processed. Is this the normal behavior? Also, thanks for this suggestion!
    – awllower
    Aug 10, 2016 at 16:37
  • @awllower if you search for bot pedit +0 in the same file as pefore, and then change this line to exec 'bot pedit +0'.fnameescape(a:filename), this should resolve your problem
    – Ingo
    Aug 10, 2016 at 17:05
  • This solves the problem! Thanks for getting me out of this mess! ;D
    – awllower
    Aug 11, 2016 at 3:37
0

Sorry to dig out such an old post, but anyone found a similar solution to allow Tex_ViewLatex() to manage filenames with spaces too ? I passed every occurence of mainfname in fnameescape() in the same file compiler.vim in the ViewLatex() section, but this does not change anything.

I currently found an unsafe solution which is to add the shell-escape modifier, i.e. go from

let mainfname = fnameescape(Tex_GetMainFileName(':p:t:r'))

to

let mainfname = fnameescape(Tex_GetMainFileName(':p:t:r:S'))

Thanks.

1
  • 1
    Welcome to Vi and Vim SE. I don't quite understand your answer (partly because I'm blissfully ignorant of the latex-vim plugin). Is this an answer to the question above or do you have a similar problem? If the latter, please ask a new question instead.
    – Friedrich
    Feb 28 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.