Category Archives: Uncategorized

LaTeXTools: New Keybindings!

Heads-up: the keybindings for the LaTeXTools plugin have changed. Make sure to read the README file for details: go to https://github.com/SublimeText/LaTeXTools and scroll down (or click the “Read More” link near the project description).

Why change things? When I started working on this plugin, my objective was to emulate the functionality of the LaTeX bundle for TextMate. In particular, I tried to use the same keyboard shortcuts. However, this slowly led to an accumulation of problems. One was that, as I added features to the plugin, it became harder and harder to assign them to shortcuts that were not already used by Sublime Text 2 itself. The other problem is actually due to ST2′s greatest feature: it’s a cross-platform editor, and the plugin must also work equally well on Windows and Mac, with full Linux support also coming soon (yes!). However, different OS’s have slightly different conventions and expectations about what certain keys do. Bottom line: things were getting unmanageable.

Enter the new keyboard shortcut scheme. It’s actually very simple:

1. The build command is still bound to ctrl-b on Windows and Linux, and cmd-b on OS X. For the time being, the Goto Anything functionality is also still bound to ctrl-r / cmd-r.
2. All other plugin commands use ctrl-l or cmd-l followed by another key or key combination. That’s “ell” for LaTeX.

Example: to do a forward search (i.e. jump to the point int he PDF file corresponding to the current cursor position) on Windows, enter Ctrl-l followed by j. This is abbreviated as ctrl-l,j (the same convention used by Sublime Text). On OS X, this is cmd-l,j. In fact, from now on, I shall write C-l to mean either ctrl-l or cmd-l, depending on the platform.

I have tried to use mostly C-l plus a single keystroke, with reasonable mnemonics. For instance: “j” for jump to PDF, “c” for LaTeX command based on the current word, etc. Wrapping commands use the C- key twice: so, wrap in bold is C-l,C-b, etc. Reference and cite completion uses C-l,Ctrl-space (yes, even on OS X, that’s Command-ell, Control-space), but you can also use C-l,x (for cross-reference). Finally, to toggle the focus from/to the PDF upon compilation, there is a three-key sequence: C-l,t,f. I’ll try to reserve these for toggles and other less frequently used stuff.

Now, on ST2, the C-l shortcut is bound to “Extend selection to line”. That’s reassigned to C-l,C-l. The nice thing is that no other standard ST2 keyboard shortcut is affected.

As an additional benefit, these bindings are consistent with the “nice” (or “compact”) on-screen keyboard in Windows 8, which only has a Ctrl key (no Windows key, no Alt key).

Enjoy!

How to recover deleted photos and other files for free

If you have never accidentally deleted a file, or accidentally formatted your camera’s memory card, don’t read this post Otherwise, here’s something I just found out, trying to help a friend whose SD card had mysteriously formatted itself (don’t ask), thereby nuking about 400 photos.

There are, of course, several commercial file recovery utilities for both Windows and Mac. I’m sure they can generally do a good job. In this case, I experimented with a few trial versions, which typically show you what’s recoverable but do not actually retrieve the files. Unfortunately, I had only very limited success with commercial offerings: very few pictures appeared to be recoverable, no matter which software I tried. That was what I expected, actually; for this reason, when I asked my friend to leave her supposedly dead or dying SD card with me, I made it clear that, short of miracles, her pictures were probably gone for good.

Well, I found a miracle-worker, and its name is PhotoRec. Actually, PhotoRec is part of a package called TestDisk, which does tons more than just recover deleted files, but requires more user intervention. If all you need to do is recover photos, PhotoRec is what you want.

This, ladies and gentlemen, is Free Software at its finest. Yes, it’s free-as-in-beer, as well as free-as-in-libre. Most of all, it’s quality software that does what it’s supposed to, and does it well. Once you point PhotoRec to the drive (hopefully still) containing your photos, and you give it some additional information (see below), you just need to wait while it works its magic. In my case, it was able to recover not just all the recent photos my friend was worried about, but also a lot of pictures that had been deleted up to two years ago. (Friendly advice: don’t rely on your camera’s “Erase All” function to get rid of embarassing pictures!) Last but not least, it’s multiplatform: it runs on Windows, Mac, Linux, and even other platforms. Win!

