Tag Archives: LaTeX

Configuring Texmaker USB With MiKTeX Portable

Note: this article was last updated on February 24, 2014, for users of Windows 7 only. Your mileage may vary with other versions of Windows.

I’ve had a number of requests to update my tutorial for installing a portable version of \LaTeX for current versions of both MiKTeX and Texmaker. There are very few step-by-step tutorials out there for building your own portable \LaTeX workshop, so I thought it might prove advantageous to document my build to save others the headache of troubleshooting the process.

The advantages of a portable \LaTeX installation is that it is relatively lightweight because it installs only the packages you need to get up and running. If one of your files calls a package that isn’t installed yet, Texmaker will install it for you on the fly. All you need is an empty USB thumbdrive and a little bit of time. Fortunately, since my last update, Texmaker no longer requires Ghostscript or GSView to render PDF files, which makes this process a whole lot simpler and cleaner.

First of all, you need an empty USB thumbdrive. I recommend at least 2GB to give you room to install additional packages as needed. Then, download the following bundles:

  • MiKTeX Portable – MiKTeX downloads as a self-extracting executable, so once you’ve saved it locally, run the .exe and choose your thumbdrive as the destination. Make sure to specify a new directory for the files, for example: D:/MiKTeX
  • Texmaker USB – extract directly onto the root of your thumbdrive

When you’re done, you should have two subdirectories on your USB drive, one each for MiKTeX Portable and Texmaker USB. It might also be helpful to create a shortcut in your thumbdrive’s root directory to both MiKTeX and Texmaker to save yourself the hassle of needing to dig into each of those directories each time you use \LaTeX.

USB Drive
    |_____MiKTeX
    |_____texmakerwin32usb
    |_____miktex-portable.cmd - Shortcut
    |_____Texmaker.exe - Shortcut

Start MiKTeX and right-click on the icon that appears in your tray. Click ‘Update MiKTeX’. In most cases, it’s ok to just use the default option of updating from the nearest location. Updating may take a while, so this might be a good time to grab a cup of coffee.

Since Asymptote decided to stop playing nice sometime around version 2.16, I recommend using PGF and TikZ for creating nice-looking 2D graphics. You can download the latest version from its Sourceforge repository:

Extract the Tikz files directly into your MiKTeX directory. A window will pop up with a warning. Click the checkbox for “Do this for all current items (2 found)” then click ‘Yes’. This will install the Tikz files in the appropriate directories of your MiKTeX structure.

Warning

Right-click the MiKTeX icon in your system tray again, but this time select ‘MiKTeX Package Manager.’ We need to install two packages so Tikz can run properly — pgf and xcolor. Use the ‘Name:’ field to filter down to pgf, select it, and install. Do the same for xcolor.

PackageManager

Since Texmaker now has a built-in viewer, installing a PDF reader like FoxitReader is no longer necessary. If you would still prefer an external viewer, I recommend grabbing a copy of the FoxIt reader from PortableApps.com. You can install it in its own directory on your thumbdrive, then update the path to it in Texmaker’s configuration options (described below).

You can also install the R Project statistical package. (I may detail how to do this in a later article). If you do so, your file structure will look like this:

USB Drive
    |_____MiKTeX
    |_____R
    |_____texmakerwin32usb
    |_____miktex-portable.cmd - Shortcut
    |_____Texmaker.exe - Shortcut

Now we need to configure Texmaker so it knows where to find our custom installation. Launch Texmaker, then click on Options -> Configure Texmaker. The Commands screen should pop up by default. We’re going to modify most of these fields so that Texmaker can process your .tex files while still being able to run from a USB stick on any Windows computer. (Since my build uses neither Asymptote nor Ghostscript/GSView, I have left those paths set to their defaults.)

TexmakerConfiguration

