Tag Archives: LaTeX

Update on LaTeX Setup

This is a quick follow-up to my recent post on the LaTeX setup for 2020. I wanted to let you know that I have recently switched from Emacs to VS Code with the LaTeX Workshop extension as my primary LaTeX editor. I truly cannot remember what made me look into this direction, but I am happy that I did.

The main reason for switching was that the file management is so much easier with VS Code. My current project has a number of files spread over many sub-directories and the way LaTeX Workshop handles things makes me much more productive. I somehow miss AUCTeX, but overall I will certainly not go back.

My 2020 Setup for LaTeX

Here is a short write-up of my current LaTeX setup. Since I sometimes need to process documents on Linux systems (usually in a CI/CD context) the natural choice for me these days is TeX Live on Windows.

My preferred editor is probably less common, especially on Windows: Emacs. I have been using it for more than 20 years and with the right add-ons (AUCTeX and RefTeX) it is still the best LaTeX editor for me. Would I recommend it to someone today who does not already know how to use Emacs? Probably not, given the learning curve. But in the late 1990s there was no real alternative on Linux. And LaTeX on Linux it had be for creating high-quality graphics with Xfig and replace text in the EPS files with full-blown LaTeX code for amazing formulas etc.

But let’s go back to the present time. Here is what I did:

  • Download Windows installer for TeX Live
  • Start installer with administrator rights (right-click) and accept all default settings, then wait a really long time (more than three hours on an old Lenovo Thinkpad T520)
  • Install Emacs. I still have EmacsW32 lying around (you need to fix some security settings), but it is no longer available for download. If you look for an alternative, perhaps you find something here.
  • Install Sumatra PDF. The critical feature for me is that it does not hold a write-lock on the file. So when the output PDF is updated in the background by latexmk, it does not cause any problems. I did the installation as administrator and changed the location to C:\Program Files\SumatraPDF because I personally prefer it that way.

That’s all. Enjoy writing 🙂

LaTeX: Hyphenation of \texttt

I have been using $latex \LaTeX$ since I was 17 and still love it. But one thing has been bugging me for a long time. For a while I had been manually tweaking documents to get proper linebreaks when using the \texttt{} macro. Now I had finally come to the point where this did not work any longer. A search gave me this snippet:

\renewcommand{\texttt}[1]{%
 \begingroup
 \ttfamily
 \begingroup\lccode`~=`/\lowercase{\endgroup\def~}{/\discretionary{}{}{}}%
 \begingroup\lccode`~=`[\lowercase{\endgroup\def~}{[\discretionary{}{}{}}%
 \begingroup\lccode`~=`.\lowercase{\endgroup\def~}{.\discretionary{}{}{}}%
 \catcode`/=\active\catcode`[=\active\catcode`.=\active
 \scantokens{#1\noexpand}%
 \endgroup
 }

It works great!

Using LaTeX with Windows 7

For those who are lazy and look for a relatively quick and easy setup guide for LaTeX with Windows 7, you should have a look at http://schlosser.info/latexsystem-en . Another interesting PDF document is here (German only).

Where I have deviated is the installation of Emacs. For several years now I have been using the distribution from http://ourcomments.org/Emacs/EmacsW32.html (patched version) which auto-installs all you need, incl.  gnuserv and gnuclientw. There is one caveat, however.  At the end of the installation you can have Emacs started automatically (on by default). This will most likely cause problems on Windows 7 (and probably also on Vista), because the installer is usually running with admin rights. In such a case the directory ~/.emacs.d and its subdirectories will not be created with the proper account as owner. Instead the admin user or group will own things. This will show itself in two problems:

  • The window “Emacs Client” will display the message “Waiting for Emacs server to start” until a timeout occurs
  • You will see the message “The directory ~/.emacs.d/server is unsafe” in the status line of your main Emacs window

To correct things, go to %USERPROFILE%\AppData\Roaming and change the owner of .emacs.d/ to your own user (make sure to apply this change to all sub-directories!).

Update October 2015
The download link for EmacsW32 is broken, in fact the whole website does not exist any more. I was unable to quickly find an alternative download.

Make Command for LaTeX

I have been a happy user of the typesetting system LaTeX for almost 20 years. For creating the actual output (be it a DVI, PostScript or PDF file) I have usually used some home-grown script in the past. But recently, when digging through the repository of available software for my Fedora 12 system, I came across something much better: latexmk.

Apart from the expected things, like automatically recognizing when e.g. BibTeX or makeindex need to be run, it also supports a continous mode. It then monitors all the files that make up your document. And whenever one of them changes, it automatically re-creates the document. When your previewer supports auto-refresh, you can instantly see the effect of your update without any manual interaction needed.

BibTeX Style natdin.bst for Fedora 12

Just having started with a new personal “project” I needed a good style for BibTeX. In the past (read ten years ago) I had used dinnat.bst which had good support for citing URLs (at the time that was rather unusual). This has been replaced by natdin.bst, which is not installed on Fedora 12. So here are the quick and dirty steps to install it:

The proper way would be to set up a hierarchy under /usr/local/share/texmf/bibtext/bst but I chose to not bother in this case. And ideally there would be an RPM…