Loading ...
Sorry, an error occurred while loading the content.
 

Re: Compiling LaTeX within vim - Two Questions

Expand Messages
  • Andreas Müller
    Hello ... ... I use grep to remove everything that I don t want, and the file-line-error switch of pdflatex to easily recognize everything I want. From my
    Message 1 of 4 , Feb 2, 2008
      Hello ...

      > I currently have the following lines in my .vimrc:
      >
      > map ,p :!pdflatex % &
      > map ,b :!bibtex % &
      > map ,v :!open %<.pdf &
      > map ,t :w !pdflatex % &
      >
      > They serve as a very nice way to compile LaTeX docs on the fly without
      > leaving vim (Very useful for me). (The 'v' one for 'view' utilizes Mac
      > OS X's 'open' command.)
      >
      > My first question is a log output formatting question. When I run
      > ',p', vim goes temporarily to a shell and runs the command, but the
      > output is not very nice. The lines are all wrapped funny, something
      > like:
      >
      > [...]
      >
      > This is tough to read and quickly troubleshoot when there is an error
      > of any kind. I was wondering if anyone knew of a way to fix that. This
      > happens in xterm (under X11) running 80 lines width.

      I use grep to remove everything that I don't want, and the
      file-line-error switch of pdflatex to easily recognize everything I
      want. From my vimrc:

      setlocal makeprg=pdflatex\ \-file\-line\-error\
      \-interaction=nonstopmode\ $*\\\|\ grep\ \-E\ '\\w+:[0-9]{1,4}:\\\ '
      setlocal errorformat=%f:%l:\ %m
      map <buffer> <F3> :w<CR>:make %<<CR>
      map <buffer> <F4> :!acroread %<.pdf &<CR>

      (the first who lines should be on one line ..)

      Its a bit radical and ugly, but it works ...

      The advantage of using makeprg is that you can use quickfix to jump
      between errors, e.g. I use the mappings

      map <F9> :cprev<CR>
      map <F10> :cnext<CR>
      map <F11> :clist<CR>

      Btw, Vim has some support for compiling tex documents, I think something
      like

      let b:tex_flavor = 'pdflatex'
      compiler tex

      could be used (see :help compiler-tex). I think I didn't like it for
      some reason.

      > The second question is also regarding these key bindings. I would like
      > to have ',p' SAVE the current file and then run the !pdflatex command
      > on it. Is there any way to modify the above keybinding to do so?

      Something like

      map ,p :w<CR>:!pdflatex % &<CR>

      should work ...

      Regards, Andreas
    • BartlebyScrivener
      ... Thanks for the tips and mappings. I m still pretty new to LaTeX. What is the advantage of pdflatex over dvipdf? Thanks RD
      Message 2 of 4 , Feb 2, 2008
        On Feb 2, 3:49 pm, Andreas Müller <andrm...@...> wrote:

        > Btw, Vim has some support for compiling tex documents, I think something
        > like
        >
        > let b:tex_flavor = 'pdflatex'
        > compiler tex

        Thanks for the tips and mappings.

        I'm still pretty new to LaTeX. What is the advantage of pdflatex over
        dvipdf?

        Thanks

        RD

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Andreas Müller
        ... Unless you need the dvi file, I just don t see the motivation for doing the extra step. Also I think some things that work with pdflatex don t work with
        Message 3 of 4 , Feb 3, 2008
          BartlebyScrivener schrieb:
          > On Feb 2, 3:49 pm, Andreas Müller <andrm...@...> wrote:
          >
          > [...]
          >
          > I'm still pretty new to LaTeX. What is the advantage of pdflatex over
          > dvipdf?

          Unless you need the dvi file, I just don't see the motivation for doing
          the extra step. Also I think some things that work with pdflatex don't
          work with dvipdf, e.g.

          - embedding meta information into pdf files with hyperref
          - embedding other pdf files
          - links inside the document (may work, not sure ..)

          On the other hand, some things that work with dvi may require extra
          treatment with pdflatex. YMMV ...

          Regards, Andreas
        Your message has been successfully submitted and would be delivered to recipients shortly.