LaTeX: "../MiKTeX/miktex/bin/latex.exe" -interaction=nonstopmode %.tex
PdfLaTeX: "../MiKTeX/miktex/bin/pdflatex.exe" -interaction=nonstopmode %.tex
XeLaTeX: "../MiKTeX/miktex/bin/xelatex.exe" -interaction=nonstopmode %.tex
LuaLaTeX: "../MiKTeX/miktex/bin/lualatex.exe" -interaction=nonstopmode %.tex
Latexmk: "../MiKTeX/miktex/bin/latexmk.exe" -e "$pdflatex=q/pdflatex -interaction=nonstopmode/" -pdf %.tex
Bib(la)tex: "../MiKTeX/miktex/bin/bibtex.exe" %
Makeindex: "../MiKTeX/miktex/bin/makeindex.exe" %.idx
dvips: "../MiKTeX/miktex/bin/dvips.exe" -o %.ps %.dvi
Dvipdfm: "../MiKTeX/miktex/bin/dvipdfm.exe" %.dvi
ps2pdf: "../MiKTeX/miktex/bin/ps2pdf.exe" %.ps
metapost: "../MiKTeX/bin/mpost.exe" --interaction nonstopmode
Asymptote: "C:/Program Files/Asymptote/asy.exe" %.asy
ghostscript: "C:/Program Files/gs/gs9.07/bin/gswin32c.exe"
R Sweave: "../R/bin/R.exe" CMD Sweave %.Rnw
Dvi Viewer: "../MiKTeX/miktex/bin/yap.exe" -1 -s @%.tex %.dvi
PS Viewer: "C:/Program Files/Ghostgum/gsview/gsview32.exe" %.ps
Pdf Viewer: Set this to use the Built-in Viewer (optional: Click the Embed checkbox)

Set your QuickBuild to run PdfLaTeX + View PDF. Once you make these changes, your portable LaTeX setup should be all configured and ready to work on any USB stick.

Inverse Search

With the addition of Texmaker’s built-in viewer, configuring Inverse Search is no longer necessary. If you still need to do this for any external viewer you might be using, refer to the link in the resource section below.

Additional resources:
GSview 4.9 and Ghostscript 8.60 Portable
“Forward/Inverse search” with Texmaker

Now with LaTeX! (Again)

One of the things I have really enjoyed about having my website on a MediaTemple server is the fact that I now have full root access (via SSH), which means I have more control over my own setup. The downside of this is that I’m still learning a lot of the basics of how to manage a server in this manner. This results in quite a few headaches from time to time, as I have to learn how to do ‘new’ things by doing them wrong about 100 times first. Don’t worry – I haven’t managed to actually break anything yet.

One of the features of Shamus Writes that I lost when I transferred from Bluehost to MediaTemple was the ability to insert LaTeX code into my blog posts. On Bluehost, I’d had to cobble together a ‘dirty’ solution, since they didn’t allow us root access on the shared servers to install software and weren’t willing to work with those of us who wanted it to install it for us. When I switched over to MediaTemple, I was more concerned with getting everything set up and learning how everything is put together here than I was with trying to figure out why LaTeX no longer worked.

Now, five months after the transfer, I was ready to tackle the issue again. In order to run to LaTeX on a server, though, you need four things installed: 1) LaTeX (duh); 2) ImageMagick, for managing the image files; 3) dvipng, for converting LaTeX’s dvi files into a usable PNG format; and, 4) Ghostscript. MediaTemple has ImageMagick, LaTeX, and dvipng installed on the server right out of the box. What puzzles me, though, is why they neglect to install Ghostscript (GS), when that is an essential part of any LaTeX installation.

Since GS clearly _wasn’t_ installed, however, I decided it was time to venture into the dark waters of installing the application on my server. The trouble I kept running into, though, was in getting the GS install package uploaded to the server in the first place. I knew it needed to be on the root somewhere, and my first approach was to try uploading the package via FTP – but nearly every location I tried refused the upload outright and the two or three directories that _would_ allow me to upload would then refuse me permission to run the configuration command. I tossed a couple of queries at MediaTemple’s (mt) tech guys trying to find out, first, if Ghostscript was installed (it wasn’t) and then, how I would go about installing it for myself. I’d already read through the Ghostscript documentation and found the installation instructions less than adequate, given my paltry knowledge of working in Unix. Unfortunately, the (mt) support guy wasn’t much more help, referring me back to the Ghostscript website to check their documentation.

