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

Compiling LaTeX within vim - Two Questions

Expand Messages
  • mathneuro
    Hello, I currently have the following lines in my .vimrc: map ,p :!pdflatex % & map ,b :!bibtex % & map ,v :!open %
    Message 1 of 4 , Feb 2, 2008
    • 0 Attachment
      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:

      ion patterns for american, french, german, ngerman, b
      ahasa, basque,
      bulgarian, catalan, croatian, czech, danish, dutch, esperanto, e
      stonian, finnish,
      greek, icelandic, irish, italian, latin, magyar, norsk, polis
      h, portuges,
      romanian, russian, serbian, slovak, slovene, spanish, swedish, tur
      kish, ukrainian,
      nohyphenation, loaded.
      (/sw/share/texmf-dist/tex/latex/base/article.cls
      Document
      Class: article 2004/02/16 v1.4f Standard LaTeX document class
      n(/sw/share/texmf-dist/
      tex/latex/base/size12.clod) t)
      (/sw/share/texmf-dist/tex/latex/preprint/
      fullpage.sty) (./hk1.aux)o [1{/sw/var/l
      ib/texmf/fonts/map/pdftex/updmap/pdftex.mapcon}]
      (./hk1.aux) )</sw/share/texmf-dis
      t/fonts/type1/bluesky/cm/cmr8.pfbt></sw/share/
      texmf-dist/fonts/type1/bluesky/cm/
      cmsy10.pfbi></sw/share/texmf-dist/fonts/type1/
      bluesky/cm/cmmi8.pfb>n</sw/share/te
      xmf-dist/fonts/type1/bluesky/cm/cmmi12.pfb>u</
      sw/share/texmf-dist/fonts/type1/bl
      uesky/cm/cmr12.pfb>e</sw/share/texmf-dist/
      fonts/type1/bluesky/cm/cmbx12.pfb>
      Output written on
      incredibly_important_monograph.pdf (1 page, 24269 bytes).

      Transcript written on incredibly_important_monograph.log.

      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.

      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?

      Thanks to all.
      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • 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 2 of 4 , Feb 2, 2008
      • 0 Attachment
        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 3 of 4 , Feb 2, 2008
        • 0 Attachment
          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 4 of 4 , Feb 3, 2008
          • 0 Attachment
            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.