LaTeX on Linux

June 8, 2013

As I’ve mentioned in previous posts, I use TeXWorks for pretty much everything other than taking brief notes.  However, if you’re going to use it for much more than basic formatting, you’re probably going to need to install some extra packages other than the preloaded stuff that comes with TeXWorks.  The best package for Ubuntu, and the one that includes most of what you might use on a regular basis (including tipa, a package for typesetting IPA symbols, which is probably my most frequently used package), is the texlive-full package.  To install this in Ubuntu, you can open the terminal and type “sudo apt-get install texlive-full”.  This will prompt you for your sudo password and then install the package, which might take a while since it includes a whole bunch of stuff.  Remember that the apt-get service is the same as the Ubuntu Software Center service, so you can’t be running both at the same time; you’ll have to exit the Software Center if you want to install something with the command line.

I won’t go into a whole discussion of how to use TeXWorks here, but I’ll just add a reminder of how to use a package in LaTeX.  Extra packages you want to load have to go in the preamble/header, right after the \documentclass{} command.  So, for instance, to use the tipa package, I add \usepackage{tipa} immediately after my \documentclass{} declaration.  Some packages are picky and need to loaded before or after other packages, because of definition updates run by various packages.

Advertisements

using the terminal

June 2, 2013

One of the things that scares a lot of people about using Linux, and one of the things that makes it such a flexible and powerful set of operating systems, is the command-line interface or terminal.  As I mentioned in a previous post, I’ve never been scared of a monochrome blinking cursor, and I loved using DOS when all I knew was how to type “cd”, “dir”, and the few programs I ever used in the 80s (ah Wordperfect 4.1).  That’s a good thing, because you absolutely have to use the terminal if you’re going to use Ubuntu or any other Linux distribution as your primary operating systems.  Things will go wrong, you’ll have to compile from source code, you’ll accidentally set recursive file properties on your system files, and even if you don’t want to, you’ll have to use the terminal.  So I thought I would give a brief description of the last 3 commands I’ve used in my terminal on Ubuntu.

First things first: in most version of Ubuntu (and several other distributions), you can open the terminal with the keyboard shortcut Ctrl+Alt+t.  You can also access it by clicking on the Dash (if you’re using Unity as I am) and typing in any portion of “terminal”.  When you open it you’ll see something of the form <user>@<machine>.  For instance, if your username is cthulu and your computer’s hostname is rlyeh, you’ll see cthulu@rlyeh.  The default default location (not a typo — I mean the system default for the default folder you’re in when you open the terminal) is your home folder, so after a colon you’ll see ~, which is shorthand for your home directory.

We don’t want to be limited to our home directory, so I’ll introduce the first basic command, which easily enough is the same as for Windows: “cd”, which stands for “change directory”.  For instance, if I want to change into my Downloads directory, which resides in my home folder, I could type “cd Downloads” (remember: commands and folder names are case-sensitive).  If I want to get back to my home folder from anywhere, I can just type “cd”.  Okay, now I want to actually see what’s in my Downloads directory.  This command is different from Windows: “ls”, because we’re listing the contents of the directory.  By default ls only lists non-hidden files and folders, so if you want to see everything you’ll have to do “ls -a”.  This shows all files and folders.

Okay, now I’m bored and want to actually do something instead of just listing files.  The utility I use probably more than anything (including cd and ls) is ping, which sends ICMP packets to a target IP address and logs how many of them were returned and how long it took them to get back.  ping is used to test network connectivity.  For instance, if your computer won’t connect to the internet, and you want to know if your computer is properly connected to the router, you could ping the router.  If you’re connected, you should get all or most of the packets back, and the times should generally be 5-10ms if you’re using wireless and are some distance from the router.  Less than this is great, much more typically indicates radio interference or network congestion.  If you’re on a home network, the router IP address is probably 192.168.1.1, though it may also be 192.168.1.254.  In my case it’s the latter, so if I want to test my connectivity I type in “ping 192.168.1.254” in the terminal, and I start getting responses like “64 bytes from 192.168.1.254: icmp_req=1 ttl=255 time=1.43ms”.  The most relevant part of that for our purposes is the last bit: “time=1.43ms”. This means the time it took my computer to send an ICMP packet to the router and get a response back was a little over a thousandth of a second: great!  The default for Linux systems is to continuously ping, so if you enter the above command, it’ll just keep going forever and ever.  To stop this (or any other running process in the terminal), you can hit Ctrl+c — which, incidentally, is why you can’t use keyboard shortcuts for copying and pasting in the terminal.  If you want a specific number of pings, for instance the Windows default of 4, you can use “ping -c 4”, where 4 is the number of ICMP packets that will be sent.

Okay, we’re done!  Now I type “exit” and the terminal closes itself.