The downside of PhotoRec is that, well, it is Free Software at its finest Let’s just say that user friendliness was not a key design requirement. PhotoRec is distributed as a zip file that you simply extract wherever you want (even your desktop, if you are lazy). Then, on Windows, you run the photorec_win.exe executable (I haven’t tried it on the Mac). However, if you are expecting a nice friendly Windows dialog, you will be disappointed: PhotoRec runs in the Windows console, and uses an 80s style menu interface. You use the arrow keys to highlight different options, and (generally speaking) Enter to select one of them and advance to the next screen, where new options are presented, until PhotoRec is ready to go to work.

But this makes the process sound harder than it really is. Here’s a very quick summary (refer to the instruction on the PhotoRec site). First of all, you must create a directory on your PC’s hard disk where you will store the recovered pictures. You need to do this before running PhotoRec. Second, once you run the PhotoRec executable, you will see the Windows UAC prompt, because PhotoRec must run as Administrator in order to perform low-level access to your drive. Third, PhotoRec needs to know the following (listed in the order the screens appear in the app):

1. Which drive contains (or used to contain…) your pictures. PhotoRec lists your drives, calling them something like /dev/sda (which most likely is your PC’s hard disk), /dev/sdb, etc. However, it also indicates the size and provides a device description. For instance, right now I have a 32GB MicroSDHC card in my Samsung 7 Slate, which appears as a “31 GB / 29 GiB – Generic STORAGE DEVICE”. That’s the kind of entry you should be looking for. In any case, don’t worry: drives are mounted read-only, so you can’t mess up your files!
2. Which partition on that drive should be used. This is usually easy to guess. On an SD card, either there is a single partition, or there is a small one containing “helpful” software from your friendly manufacturer, and a large one for your data. Pick the large one.
3. Which format the selected partition uses. PhotoRec will try to guess, but if you are recovering files from an SD card, it’s almost certainly going to be FAT or maybe NTFS.
4. Whether PhotoRec should look for pictures only in the space marked “free”, or on the “whole” disk. I chose “whole.”
5. Finally, where to save your recovered pictures. Here you have to navigate to a directory (folder) on your PC’s hard disk. Again, you must create this folder before running PhotoRec. Navigate to it, then hit “C” (don’t ask) to select.

At any time in the previous steps, you can hit Ctrl-C to quit—no questions asked, no mess. But, if you make it all the way to the end, just leave PhotoRec alone and it will do its job. Warning: this may take some time, so make sure your PC is plugged in, so it doesn’t go to sleep.

Finally, a disclaimer or two. Your mileage may vary, and indeed I’d be interested to hear your experience. Also, the safest form of data recovery is backing up! That said, PhotoRec performed admirably. This time, I earned my friend’s gratitude. Next time, it could actually save my own skin!

WordPress: Posting by email from Thunderbird

I have been experimenting with WordPress’s post by email feature. It’s pretty neat: on WordPress.com, you generate a special email address, and then just email your post to that address. You can add shortcodes to set tags, as well as mark the status as ‘draft’ or ‘private’ if you are not ready to share it with the world at large. If you use an HTML-capable mail client, you can format your post; this is convenient, because it means that you basically gain access to a free, reasonably high-quality visual HTML editor! There are some limitations regarding pictures: basically, either you have a single picture in your post, or, if you have more than one, they will appear as a gallery. I can live with that.

One issue I had to deal with is the way Thunderbird handles plain-text and HTML mail messages (I use Apple Mail on my Macbook Pro, and Thunderbird on my iMac and Samsung 7 Slate). I can’t seem to be able to tell Thunderbird that the special WordPress email address can receive HTML mail (yes, I know about the option in Address Book: setting it doesn’t solve the problem). As a result, Thunderbird by default sends messages in both formats (I think). Then, WordPress sees the text part of the messages, and uses that for the post. So, boldface becomes *boldface*, etc. Not good.

My low-tech solution was to go to Tools | Options (Mac: Thunderbird | Preferences), and in the Composition tab, select “Send Options” and then “Ask me what to do” in the pull-down menu under “Text format”. Now, when I try to send HTML email and the receipient is not seen by Thunderbird as being able to receive HTML, I get three options: send plain-text only, send both (the default), and send HTML only. I select HTML only, and all is well: WordPress now correctly sees my HTML message and posts it with the correct formatting.

One last thing: I actually prefer plain-text email, and indeed I have set up Thunderbird to send plain text by default. However, if I need to send a single HTML message, there’s an easy (if hidden) way to do so: press the Shift key while clicking on the Write button. I get the HTML editor, and am good to go.

