- Fortran 90 (f90) Quick Reference Card
- Vim Quick Reference Card
- Python 2.5 Quick Reference Card
- Vim-LaTeX Suite Quick Reference Card
- Perl Quick Reference Card
- ASCII Quick Reference Card
Personal weblog of Ted Pavlic. Includes lots of MATLAB and LaTeX (computer typesetting) tips along with commentary on all things engineering and some things not. An endless effort to keep it on the simplex.
Showing posts with label Vim. Show all posts
Showing posts with label Vim. Show all posts
Wednesday, February 16, 2011
More Quick Reference Cards
Remember that time when I was quick reference card happy [1, 2, 3, 4, 5]? Today, I accidentally found another good quickref card blog post by someone else (Refcards by Michael Goerz; see the original post for the source code and other versions of these cards):
Labels:
ASCII,
Emacs,
f90,
Fortran,
gdb,
MySQL,
Perl,
programming,
Python,
quick reference,
quickref,
refcards,
reference cards,
scripts,
SQL,
Subversion,
svn,
unix,
Vim,
VIM-LaTeX
Thursday, December 11, 2008
Making MacVim work with Vimperator's external editor feature
Because I'm a vim user, it's naturally for me to use vimperator on top of Firefox.
Today I posted a tip on vimperator.org that helps me use Vimperator on my MacOS system. I'm reposting that tip here.
To make a long story short, try an editor setting like
Shelling out to external commands is hairier in OS X than it is on other platforms.
In my case, I use MacVim, which includes a script mvim that can be called as
My mvim script is in /usr/local/bin. Unfortunately, the PATH environment variable that sits behind user processes has to be set in an special ~/.MacOSX/environment.plist file, and the default PATH does not include /usr/local/bin. If you don't believe me, try
A simple solution is to
So the final solution is to use bash as your external editor, and have it operate as a login shell that calls your editor of choice.
Today I posted a tip on vimperator.org that helps me use Vimperator on my MacOS system. I'm reposting that tip here.
To make a long story short, try an editor setting like
or (if you prefer gvim):set editor='bash -lc "mvim -f \$*" mvim '
Then you should be able to hit CNTRL+I to launch an external editor for textareas. There are simpler solutions and explanations below.:set editor='bash -lc "gvim -f \$*" gvim '
Shelling out to external commands is hairier in OS X than it is on other platforms.
In my case, I use MacVim, which includes a script mvim that can be called as
so that the script will wait for the GUI to exit before it exits. This functionality is identical to the gvim found with other Vim distributions (including older Vim distros for OS X).mvim -f ...
My mvim script is in /usr/local/bin. Unfortunately, the PATH environment variable that sits behind user processes has to be set in an special ~/.MacOSX/environment.plist file, and the default PATH does not include /usr/local/bin. If you don't believe me, try
As you can see, those environment variables are very different from the ones you'd expect in a "login shell." You could go add an appropriate environment.plist file to match your login shell, but then you'll have to keep it up-to-date after every change to your shell profile. As a consequence, it's probably a good idea to:!env
Then you'll notice that :!env gives you more expected results. However, Vimperator won't run the editor unless it can find it in what Firefox thinks is the PATH, and so shcf won't help you.:set shcf='-lc'
A simple solution is to
For most people, this solution will be perfect. However, some will notice that their favorite utilities (e.g., /opt/local/bin/par or /sw/bin/aspell) will not be accessible in the editor (unless the environment.plist file is modified).:set editor='/usr/local/bin/mvim -f'
So the final solution is to use bash as your external editor, and have it operate as a login shell that calls your editor of choice.
Here, bash calls mvim and passes "mvim" as $0 and everything following bash as $1, $2, and so on...:set editor='bash -lc "mvim -f \$*" mvim '
Make Vimperator's "Y"ank behave like Edit-Copy
Because I'm a vim user, it's natural for me to use vimperator on top of Firefox.
Today I posted a tip on vimperator.org that is derived from a suggestion someone else made on the vimperator mailing list. I'm reposting that tip here.
Vimperator has no choice but to copy selected text using the functions provided to JavaScript by Firefox. Unfortunately, these functions sometimes do not provide the expected behavior for certain types of lists, PRE environments, etc.
To make sure that "Y"anking results in the same thing as using Edit->Copy, add the following to your .vimperatorrc:
Today I posted a tip on vimperator.org that is derived from a suggestion someone else made on the vimperator mailing list. I'm reposting that tip here.
Vimperator has no choice but to copy selected text using the functions provided to JavaScript by Firefox. Unfortunately, these functions sometimes do not provide the expected behavior for certain types of lists, PRE environments, etc.
To make sure that "Y"anking results in the same thing as using Edit->Copy, add the following to your .vimperatorrc:
The code should work well on all platforms (even the Mac, with its "M" key). If it isn't working perfect for you, increase that final "20" until the behavior works how you'd like it.js <<EOF
mappings.addUserMap([modes.NORMAL], ["Y"],
"Yank the currently selected text",
function () {
buffer.getCurrentWord();
events.feedkeys("<C-v>" +
(/^Mac/.test(navigator.platform) ?
"<M-c>"
: "<C-c>"), true);
setTimeout( function () {
liberator.echo("Yanked "
+ util.readFromClipboard(),
commandline.FORCE_SINGLELINE);
}, 20 );
});
EOF
Labels:
Firefox,
tips,
Vim,
Vimperator
Wednesday, March 05, 2008
Fixing Vim-LaTeX Compiler Error Messages
UPDATE: Another interesting option is to use rubber, a Python-based LaTeX wrapper. Among lots of other things, it sanitizes both error and warning messages in a format that's easy to use by Vim.
UPDATE: Most recent implementations of LaTeX can be told to generate sanitized error (but not warning!!) messages automatically. SeeAdditionally, Martin Sander has put together a Python version of the vimlatex script.
- a description of how to modify Vim-LaTeX to use this feature
- a more general fix for Vim and LaTeX (in "Comments" section of the link)
NOTE: Personally, I use vimlatex and I do not instruct LaTeX to sanitize its error messages internally.
Quick Links:
- vimlatex — LaTeX wrapper that sanitizes error messages for Vim
- vimlatexpipe — a piped version
- vimlatex.py — Martin Sander's Python alternative to the vimlatex shell script
If you use Vim-LaTeX, you've probably noticed that sometimes errors will cause Vim to open up a completely unrelated file on top of your current file. This is Vim's way of bringing you to the source of the error, but it parsed the latex return text improperly.
The problem is that LaTeX status messages keep track of which file is being used with parentheses over multiple lines. So, in order to figure out where an error is, Vim has to match opening parentheses with closing parentheses over multiple lines. Unfortunately, Vim's compiler error message features cannot do this if multiple parentheses are on one line.
So, I shamelessly borrowed an solution from Luc Hermitte's VIM Macros. Specifically, I was inspired by the vim-tex.sh, which pipes TeX output through a filter that corrects any problems that could confuse Vim. However, I didn't like that his script needed to create a temporary file, so I then borrowed a shell script tip off of a UNIX forum that copies file descriptors around so that actual disk files aren't needed.
The result is vimlatex, a shell script that post-processes TeX output so that it's in a form that Vim likes. To use it, just put it in your PATH and make it executable (i.e., chmod it 0755) and then add vimlatex in front of any compiler command you have. For example, if you have a compiler line in your .vimrc or in your Makefile that starts with latex, insert vimlatex (and a space) in front of the latex (i.e., change latex to vimlatex latex).
Alternatively, any output piped to vimlatexpipe will get properly sanitized for Vim too.
Vim-LaTeX, Vim 7.0, and the filetype plugin
Have you noticed that Vim-LaTeX sometimes does not automatically load when you open up a new .tex file?
If you're using Vim-LaTeX with Vim 7 or higher, you may want make sure you have this somewhere in your .vimrc:
So, if you're having problems getting Vim-LaTeX to load when Vim opens a .tex file, try making that change (as well as all of the filetype plugin changes to your .vimrc that are documented).
Some alternative solutions:
If you're using Vim-LaTeX with Vim 7 or higher, you may want make sure you have this somewhere in your .vimrc:
Otherwise, some of your .tex files will not automatically kick off vim-latex on opening! In particular, vim-latex is usually only loaded if Vim finds a \documentclass, \begin, or \usepackage in the first 1000 uncommented lines of a .tex file. This change forces it to load for all .tex files." Prevents Vim 7.0 from setting filetype to 'plaintex'
let g:tex_flavor='latex'
So, if you're having problems getting Vim-LaTeX to load when Vim opens a .tex file, try making that change (as well as all of the filetype plugin changes to your .vimrc that are documented).
Some alternative solutions:
- ALTERNATIVE 1: If you don't want to make that change, you can add
to the top of any .tex file that you want to force to load vim-latex. That is, Vim will still default to using the plaintex flavor unless it sees that comment or commands like \documentclass, \begin, or \usepackage.%&latex
- ALTERNATIVE 2: You can actually add
OR% vim: filetype=tex
to ANY file to force vim-latex to load. (note: you may need to have the modeline option turned on in Vim for this to work)% vim: ft=tex
- ALTERNATIVE 3: While editing ANY file, you can execute the Vim command (in command mode):
OR:set filetype=tex
to load vim-latex at that instant.:set ft=tex
Sunday, December 30, 2007
File Associations and PATH with MacVim
UPDATE: The newest release of MacVim has a preference pane that lets you "Launch Vim processes in a login shell." If turned on, it should solve the PATH problem suffered by some Vim users.If you use Vim for OS X or the nascent MacVim, you may have noticed that
- your PATH is not set correctly (i.e., compilations fail) and
- Vim is not associated with all of your text files (i.e., it doesn't show up in the "Open With" context menu)
Saturday, December 29, 2007
PDFSync Inverse Searches in MacVim
Remember the post on doing inverse searches in Vim on OS X? The idea was to drop gvim-pdfsync into
or, if you don't like tabs
or (if you used mvim-pdfsync)
/usr/local/bin(or somewhere else in your PATH) and then execute
gvim-pdfsync "%file" %lineto do inverse searches in Vim for OS X just like you can in Windows or in other UNIXes. For example, in Skim, under the PDFSync section of the Sync tab of the Preferences, you can put
Preset: Custom
Command: gvim-pdfsync
Arguments: "%file" %line
For MacVim
I thought it might be nice if I published how to do the same thing in the nascent MacVim, which supports servers just like Vim for Windows. Provided that you've installed the mvim shell script somewhere in your PATH, you can setup Skim withPreset: Custom
Command: mvim
Arguments: --remote-tab-silent +":%line;foldo!" "%file"
or, if you don't like tabs
Preset: Custom
Command: mvim
Arguments: --remote-silent +":%line;foldo!" "%file"
Retro-Approach
Alternatively, if you really liked the gvim-pdfsync approach and want something similar for mvim, put mvimtab-pdfsync or (if you don't like tabs) mvim-pdfsync in your PATH (e.g., in /usr/local/bin) and then setup Skim for:Preset: Custom
Command: mvimtab-pdfsync
Arguments: "%file" %line
or (if you used mvim-pdfsync)
Preset: CustomI hope that helps.
Command: mvim-pdfsync
Arguments: "%file" %line
Labels:
backward search,
DVI viewers,
examples,
forward search,
GVim,
inverse search,
iTeXMac,
iTM,
latex,
macosx,
MacVim,
OS X,
osx,
PDF viewers,
scripts,
search,
Skim,
tex,
TeX/LaTeX,
texlatex,
TeXniscope,
typesetting,
Vim,
VIM-LaTeX,
xdvi
Wednesday, July 25, 2007
VIM-LaTeX Modification: Forward Searching in OS X
UPDATE 3: If it doesn't seem like commands are launching from within Vim, check out my post on setting PATH in Vim. In particular, if you are using the nascent MacVim, checking the "Launch Vim processes in a login shell" preference may fix your problems.
UPDATE 2: I've updated the patch file to fix a few bugs in my original implementation (thanks to Ross M. Richardson for the help!). This version supports forward searching from multi-file projects. By the way, if you didn't know, if you have a project with multiple files where the main LaTeX document is called my_latex_file.tex, you should create a dummy file called my_latex_file.latexmain in the same directory. That way, VIM-LaTeX will know to run its compiler and viewer on the main file and not on any of the smaller constituent files.
UPDATE 1: Skim 0.6 and up supports spell checking of a PDF. This is a strange feature of a PDF viewer since Skim does not allow you to edit the PDF text directly. However, it makes a lot of sense when inverse searches are supported. After doing Shift+Command+CLICK on the misspelled word, the TeX editor will open up near the line of TeX where the word is found.
I have already commented on doing inverse searches (or backward searches) in Vim on OS X. However, I have not handled forward searches. Ross M. Richardson offers a hack for doing forward searches into PDFView; however, it's clear that while this is a hack it is certainly not a lifehack. What I really want is a version of VIM-LaTeX that supports using PDFView, Skim, TeXniscope, or any UNIX shell script as a forward-search-compatible viewer.
The script I presented in an earlier post makes backward searches compatible in nearly any PDF/DVI viewer. Now, I just need to hack compiler.vim to do the reverse. I did this by modifying the Tex_ViewLaTeX and Tex_ForwardSearchLaTeX functions from the 20060325 release of VIM-LaTeX. You can find my changes in VIM-LaTeX-osx-inverse-search-compiler.patch. To apply the patch, go into your ~/.vim/ftplugin/latex-suite/ directory, backup your old compiler.vim file, and try
Of course, you should either drop the patch file into that directory or change the patch command so it has the full path to the patch. Now, all you need to do is configure your ~/.vimrc and you'll be able to use \lv for viewing and \ls for forward searches.patch -p0 < VIM-LaTeX-osx-inverse-search-compiler.patch
OS X Applications: Say that I want to use Preview to view PostScript files, TeXniscope to view DVI files, and Skim to view PDF files (note that both TeXniscope and Skim can open all of these, but only TeXniscope supports DVI source specials). In that case, I could put these lines in my ~/.vimrc file:
Now, VIM-LaTeX will use these whenever \lv (for viewing) or \ls (for forward search) are used. That's right, it will do forward searches with these OS X applications (well, Skim and TeXniscope)! That's easy enough.let g:Tex_ViewRule_ps = 'Preview'
let g:Tex_ViewRule_pdf = 'Skim'
let g:Tex_ViewRule_dvi = 'TeXniscope'
UNIX Viewer Scripts: Now, let's say I wanted to use the skim and texniscope scripts that I built earlier. In this case, I use the following in my ~/.vimrc file:
That g:Tex_TreatMaxViewerAsUNIX tells VIM-LaTeX not to use open -a to open the viewer. The g:Tex_ExecuteUNIXViewerInForeground gets rid of the & appended to the end of the execution strings used by VIM-LaTeX. For some reason, this option needs to be set to get UNIX viewers to work in MacVim.let g:Tex_TreatMacViewerAsUNIX = 1
let g:Tex_ExecuteUNIXViewerInForeground = 1
let g:Tex_ViewRule_ps = 'skim'
let g:Tex_ViewRule_pdf = 'skim'
let g:Tex_ViewRule_dvi = 'texniscope'
Empty Viewer Scripts and Other Stuff: As before, if those ViewRule variables are set to empty values (i.e., ''), open -a will be used. On the other hand, if g:Tex_TreatMacViewerAsUNIX is set, VIM-LaTeX will act like it does on a UNIX machine, and xdvi, xdvik, and kdvi can be used. These three DVI viewers are handled specially. Any other UNIX script should follow the convention:
where script is the UNIX command, %target_file is the main PDF, PS, or DVI file to open, and %line is the line in the TeX source file %source_file for forward searching (i.e., using \ls). If \lv is being used, the %line and %source_file parts are omitted.script "%target_file" %line "%source_file"
Labels:
backward search,
forward search,
inverse search,
latex,
mac,
Mac OS X,
macosx,
MacVim,
osx,
PDF viewers,
PDFView,
PDFviewers,
search,
Skim,
tex,
TeX/LaTeX,
texlatex,
TeXniscope,
Vim,
VIM-LaTeX
Monday, July 23, 2007
The Quick Reference Site (Cards and Books)
UPDATE 3: I did find the source of that regular expression card at Gordon McKinney's Pro IT Blog. Well, it's not a LaTeX source, but it's at least in letter format.
UPDATE 2: I found another good list of quick reference cards at the plantOzh blog. It includes a a regexp card, Perl 5 booklet, and CSS cards (1.0, 2.0). Yes, these cards are archived at the blog, so all of the commentary below still applies.
UPDATE 1: It's also annoying when someone simply archives existing quick reference cards because sometimes those archives use A4 paper. If these were linked to their origins, the source code (perhaps LaTeX) might be available, making a conversion to letter paper easy.
Lately, I have been quick reference happy [1, 2, 3, 4]. I cannot explain why, but I suddenly want to surround myself with quick references.
I think I found a great new quick reference resource. It's The Quick Reference Site, which features quick reference cards, e-books, and other papers and tutorials. From the site:
Throughout the years I have collected a huge pile of documents that deal with almost every aspect of software development. The purpose of this site is to centralize this information and to make it available to everyone who may need it or shares my passion on this subject. There are still a lot of documents in my "archive" that I like to share with you all.As far as I can tell so far, the author archives quick references that he has found over time and links us, the readers, to those archives. The advantage of this is that it minimizes the chances of broken links. The disadvantage is that the archives may not be the most recent versions. Additionally, if this site ever goes down and our bookmarks point there, those bookmarks will be broken.
At the moment this site represents only a fraction of what I want to provide, so a lot of work still needs to be done. As a result, you should consider this site as a work in progress. I'll try to keep you updated on the most challenging, powerful and continuously evolving software technologies of the moment. I hope that especially Java and C++ fanatics (like myself) will find some valuable information over here.
Some quick reference cards that I want to point out (if you go to his list, you can also read descriptions of these programs):
- Cascading Style Sheets 1.0
- CVS Quick Reference Card
- CVS Quick Reference Card (LG)
- PHP Cheat Sheet
- PHP 4 Reference Card
- The One Page Linux Manual
- UNIX commands reference card
- AMSTeX Reference Card 1.3
- vi Reference Card (HP)
- Vi Reference Card
- vi Quick Reference
- VIM Quick Reference Card
- GNU Calc Reference Card
- Bash Quick Reference
- LINUX System Call Quick Reference
- LINUX Admin Quick Reference
- Subversion Quick Reference Card
- Cheat Sheet Subversion
- MySQL-4.02a
On a slightly unrelated note, you can also check out Hawk Wings to find a QuickSilver quick reference and the QuickSilver user manual.
Labels:
bash,
ebooks,
Linux,
Mac OS X,
macosx,
manuals,
osx,
productivity,
quick reference,
quickref,
QuickSilver,
refcards,
reference cards,
regexp,
regexps,
regular expressions,
tex,
TeX/LaTeX,
texlatex,
tutorials,
unix,
Vim
Wednesday, July 18, 2007
MATLAB Quick Reference Cards (and more)
UPDATE: I list an AMSTeX reference card below. There is also an AMSLaTeX reference card available at refcards.com.
This is meant to be a follow-up to the "TeX Reference Card (and others)" post.
I found a list of a bunch more quick reference cards, which include applications/packages like MATLAB, MATLAB toolboxes, Perl, MFC, MySQL, Linux, UNIX, Vi, Vim, Windows, AMSTeX, TeX, and a bunch more...
However, I was just looking for MATLAB quick reference cards. So, here are these (some of which did not come from the above site):
- MATLAB quick reference
- MATLAB toolboxes quick reference
- MATLAB reference card meant for an ENG101 class
- MATLAB reference card
- An edited MATLAB reference card
Labels:
AMSLaTeX,
AMSTeX,
latex,
Linux,
MATLAB,
MFC,
Microsoft Windows,
MySQL,
Perl,
quick reference,
refcards,
reference cards,
tex,
TeX/LaTeX,
texlatex,
typography,
unix,
Vim,
windows
Wednesday, July 11, 2007
PDFSync inverse searches on Vim for OS X
FINAL UPDATE: See the new post, "PDFSync Inverse Searches in MacVim," for the state of the art on this subject.
WINDOWS USERS: See "Performing inverse searches" from the VIM-LaTeX quick start guide.
I have posted information about this in a number of places [1, 2, 3, 4, 5]. I plan to add something at MacResearch sometime soon too.
The package PDFSync allows users to do "backward searches" or "inverse searches" from PDF viewers like iTeXMac, TeXniscope, Skim, and others. That is, if you generate a PDF with LaTeX (or Plain TeX or ConTeXt), you will be able to click on text in the PDF and have an editor open up and position the cursor at the TeX source code that generated that text. That can be very nice.
There is a related feature for DVI files, but there are very few good DVI viewers out there (TeXniscope comes close), so I just focus on PDFSync).
I use Vim with VIM-LaTeX to do my document preparation. I would like to also be able to use PDFSync. However, while inverse searching is supported in Windows, it is not easily done in OS X.
I found a thread describing how to do inverse searching with AppleScript that issues raw commands to Vim. I decided to take that AppleScript, package it into a bash script, and fix it so that it had no problem handling files with spaces or symlinked files or multiple files with the same base name. The result is this script:
I hope that's useful to someone.
UPDATE 8: Skim 0.6 and up supports spell checking of a PDF. This is a strange feature of a PDF viewer since Skim does not allow you to edit the PDF text directly. However, it makes a lot of sense when inverse searches are supported. After doing Shift+Command+CLICK on the misspelled word, the TeX editor will open up near the line of TeX where the word is found.
UPDATE 7: caveat Vimmer! Inverse searches in Skim are called up with Shift+Command+CLICK. This is fine; however, if you hold Shift+Command too long, the AppleScript for calling up Vim is going to get confused. In other words, be sure to release the modifier keys as soon as possible after the "click."
UPDATE 6: I found information about doing both forward and backward searches with Vim and PDFView (see also: using gotoline.sh). From these, I've made hacks to the VIM-LaTeX scripts for PDFView and other viewers (like Skim and TeXniscope). I will describe these hacks in another post.
UPDATE 5: See Vim Tip #225 and the corresponding wiki entry for information about both backward and FORWARD searches in Vim. I also found a nice LaTeX tools script for Vim that has forward searching built in. I found these pages linked from a page on xdvi inverse searches.
UPDATE 4: Very trivial updates have been made in a 1.03 version of this script.
UPDATE 3: I have posted a 1.02 version of this script. The changes are fairly trivial, but you might be interested in checking it out.
UPDATE 2: This script is now a part of the Skim wiki.
UPDATE 1: I have mirrored this post at my web site.
WINDOWS USERS: See "Performing inverse searches" from the VIM-LaTeX quick start guide.
I have posted information about this in a number of places [1, 2, 3, 4, 5]. I plan to add something at MacResearch sometime soon too.
The package PDFSync allows users to do "backward searches" or "inverse searches" from PDF viewers like iTeXMac, TeXniscope, Skim, and others. That is, if you generate a PDF with LaTeX (or Plain TeX or ConTeXt), you will be able to click on text in the PDF and have an editor open up and position the cursor at the TeX source code that generated that text. That can be very nice.
There is a related feature for DVI files, but there are very few good DVI viewers out there (TeXniscope comes close), so I just focus on PDFSync).
I use Vim with VIM-LaTeX to do my document preparation. I would like to also be able to use PDFSync. However, while inverse searching is supported in Windows, it is not easily done in OS X.
I found a thread describing how to do inverse searching with AppleScript that issues raw commands to Vim. I decided to take that AppleScript, package it into a bash script, and fix it so that it had no problem handling files with spaces or symlinked files or multiple files with the same base name. The result is this script:
Copy that script in a place (preferably in your PATH) like#!/bin/bash
filename="$1"
lineNum="$2"
[ "${filename:0:1}" == "/" ] || filename="${PWD}/${filename}"
exec osascript \
-e "set ESC to ASCII character of 27" \
-e "tell application \"Vim\" to activate" \
-e "tell application \"System Events\"" \
-e "tell process \"Vim\"" \
-e "keystroke ESC & \":set hidden\" & return " \
-e "keystroke \":if bufexists('$filename')\" & return " \
-e "keystroke \":exe \\\":buffer \\\" . bufnr('${filename}')\" & return " \
-e "keystroke \":else \" & return " \
-e "keystroke \": edit ${filename// /\\\\ }\" & return " \
-e "keystroke \":endif\" & return " \
-e "keystroke \":${lineNum}\" & return " \
-e "keystroke \"zO\" " \
-e "end tell" \
-e "end tell"
and chmod it 0755. That is, do/usr/local/bin/gvim-pdfsync
Then you can use the script likechmod 0755 /usr/local/bin/gvim-pdfsync
where %file is the name of the file to be opened and %line is the line to place the cursor on. So, for Skim, you would put in your LaTeX (or Sync) preferences under "PDFSync" support:gvim-pdfsync "%file" %line
Preset: CustomAfter configuring Skim, BE SURE TO CLICK AWAY FROM THE TEXT BOXES before closing the configuration. For example, click on one of the other tabs. Otherwise, the dialog box may not record your changes to the last text box you changed.
Command: gvim-pdfsync
Arguments: "%file" %line
I hope that's useful to someone.
Labels:
AppleScript,
backward search,
DVI viewers,
examples,
forward search,
GVim,
inverse search,
iTeXMac,
iTM,
latex,
macosx,
MacVim,
OS X,
osx,
PDF viewers,
scripts,
search,
Skim,
tex,
TeX/LaTeX,
texlatex,
TeXniscope,
typesetting,
Vim,
VIM-LaTeX,
xdvi
Tuesday, July 10, 2007
TeX Reference Card (and others)
UPDATE 3: I found the source of the popular LaTeX cheat sheet. It includes a PS version, a PDF version, PNG views [Page 1, Page 2], and the LaTeX source. It's nice that the source is available. That makes it easier to shift from A4 to letter paper and back.
UPDATE 2: More reference cards can be found in the follow-up to this message.
UPDATE 1: Check out refcards.com and the old version old.refcards.com. There are lots of useful cards, including some of the ones I linked below. This TeX card and this Vim card look familiar. There are other EMmacs and Vim cards in the editors section. There is also a typesetting section that includes a LaTeX cheat sheet.
The Brown University Center for Fluid Mechanics, Turbulence and Computation (CFM) has a collection of computing tutorials. Buried in there somewhere is a useful Plain TeX reference card in PostScript format. I have generated a PDF version of this reference card.
I stress that this is a Plain TeX reference card, and so there are different ("better"?) ways of doing some of these things using other LaTeX macros (note TeX vs. Plain TeX vs. LaTeX differences: [1, 2, 3, 4, and more]). However, this is still a very useful reference card. It prints out as two landscape-oriented pages (weirdly sized: 11.7" x 8.3"). I plan on printing this out and taping it next to my desk at the office. I also found a useful longer Plain TeX reference sheet that may be helpful to some people. Of course, there are even longer Plain TeX reference documents also available.
Oh, I also found this AUC TeX reference card PDF with available source code. I don't use AUC TeX (I favor VIM-LaTeX), but maybe someone who does could use this. FYI, AUC TeX is a package for EMacs providing extra support for LaTeX (and others).
Speaking of Vim:
- Here's a cool set of multilingual Vim quick reference cards (again, PDF with 2 landscape-oriented pages) that include their sources and an HTML version.
- Here's a similar Vim quick reference card (PDF).
- Here's yet another Vim quick reference card (PDF).
- Finally, here's VIM-LaTeX's quick start introduction document.
Labels:
AUC TeX,
auctex,
Emacs,
latex,
Plain TeX,
productivity,
quick reference,
refcards,
reference,
reference cards,
tex,
TeX/LaTeX,
texlatex,
tutorials,
typography,
Vim,
VIM-LaTeX,
XEmacs
Friday, July 06, 2007
Script to open file in TeXniscope from command line
UPDATE 2: A much fancier version of this script is now available. It has options that make it easier to make TeXniscope update its file and position (via PDFSync or DVI source specials) in the background. The options are described briefly with the -h parameter.
UPDATE 1: A more mature version of this script is now available. It has a usage line. It checks for the existence of files. It tries to guess at a file name if the file does not exist. It's a little more convenient for the command-line user.
Here's a script to open a (PDF or PostScript) file in TeXniscope from the command line:
or, alternatively,#!/bin/sh
[ "`echo $*|cut -c 1`" == "/" ] || filename_prefix="`pwd`"
exec osascript \
-e "tell application \"TeXniscope\"" \
-e "activate" \
-e "open file ((POSIX file \"$filename_prefix/$*\") as string)" \
-e "refresh of the front document" \
-e "end tell";
#!/bin/bash
arguments="$*"
[ "${arguments:0:1}" == "/" ] || filename_prefix="$PWD"
exec osascript \
-e "tell application \"TeXniscope\"" \
-e "activate" \
-e "open file ((POSIX file \"$filename_prefix/$*\") as string)" \
-e "refresh of the front document" \
-e "end tell";
Create an executable script called texniscope (e.g., /usr/local/bin/texniscope that is chmod'd 755) and try texniscope FILENAME where FILENAME is the name of the PDF or PostScript file that you want to open (be sure to include the file extension).
This allows you to use TeXniscope as a LaTeX document viewer in the VIM-LaTeX suite for Vim.
See also: Script to open file in Skim from command line
I use this for Vim/GVim; however, this script was inspired by code in an example in the TeXniscope help file for making TeXniscope work with iTeXMac. See the TeXniscope documentation for information on how to build a script that will let iTeXMac call TeXniscope from the command-line (and even make use of PDFSync [CTAN, iTM]).
Labels:
AppleScript,
CLI,
command line,
examples,
GVim,
iTeXMac,
iTM,
macosx,
OS X,
osx,
PDF,
postscript,
scripts,
software,
tex,
TeX/LaTeX,
texlatex,
TeXniscope,
tools,
typography,
Vim,
VIM-LaTeX
Script to open file in Skim from command line
UPDATE 4: I have updated the script to accept command line options. A -h option gives help text describing the new usage. The options can prevent Skim from being activated or opening the file. This may be useful when trying to get Skim to update in the background.
UPDATE 3: I have updated the script to check for whether or not files exist, try to guess the right files if they don't, and bail if it fails. It also has support for PS and DVI files. Also fixed a problem with symlinked files.
UPDATE 2: I have generated a more mature version of this script that also has the ability to position Skim's PDF view at a position corresponding to a line of your TeX source (provided you built the PDF with pdfsync).
UPDATE 1: As discussed in this feature request and this Wiki entry, in iTeXMac, you can also trySkim.app/Contents/SharedSupport/displayline %line "%pdffile" "%texfile"which lets you make use of Skim's PDFSync support. The Wiki page includes instructions on using this in Emacs and TextMate as well. If you just want to open the file, you might trySkim.app/Contents/SharedSupport/displayline 1 "%pdffile"but this might break if the TEX file isn't available (so maybe you should still use the AppleScript below).
Here's a script to open a (PDF or PostScript) file in Skim from the command line:
or, alternatively,#!/bin/sh
[ "`echo $*|cut -c 1`" == "/" ] || filename_prefix="`pwd`"
exec osascript \
-e "tell application \"Skim\"" \
-e "activate" \
-e "open ((POSIX file \"$filename_prefix/$*\") as string)" \
-e "revert front document" \
-e "end tell";
#!/bin/bash
arguments="$*"
[ "${arguments:0:1}" == "/" ] || filename_prefix="$PWD"
exec osascript \
-e "tell application \"Skim\"" \
-e "activate" \
-e "open ((POSIX file \"$filename_prefix/$*\") as string)" \
-e "revert front document" \
-e "end tell";
Create an executable script called skim (e.g., /usr/local/bin/skim that is chmod'd 755) and try skim FILENAME where FILENAME is the name of the PDF or PostScript file that you want to open (be sure to include the file extension).
This allows you to use Skim as a LaTeX document viewer in the VIM-LaTeX suite for Vim.
NOTE ABOUT revert: The line with revert in it requires Skim version 0.5 or higher. If you don't have that version of Skim (or you don't care about refreshing the document), then delete that line.
See also: Script to open file in TeXniscope from command line
I use this for Vim/GVim; however, this script was inspired by code in an example in the TeXniscope help file for making TeXniscope work with iTeXMac. See the TeXniscope documentation for information on how to build a script that will let iTeXMac call TeXniscope from the command-line (and even make use of PDFSync [CTAN, iTM]). It should be easy to modify the script they give there to call Skim instead of TeXniscope; use my script here as an example. Note that Skim's AppleScript also supports all of the goto line stuff of TeXniscope. However, the syntax is different; see the Skim AppleScript dictionary for more information.
Subscribe to:
Posts (Atom)