It basically took me two days to finally find “a blog”:http://nicksergeant.com/blog/django/tutorial-installing-django-mt-media-temple-dv-35-server-modpython that described the process to install a completely _different_ application on an (mt) server. The article dropped the clue of going into the directory to which you would like to install and then downloading the install package directly to that directory. That was the piece I was missing, and from there it was pretty straightforward to run through the process of configuring and building GS and then installing the program.

I definitely learned a few things, both about using shell on an (mt) server and on installing applications on said server. And I have LaTeX working again, which is a nice bonus.

0.999999…

I’m really, really enjoying my Real Analysis class. My inner math geek has been riding on a cloud of euphoria for the last three weeks, and I finally have a good excuse to play with and learn

LaTeX

, something I’ve wanted to do since I was first introduced to it in my undergraduate calculus classes several years back. I’ve already learned a handful of really cool little algorithms for manually calculating certain number sets that we take for granted because we have calculators that do these things for us now. It’s been a fun ride so far, and I still have about 3.5 months left to jones over all this math-y goodness.

On the very first day of class, our professor ((Bless his heart – he’s not the greatest teacher in the world. He definitely knows his stuff, but he does have some trouble presenting it in a clear manner.)) opened a can of worms that continues to pop up in our analytical operations. He had everyone break up into groups and then wrote a group activity on the board for us to discuss:

bq. Is

0.overline{9} = 1

?

In case you’re a bit rusty on your math notation, that’s a zero and decimal point, followed by 9s _ad infinitum_. My initial gut reaction was to say that no, 0.999999… is _not_ equal to 1, that it’s infinitely close to 1 without ever actually reaching 1. But of course, when you think about that for half a second, you have to wonder how you can ever get infinitely close to something without touching it. I was incorrectly thinking in terms of asymptotes, like the equation

y = frac{1}{x}

, which is a pair of curved lines that _do_ approach the x and y axes without ever touching. But 0.999999… is a _straight line_ when graphed, and not the curved line of the aforementioned equation. And if you graph 0.999999…, you’ll see no discernable difference between it and a graphed line of 1 – because the two are the exact same number. They’re just different ways of writing the same number.

Our prof pointed us at “this math blog”:http://polymathematics.typepad.com/polymath/2006/06/no_im_sorry_it_.html, where the author has a series of five entries with proofs showing clearing that 0.99999… is equal to 1 – and lots of discussion in the comments about the validity of said proofs. It’s very interesting to read down through everything, even through the trolling comments of naysayers, because the interactions and ensuing discussions turn up a lot of really good mathematical equations and proofs. If you’re interested in this sort of thing, I highly recommend that you check it out and even add Polymathematics to your feed reader. ((There haven’t been any updates since 24 December, but I’m hoping that he’ll come back soon with some more juicy math goodness.))

So, are your eyes all glazed over now? Anyone still with me?

LaTeX vs. Latex

I’m on a mailing list for a

LaTeX

newsgroup, so I receive a digest of new postings a couple of times a day. I was skimming through the new messages in my Gmail inbox a few moments ago when some of the Google-placed ads and helpful links, which I usually ignore into invisibility, caught my eye. Check it out:

latex

Click for larger view

I’m actually kind of amused by the listing. It’s one of those times where you really wish Google’s search API would actually take case-sensitivity into account. I think they got it closer to correct with the ‘More About…’ links, but still, I’m scared to click on anything since I don’t actually know where they go.

No LaTeX

So, I found out from submitting a support ticket the other day that Bluehost does not allow LaTeX to be installed on their servers. I’ve no idea why. This may be enough to cause me to start looking for a new webhost again and run a server switch near the time when my annual contract expires. And it’s not just the inability to run LaTeX that’s fueling this; it’s a number of other server limitations I keep running into. For instance, I would really like to set up an openID server for those sites I comment on periodically (like LiveJournal blogs) that allow openID authentication. I’d also like to play around with Habari (still in development), but I can’t seem to get it to install on my server.