My first Google Play Movies experience

Last night we decided to watch Hugo with the kids. Our 10-year old daughter read Brian Selznick’s delightful book and loved it; I read it twice, first by myself and then with our 7-year old son. He, too, is now a fan. So, we were all curious to see how well the story translated from the printed page to the screen.

What better opportunity to try out Google’s Play Movies service? The movie was available to rent for $3.99; you could also watch a stunning, 1080p preview, apparently straight from YouTube. What’s not to like? I clicked on the Rent button, connected my Samsung 7 Slate to our HDTV, gathered the family, hit Play… and groaned in disappointment. You see, while the preview was available in 1080p resolution, the actual movie was only available in grainy, blocky, washed-out 480p format. My brother once explained to me that resolution is only one of the factors contributing to the perceived quality of a video; other factors, such as the bitrate and codec used, are very important, too. Well, Google Play’s version of Hugo must have been recorded at a really low bitrate. I don’t know if this is true for other movies in Google Play’s catalog; all I can say is that Hugo was really bad. Before resigning myself to a VHS viewing experience, I checked Amazon Instant Video. Hugo was available there, too, for$1.99, in standard definition. Just for kicks, I rented it on Amazon, too. Lo and behold, the quality was significantly better. Higher bitrate or better codec, I guess. We ended up watching the Amazon version, and none of us really had reason to complain.

Moreover, just this evening I found out that our not-so-hi-tech HDTV is actually compatible with Amazon’s TV streaming video service. This means I no longer have to hook up a computer to the TV. More importantly, I can rent HD versions of several movies—including Hugo, it turns out. I’ll definitely be using this solution in the future.

Bottom line: for the time being, Google Play Movies is not quite as good as Amazon’s service. Indeed, I got even more sour on Google Play Movies tonight. Just for kicks, I downloaded the Play Movies app on my Captivate. Surprise: if you are rooted, you can’t play rented movies! This makes no sense: you obviously can get Administrator access on your Mac or PC, and still you are able to rent movies on them. But, if you root your phone, no dice. Frankly, I don’t see the rationale for this restriction.

From Gingerbread to Ice Cream Sandwich

Alas, my love affair with the belated Gingerbread update for my Captivate was brief. While the browser and Google+ app were indeed much faster on Gingerbread than they ever were on Froyo after a reboot, I quickly found out that using the phone for two or three days without rebooting slowed things down considerably. More precisely, the apps themselves, including the browser, were still fast: however, going back to the home screen was s-l-o-w. I could often see the Launcher redraw the home screen from scratch. Buttons were non-responsive. Rebooting the phone would fix things, but I don’t think rebooting every couple of days is acceptable in this day and age. I never have to reboot my ’08-vintage Macbook Pro and iMac, except for system updates (sometimes). Even my Windows 7 Samsung Slate does just fine without rebooting in normal day-to-day use—except that a large percentage of Windows software still requires restarting on installation.

In the end, I decided it was time for me to enter the mysterious world of custom ROMs. In fact, while I was at it, I might as well try Ice Cream Sandwich (ICS), the latest version of the Android OS. This was especially attractive, as Samsung has stated in no uncertain terms that there will be no official version of ICS for the Captivate (or, more generally, for Galaxy S phones). I opted for the Team ICSSGS port, which builds upon Google’s AOSP (Android Open Source Project) release and is thus untainted by Samsung or AT&T “enhancements.”

Your key to the world of custom ROMs is a wonderful piece of software called ClockWorkMod Recovery, or CWM. This is a utility that runs before the full Android OS boots, and allows you to perform a number of low-level maintenance functions, including “flashing” (i.e. installing) custom ROMs. The beauty of it is that, once you have CWM on your phone, you just download a ROM (usually a zip file) to your internal SD card (you can even do this from your phone!), reboot into CWM, and select one of its menu option to flash the newly downloaded ROM. The only difficulty is actually installing CWM. For this, you will need a computer (PC, Linux or Mac) and another wonderful software called Heimdall (long story).

I followed the instructions here. Two caveats: first, you must have already updated to Gingerbread as per the Samsung/AT&T instructions. Second, the link I just gave you takes you to the Cyanogenmod wiki and provides you step-by-step instructions to install the Cyanogenmod ROM onto your Captivate. However, you do not need to follow all the instructions: just the ones in the section titled “Installing the ClockworkMod Recovery”. Do not follow the instructions under “Flashing CyanogenMod”. You want to flash ICS, not CyanogenMod… for now at least! (Long story short: CyanogenMod is an enhanced ROM; its stable version is based on Gingerbread, not ICS, though they also have an ICS version at the alpha stage.)

