Found a great reference card at http://michaelgoerz.net/refcards/vimlatexqrc.pdf. I made a picture out of it so that you can direct read it.
Thursday, May 03, 2012
Sunday, April 29, 2012
Wrap acronyms with \ac in Vim
:s/\(\W\)\(\u\{2,10\}\)\(\W\)/\1\\ac{\2}\3/g :s/\(\W\)\(\u\{2,10\}\)$/\1\\ac{\2}/g :s/^\(\u\{2,10\}\)\(\W\)/\\ac{\1}\2/g :s/^\(\u\{2,10\}\)$/\\ac{\1}/g
Sunday, October 09, 2011
pdf to eps conversion
Currently, I need to convert pdf files to eps so that they can be included in latex files.
-
Use Acrobat Pro open the pdf file.
Click File -> export -> PostScript -> Encapsulated PostScript or use "Save As" and change "Save As Type"
However, the bounding box is NOT correctly calculated.
You can use gsview to correct it. Use gsview open the eps file, click "File -> PS to EPS", select "Automatically calculate Bounding Box" and save the output file. -
Use ghostscript. Execute following command:
gswin32 -sDEVICE=epswrite -sOutputFile=<filename>.eps <filename>.pdf
This works well and bounding box is correctly calculated. - Use Xpdf (http://www.foolabs.com/xpdf/download.html)
pdftops -eps <filename>.pdf <filename>.eps
However, the bounding box is NOT correctly calculated.
Brief Latex notes for equations
In-line: $…$
Single line, without equation number: \[ … \] or \begin{equation*} … \end{equation*}
Single line, with equation number: \begin{equation} … \end{equation}
Multi-line, without equation number: \begin{align*} ... \end{align*}
Multi-line, with equation number: \begin{align} ... \end{align}
"a double backslash (\\) is used to separate the lines, and an ampersand symbol (&) is used to indicate the place at which the formulas should be aligned."
For align, \label must be put in front of each equation. For equation, it does not matter you put it in front or in the end.
Saturday, October 08, 2011
Make vim-latex to generate output in a specified directory
Recently I started to use latex to write papers. I want to edit latex in my favorite editor - vim. I found the project vim-latex: http://vim-latex.sourceforge.net/. It is powerful and convenient to use.
However, one feature I want is to generate output files (.div, .ps, .log, etc) into a separate directory rather than the same directory as tex files. It turns out that vim-latex does not support it natively. So I hacked into the source code to make it work on Windows.
-
Edit file ~/vimfiles/ftplugin/tex.vim
Add following config:
set iskeyword+=: let g:Tex_Outdir='out' let g:Tex_ViewRule_pdf='"Foxit Reader.exe" ' let g:Tex_CompileRule_dvi='mkdir '.g:Tex_Outdir.' & latex -output-directory='.g:Tex_Outdir.' -src-specials --interaction=nonstopmode $*' let g:Tex_CompileRule_pdf=g:Tex_CompileRule_dvi.' & cd '.g:Tex_Outdir.' & dvipdfm $*.dvi'
Basically above config specifies
- output directory of latex compilation
- How to view PDF files (if you don't give full path, the command needs to be in env variable PATH)
- How to compile dvi: create the output directory and put output there
- How to compile pdf: first compile tex to dvi, and then call dvipdfm to generate pdf
-
Change ~/vimfiles/ftplugin/latex-suite/compiler.vim
Change line 252 to (this line adds the full path of output directory):
let execString = 'start '.s:viewer.' "'.expand('%:p:h').'/'.g:Tex_Outdir.'/$*.'.s:target.'"'Change line 405 to (this line adds the full path of output directory):
Note: the text in blue is what I added (diff against the original code)let execString = 'silent! !'.viewer.' "'.expand('%:p:h').'/'.g:Tex_Outdir.'/'.mainfnameRoot.'.'.s:target.'" '.line('.').' "'.expand('%').'"'
Saturday, December 20, 2008
Latex resources
[How to insert figures to Latex document]
ftp://ftp.tex.ac.uk/tex-archive/info/epslatex.pdf
http://www.miwie.org/tex-refs/html/index.html
FAQ: http://www.physics.ohio-state.edu/~faqomatic/fom-serve/cache/103.html
[Screen presentation]
http://www.math.uakron.edu/~dpstory/pdf_present.html
http://www.miwie.org/presentations/html/index.html
References
http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/teTeX/latex/latex2e-html/index.html
http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/