So, I’m going to start doing a little research and querying to see if I can find a decent and affordable host that lets me do all these things. Shared hosting is most desirable at this point, since paying the exorbitant monthly fees for a Virtual Private Server is well beyond my means. Trouble is, I’m not sure it’s possible to do everything I want to do on a shared server.

For LaTeX, I need a server that has tetex-extra and dvipng installed, as well as imagemagick. For Habari, I need a PHP5 installation that actually functions like PHP5, instead of being a limited version. And I know something else is needed for openID that I don’t currently have, but I haven’t yet been able to pin down what.

I’m open to suggestions from the community, as well. Anything that will make my research a little easier is most welcome.

openID, dp.SyntaxHighlighter, and LaTeX

As much as I love my hosted version of WordPress and the power I have to customize it however I see fit, there are some drawbacks to the system that I have yet to be able to hurdle.

  • openID. I’ve wanted to set up an openID server for my blog for quite awhile now. The idea of being able to use my domain to securely log into other websites that use openID, rather than having to hassle with different usernames and passwords, was very appealing to me. However, the technology was initially so new that it was difficult to incorporate openID into WordPress without some hefty file hacking to make it work. Then plugins started coming out, some of which worked better than others. Unfortunately, I’ve never been able to get openID to work here, despite a nice little WordPress plugin that’s supposed to take all the hardship right out of installing it. I suspect that problem lies with inadequate support from my webhost, and all my attempts to contact the plugin’s author have been met with the silent treatment. The plugin itself hasn’t even undergone any changes, additions, or revisions since it was first published, so I suspect that it’s probably no longer being supported. This, then, continues to leave me in an openID black hole until something changes either with my webhost or with a plugin developer that can produce an openID plugin that works so well that almost anyone can use it on any hosting package.
  • dp.SyntaxHighlighter. I work enough with CSS in the occasional WordPress or bbPress theming project that I do like to share snippets of code when the situation demands it. There’s a host of good code sharing plugins out there for WordPress, but the WordPress.com developers have incorporated a syntax highlighting package into the .com blogs that’s really slick. The thing that I like so much about it is that it has a little button that will automatically copy all the code to your clipboard for easy pasting into a text editor. Gone is the need to highlight and copy and then have to manually remove the numbers from the beginning of each line. Unfortunately, dp.SyntaxHighlighter has not yet been bundled as a WordPress plugin, and not being terribly adept yet at coding in PHP, I’m not sure where I’d even start to create a plugin to incorporate it into hosted versions of WordPress. I may try tackling the project here at some point and learn much more, I’m sure, about PHP in the process, but that will have to wait for another time when I don’t have quite so much on my plate. I suspect, though, it’s only a matter of time before else beats me to it.
  • LaTeX. The WordPress.com blogs also have LaTeX installed on them for the uber math geeks. I had a brief introduction to LaTeX when I took Calculus from my father-in-law during my undergraduate education (though I hadn’t yet then met his daughter). I’ve always been somewhat intrigued by coding and markup languages, and LaTeX seemed similar in many ways to HTML and C. The beauty of LaTeX, though, lies in its ability to allow you to easily and attractively put complex mathematical formulas and diagrams on a page. The downside to LaTeX, though, is that the software necessary to make it work is rather complicated to install and somewhat less complicated to use. It’s gotten better in recent iterations, of course, but it’s still somewhat cumbersome to set up. The brains over at WordPress.com actually took the time and effort to make LaTeX work with their blogs and to allow anyone who wants to do so to render LaTeX formulas on their WP.com blogs. There are a couple of plugins that allow you to use LaTeX on hosted versions of WordPress, as well, but they depend heavily on all the LaTeX software being installed on your server. Most webhosts do not have these software packages installed, and it is incredibly difficult, if not impossible, to install these packages yourself or to get tech support to install them for you. So, unfortunately, I have yet to get LaTeX installed on this blog. This does, however, providing a major driving motivation for me to use my “WordPress.com blog”:http://stitzelj.wordpress.com a bit more, especially since I intend to spend some time working my way through my old Calculus textbook (yes, I did keep it) in an attempt to learn Calculus again and learn it better this time. So, I may end up referring you back and forth between the two blogs, at least until I can find a way to get LaTeX installed here.