Once you have CWM Recovery on your phone, follows the instructions in the aforelinked Team ICSSGS post. A clarification: step 1 in the ICSSS instructions says to “Boot into Clockwork Mod Recovery mode using volume buttons”. This means: power down your phone; now press the Power, Volume Up, and Volume Down buttons simultaneously; hold them for 1-2 seconds, then release the Power button but hold down the two Volume buttons until CWM comes up (If I recall correctly, the CWM menu comes up after the AT&T boot animation).

Another caveat: your Captivate will “boot loop” the first time you flash ICSSGS. That is, you will see the AT&T boot animation, then the Google logo, then a bunch of gibberish, after which the phone will go back to the AT&T boot animation, etc. Don’t panic: this is normal, and explained here (look at the very first “Common Issue”). Just pull the battery and enter CWM Recovery using the three-button combination above. Reflash and reboot: this time there will be no boot loop.

My experience so far: ICS is the most significant upgrade to Android yet. The UI and interaction with the device are much more refined: there are many subtle effects and animations that contribute to a significantly improved experience, reminiscent of iOS and Windows Phone 7 (if you have seen the demos of the latter—devices “in the wild” are, er, hard to spot…). This particular ROM is not super-fast, though once again individual apps are fast. But I am so pleased with the overall “feel” of the OS that I’m willing to give up on apps instantly popping up as soon as I click on icons (some actually do, but some don’t).

Most importantly, so far and after rebooting a couple times after installation, I haven’t had the phone slow down like molasses in just two days of continued use, the way Gingerbread did. I have been running ICS for a week now, and if anything the OS feels faster than when I first rebooted after installing it.

Two final notes. First, the ICSSGS ROM is pre-rooted and also comes with CWM, so further flashing will be a breeze. Second, installing a new ROM requires wiping your phone clean, so back up any data you need to retain and be ready to reinstall apps.

Enjoy!

Gingerbread on my Captivate after a Factory Reset

You may have noticed that I haven’t blogged about my Captivate in a while. The reason, quite frankly, is that I had (notice: had) grown quite a bit dissatisfied with it. The phone was getting noticeably slower, and I was seeing force close messages on an annoyingly regular basis. Finally, AT&T still hadn’t released an OS update: I was still running Froyo (so 2010!), as I didn’t have the guts to root my phone and install a custom ROM.

Well, the Gingerbread update finally became available, and I promptly installed it, hoping it would sort out all of my issues. Long story short: it didn’t. In fact, if anything, I kept getting an annoying message to the effect that the Tethering Manager (which I don’t use) was force-closing every time WiFi was turned off and then back on (for instance, every time the phone comes out of sleep mode, which happens, oh, maybe 20 times a day minimum?)

I decided to take matters into my own hands. With some trepidation, I went into the Settings menu, then Privacy, then Factory Data Reset… poof! All my apps, messages, data, etc. were gone. The phone was back in a pristine state—or, more precisely, in the pristine state of a Captivate running Gingerbread, as I did the reset after installing the OS update. After a very lengthy and frankly distressing wait, I had to reenter my Google credentials…

and I was in phone heaven!!! True, I had to reinstall all my apps, but, since I use Google Contacts and Calendar, all my, well, contacts and appointments came back automagically. I really had no additional important data on my phone that was not backed up elsewhere. In particular, I didn’t care about SMS (text) messages, which do get wiped out. The huge payoff is that the phone is now fast. As in, it has never been this fast before! It almost feels like a new phone altogether. The browser just flies (this is probably also courtesy of Gingerbread of course), and Google+ displays the Stream almost instantly; I have yet to see a force close. Bottom line: the phone now officially has teh snappy. I can barely recognize my Cappy!

A few things I noticed:

• Android Market keeps track of the paid apps you have purchased, but forgets the free apps you have downloaded. Not a big deal, but you may have to remember what you installed if you didn’t pay for it
• When I did the factory reset, I didn’t actually wipe the internal storage as well. However, Google Music lost track of the songs I had synced on my phone. I had to do a bit of cleaning up afterwards, but again nothing was lost.
• If you use Google’s Two-step authentication (hint: you should), you need to reenter your application-specific password on your phone; if you didn’t save it, you must generate a new one (and delete the old one). Also, you need to redownload and reregister the Google Authenticator app.

