From xkcd/77:
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.
Wednesday, March 12, 2008
Because it drives me nuts...
From xkcd/394:
On a serious note, "kB" is "kilobyte" and "kb" is "kilobit." An uppercase "K" is "Kelvin," and so it should never be paired with either "B" or "b". For most modern machines, a "B"yte is 8 "b"its, but there is NO GOOD REASON to assume this case. The meaning of "kilo" is context-dependent, though it's computationally convenient to use 1024 rather than the standard 1000 (because computers address things in base-2).
On a serious note, "kB" is "kilobyte" and "kb" is "kilobit." An uppercase "K" is "Kelvin," and so it should never be paired with either "B" or "b". For most modern machines, a "B"yte is 8 "b"its, but there is NO GOOD REASON to assume this case. The meaning of "kilo" is context-dependent, though it's computationally convenient to use 1024 rather than the standard 1000 (because computers address things in base-2).
Monday, March 10, 2008
Snow Wall in Columbus, Sno-hio
If you didn't hear, over Friday night and Saturday morning, 20 inches of snow were dumped on Columbus, OH. That made driving a little rough Saturday, but the main roads cleared up substantially Sunday. Nevertheless, nearly every school is closed today and Ohio State sent out an e-mail warning people that parking might be a little hairy today.
So, I came to work early this morning not knowing what to expect. After previous big snow weekends, the parking lot would get a little smaller because the plowed snow gets pushed to the edges of the lot causing it to contract. However, as you can see, the lot really looks very good:
So, where did all the snow go?! Well, if I turn 180 degrees around, here's what I see:
Now, I walk a little to my left:
So, you're probably thinking that they just plowed all the snow to one end of the parking lot. However, I'm leaving out a big part of the story. If I KEEP walking, you see this:
and this:
and this:
In other words, they've put a SEVEN FOOT SNOW WALL in the MIDDLE of the parking lot, separating one LARGE parking lot into two smaller lots.
Happy melting!
So, I came to work early this morning not knowing what to expect. After previous big snow weekends, the parking lot would get a little smaller because the plowed snow gets pushed to the edges of the lot causing it to contract. However, as you can see, the lot really looks very good:
So, where did all the snow go?! Well, if I turn 180 degrees around, here's what I see:
Now, I walk a little to my left:
So, you're probably thinking that they just plowed all the snow to one end of the parking lot. However, I'm leaving out a big part of the story. If I KEEP walking, you see this:
and this:
and this:
In other words, they've put a SEVEN FOOT SNOW WALL in the MIDDLE of the parking lot, separating one LARGE parking lot into two smaller lots.
Happy melting!
Labels:
ohio,
ohio state,
parking,
plow,
snow
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
Subscribe to:
Posts (Atom)