Finally, one word of warning: if you do have important data on your Cappy, do back up!

My Samsung 7 Slate

I might as well ‘fess up: after much pondering, I broke my multi-year allegiance to all things Apple, and bought myself a Samsung 7 Slate. Yep. A Windows 7-based tablet PC. You can read more about it in this in-depth review at Tom’s Hardware, or this more consumer-oriented, and overall quite negative assessment at Engadget.

Let me say, first of all, that I’m definitely not leaving the Mac platform! First of all, my office machine is a trusty 2008-vintage iMac that I have no intention of replacing, except with a newer iMac. Second, I still use my 2008 Macbook Pro, though rarely. Third, my wife uses a first-generation iPad and a 2010 Macbook Pro, and is very happy with both.

So why this, er, countercyclical (OK, contrarian) decision? Quite simply, I wanted a tablet that could double as a real, no-compromise, LaTeX-capable computer. Apple, sadly, does not make one. Yes, I know about the Modbook, basically a standard Macbook (Pro) retrofitted with a digitizer and tablet frame; it’s about twice as expensive, once you factor in the price of the Mac laptop, and weighs about three times as much as the Samsung 7 Slate — S7S henceforth.

I plan to post extensively on my experience with this machine. I certainly had to figure out ways to deal with the basic fact that Windows 7 and, more importantly, Windows apps (like Mac apps) are simply not designed for touch input at all (with a few notable exceptions). Let me start with a few thoughts, in no particular order.

Windows 8

The S7S is essentially identical to the developer machine that Microsoft handed out at the Build conference, where Windows 8 was first demoed in public. Microsoft has stated that any machine running Windows 7 today will be able to run Windows 8 as well, and the S7S is a very recent machine to boot. But, in addition, the S7S is one of the tablets that Windows 8, and Windows 8 apps, are being developed on! Thus, this machine will likely run Windows 8 well. Indeed, you can run the Windows 8 Developer Preview right now. Which brings me to my second observation…

The Tablet PC Review forum

If you own the S7S, you just have to follow the Samsung forum at Tablet PC Review. It is an amazing resource. Want to find out how to install and run Windows 8 on the S7S? Looking for cases that fit the still-new 11.6″ tablet form factor? Having issues with Samsung’s Easy (ha!) Software Manager? Want to check for potential issues before installing the latest BIOS update? It’s all there. People are extremely nice and helpful. The signal-to-noise ratio is very high.

Because I don’t want to carry around two devices, when one will do just fine — actually, great, not fine. We already own an iPad, though I can’t really say I can use it: my wife and kids totally own it. That’s OK The point is, getting another tablet for media consumption purposes and web browsing seems like a luxury I can’t justify. Plus, it’s inconvenient: if you have and use two devices, you most likely will want to sync them (photos, music, etc.). This is no problem if you are at home and have WiFi, but we travel quite a bit. Until we have pervasive broadband access via the cellular network, at reasonable prices, worldwide, syncing will be a pain (think iTunes). If your laptop is also your tablet, there’s no syncing involved.

Why not a Macbook Air?

This is a tough one. As far as portability is concerned, the MBA is every bit as good as the S7S, or any tablet for that matter. It is a (small) laptop, which means that you can work comfortably while holding it, well, in your lap. In this respect, it is definitely superior to a tablet, even if the tablet comes with a case stand or dock, and a keyboard, like the S7S does.

But the point is that you really don’t want a keyboard when you are reading a book using the Kindle app (or similar), and arguably even when you’re casually surfing the Web, or triaging email. By the way, the S7S comes with a beta of the Swype keyboard for Windows. It is simply amazing; I use it on my Android phone, but it is even better on a tablet. Hint: make sure you read the advanced tips on the Swype Web site.

The S7S provides many of the form-factor advantages of an iPad or Android tablet, but is a full-featured, relatively powerful PC (Core i5 processor, 128GB of SSD storage, 4GB of RAM, a decent Intel graphics processor). You can get real work done on this machine, no matter what your line of business.

By the way, this thing is fast. Try surfing the Web on the S7S and on an iPad side by side. There’s no comparison. And, yes, of course Flash runs just fine on the S7S, and while I loathe it, certain sites (fancy restaurants being the offenders I discovered more recently) just insist on using it.

Not for everyone

Lastly, I should be very clear about this: the S7S is not for everyone. If you want a pure consumption device, get an iPad. It lasts much longer on a charge, and it is designed for touch from the ground up. If you don’t care about the tablet form factor at all, get a laptop. Most Windows apps require adaptability and, above all, patience if you are using your fingers instead of a mouse or touchpad.

Watch this space for tips, tricks, and adventures in the world of Windows tablets!

LaTeXTools plugin: new features

I have recently added two simple but hopefully useful features to the LaTeXTools plugin. I hope they will make your TeX life more comfortable.

As usual, you will get the updated plugin automatically if you installed LaTeXTools using Package Control, which, as I noted earlier, I strongly encourage you to do.

Switching to the PDF viewer after compiling

By default, LaTeXTools keeps the focus on the Sublime Text 2 (ST2) window after compiling a TeX source file to PDF. This is convenient in two scenarios. First, if you have a large screen (or two monitors), you can keep ST2 and your PDF viewer side by side, and just glance at the output to see that all is OK. It would be quite annoying if the viewer window was brought to the foreground in this case: in order to continue editing, you would have to manually switch back to ST2 (using Alt-Tab or Cmd-Tab, depending on your platform). The other scenario is when you are making many small changes to the file sequentially; you compile to make sure that there are no errors or warnings, but do not need to check the PDF output every time. I also have friends and coauthors who simply don’t need to look at the PDF output all that often–they can read LaTeX easily, and would much rather not be distracted by the viewer window popping up.

That said, it is sometimes convenient to switch to the PDF output, especially if you are using a small screen and running both ST2 and your viewer in full-screen mode. In such cases, it would be nice if LaTeXTools could automatically bring up the viewer after compiling. Yet, the previous paragraph gives a few reasons why this shouldn’t be hard-wired.

Enter the Toggle Focus command (bound to Shift+Win+F on Windows and Ctrl+Cmd+F on OSX). It does what you think: every time you invoke it, it changes what the Build command does after compilation. Again, by default, the Build command refreshes the PDF viewer but makes sure that ST2 keeps the focus; so, if you invoke the Toggle Focus command, the next time around Build will actually tell the PDF viewer to grab the focus, i.e. pop us as the frontmost window. Invoke Toggle Focus again, and you get the default behavior back. Every time you switch, a short notification appears in the Status Bar (at the bottom of the ST2 window), so you know what you just did.

Note that this setting is preserved with your session; if you quit ST2 without first closing the tab you are working on, ST2 will remember the status of the focus toggle.

Wrapping existing text in LaTeX commands or environments

The current facilities for entering LaTeX commands or environments (Alt-Shift-[ and Alt-Shift-] on Windows, Cmd-Shift-[ and Cmd-Shift-] on OSX) are useful when you want to first specify the type of environment or command you want, and then enter text in it. However, sometimes you want to wrap some existing text in a command or environment. The most common use case is to emphasize text, or make it bold. I don’t use this feature that often myself, but a colleague mentioned it as one of the main reason why he was sticking with TextMate for the time being.

I have now added a nice collection of wrap commands. They are all bound to Alt-Shift-W on Windows and Option-Shift-W on OSX, followed by an additional key (i.e. you use a “key chord” to invoke them). You must select some text prior to invoking these commands.

Alt+Shift+W followed by n wraps the selected text in an environment, which by default is called “env”: that is, if “blah” is the text currently selected, it gets replaced by

\begin{env}
blah
\end{env}


and the env is highlighted. Enter your desired environment (e.g. “theorem”). When you are done, hit Tab to jump to the end of the environment.

Alt+Shift+W followed by c instead enters a command: “blah” becomes \cmd{blah}, with cmd selected so you can change it to whatever you like.

Finally, a few common commands have dedicated key bindings: Alt+Shift+W followed by e, b and u respectively give you \emph{...}, \textbf{...} and \underline{...}.

Happy TeXing!

LaTeXTools plugin: a slew of fixes

I finally got around to committing a bunch of fixes for my LaTeX plugin for the Sublime Text 2 editor. I describe the main changes below. First though I really want to give a shout-out to the outstanding Package Control plugin, which makes it trivially easy to install and update LaTeXTools and most other Sublime Text 2 plugins. If you have Package Control installed, getting LaTeXTools on your Mac or PC is just a matter of invoking Package Control: Install Package via either the Command Palette or the Preferences menu. See the aforelinked page for details. Incidentally, I didn’t have to do anything to make sure LaTeXTools was picked up by Package Control: it happened automagically, to my surprise and delight. Yay!

Now for the fixes. In no particular order:

• I expanded the README file so it now covers most, if not all, of the current functionality. I also provide some ideas on how to troubleshoot issues. By the way, if you do find something is wrong, please let me know!
• I finally understood that latexmk does not automatically force the TeX engine (e.g. pdflatex) to work in batch mode. Errors will cause latexmk to stop. You can check this by running it from the command line. However, on OS X, somehow invoking latexmk via subprocess.Popen still works, in the sense that all processes terminate regularly and the plugin can then look for errors in the TeX log file. On the other hand, on Windows, using TeXlive, this is not the case: the build command essentially hangs, and even if you terminate it, the pdflatex process keeps waiting for input in the background. This makes further compilations fail (because the synctex file is locked), and forces you to terminate the stray process with Task Manager. Ugly! Well, I hope I have fixed at least the most egregious causes of such inappropriate behavior by passing the -silent option to latexmk.
• A user had a lot of trouble with on-the-fly conversion of EPS files to PDF on OS X, using the epstopdf package. Ends up the problem was path-related: epstopdf relies on Ghostscript, and MacTeX puts Ghostscript in /usr/local/bin rather than /usr/texbin. When compiling from the command line, everything worked–because MacTeX also helpfully fixes your \$PATH; but, building from Sublime Text 2 always failed. Adding the former path in LaTeX.sublime-build fixed the issue. Thanks Jon and Sublimator for helping me track down this bug!
• SumatraPDF, the supported PDF reader on Windows, only reloads recently changed files if they are local: it does not automatically reload files on network shares when they change. As a result, recompiling a file on a network share resulted in SumatraPDF not automatically showing the updated text. This was a problem for me when running Windows in a Parallels virtual machine: Mac directories are accessible are network drives, and there is no problem editing files with Sublime Text 2 on the virtual Windows side; however, I had to manually reload PDF files every time. Bottom line: I now explicitly force a reload before issuing the forward search DDE command.

Enjoy, and as usual report back any issues you may have!

Mac OS X Lion Mail: two awesome features

I just found out about two great features of OS X Lion’s mail client, aptly called Mail: server-side, multi-color message flagging and IMAP access to Yahoo mail.

Mail servers: POP vs. IMAP

As you may know, there are two main ways, or protocols, to access your mail on a server: POP and IMAP. POP (“Post Office Protocol”) is a simple, older mechanism that allows a mail client (Apple Mail, Thunderbird, Outlook, etc.) to ask a mail server whether you have new mail, and download messages to your computer or connected device. You can also tell the server to keep a copy of the messages you download, or delete them. So, the basic premise behind POP (as I see it) is that the mail server is just a way station between the machine sending mail to you, and the mail client on your PC.

POP makes sense in a world in which Internet connectivity is slow and storage space on the server is expensive. In other words, not in today’s hyperconnected, always-online world. The basic premise behind IMAP, on the other hand, is that your mail resides on the server; your mail client can access it at any time, of course delete it if you wish, and perhaps even cache it locally for performance reasons. However, the “official” repository of your mail is on the server.

IMAP has all kinds of other advantages, such as folders. The feature I want to focus on today, however, is flagging.

Custom server-side flags

The IMAP mail protocol supports flagging a message as important, and of course Mail supports this. The neat thing is that flagging is a server-side attribute: it is stored on the IMAP server, not on the client. Thus, if you flag a message on one machine (say, your work PC), then later retrieve the same message on another machine (e.g. your laptop, or your smartphone), the flag is there.

However, the IMAP protocol also supports “keywords”—additional status indications whose interpretation and visual rendering is left to the individual mail client, but that are also stored on the server. Older versions of the Mozilla Thunderbird mail client used IMAP keywords to store “labels”, which allowed you to mark a message as “Important”, “To do” or similar; messages decorated with different labels were also displayed different (non-black) color. More recent versions have “tags”, which work similarly but can also be customized by the user.

Well, it turns out that, when you flag a message in Lion Mail, you can choose a flag color other than the default red, and the color is stored on the server. In the Lion Mail client, notice that there is a pull-down menu (a triangle pointing downward) next to the Flag button: that’s where you choose the color of the flag you want. If you access your mail from a different mail client, you don’t see the color, but you do see the flag: that is, things degrade gracefully. Yay!