Archive for the ‘LaTeX’ category

How to install a new LaTeX package in Mac OS X?

February 4th, 2012

Hey folks,

I wanted to use the picins-package in a LaTeX document. There are two ways to get to use a new LaTeX package. One way is to download and copy the LaTeX package to the folder in which your LaTeX document is in. The latex/pdflatex will find the package in your documents folder automatically. The other way is to install the package permanently such that it can be used by other documents folder as well. The procedure on Mac OS X (10.6.8) is as follows:

1. copy the *.sty file or the whole package to: /usr/local/texlive/2010/texmf-dist/tex/latex/base/ (you must be root or use sudo to copy it)
2. use the “sudo texhash” command to make the new package available

CORRECTION THANKS TO D.W.: Local packages should go into the user TeXmf tree, which is by default ~/Library/texmf (see also the MacTeX-FAQ QM.04: Where do I put my personal additions to the texmf tree?

That’s it. Short and painless. Now you can use the package with every LaTeX file you want to compile

Stefan

Emacs as an IDE for scientific paper writing (part I)

November 11th, 2010

Scientific writers turn away from MS Word more and more, opting for solutions either more minimalistic1 or more suited to the nonlinear fashion of drafting ideas and writing research papers2. However, if you already live in Emacs, the extensible, customizable display editor, there is no need to shell out money for special software to help you with writing scientific papers, it’s all
there. The very excellent org-mode is the place to start, and you will need only minor modifications to the standard org setup get you up and running. If you don’t know about org-mode, now is the time to head over to the compact guide or to the tutorials on worg.

The obvious additions to org that make for an integrated scientific writing environment are Babel and RefTeX. Babel was integrated into org with version 7.0, so it’s right there with every current org installation. RefTeX handles citations and labels in LaTeX and comes bundled with Emacs, so no additional installation is required.

As a good starting point, Mario shares some nice ideas on how to integrate RefTeX and org-mode in order to create a scientific word processor. One comment to that post points out that loading RefTeX in every org buffer creates some computational overhead and overwriting org-specific keybinding by RefTeX might be problematic in some cases (it was for me, too). A nice solution is to load RefTeX only in org buffers with certain TODO keywords. I chose “WRITE”, and have the following lines in my .emacs to load RefTeX in those buffers:

;;; use reftex and other article helper modes in org-mode
;;; (but only in files with a WRITE todo keyword)
(defun org-mode-article-modes ()
  (reftex-mode t)
  (bib-cite-minor-mode t)
  (and (buffer-file-name)
       (file-exists-p (buffer-file-name))
       (reftex-parse-all))
  (define-key org-mode-map (kbd "C-c )") 'reftex-citation))

(add-hook 'org-mode-hook
          (lambda ()
            (if (member "WRITE" org-todo-keywords-1)
                (org-mode-article-modes))))

It comes in very handy to set a global bibliography for RefTeX, which can be accessed for all org files with the WRITE keyword (and from all TeX files also):

;;; master bibliography
(setq reftex-default-bibliography
      '("/Users/christian/Documents/Bibliothek.bib"))

Typically, my org files related to paper writing have a file-specific TODO sequence:

#+TODO: WRITE REVISE SHORTEN | DONE
#+DRAWERS: PROPERTIES SYNOPSIS COMMENTS LOGBOOK

The second line corresponds to the property drawers I set for the document. Clearly, this setup is borrowed from Scrivener, a popular Mac OSX writing app, where each snippet of text can have a synopsis and comments. The logbook drawer is set because I log changes in TODO states in this special drawer.

This way, a nice writing environment is established, where I can profit from org’s power, which is absolutely incredible and ranges from todo-list management to the evaluation of embedded code in different languages, and the power of RefTeX with all it’s niceties like mode-line citation overview and regex citation search.

For me, the reason of choosing Emacs with a custom and iteratively handcrafted setup over a commercial solution for writing papers is nicely summarized in Jaco’s saying: “It’s all in my hands”. The same goes for using Babel (or more generally, Emacs) over some shiny IDE. Stay tuned for more on Babel and scientific writing in the near future.

Footnotes:

1 Minimalism in software is becoming the common theme among many computer users, see e.g. Minimal Mac or One Thing Well, but compare also Merlin’s rant regarding “distraction free writing”.

2 Among the most popular are—on the Mac—Scrivener and Ulysses.

How to get the Helvetica font in LaTeX?

October 21st, 2010

The Helvetica font is similar to the Arial font in terms of geometry but it has a different typeface. To use this font in a LaTeX document issue the following commands:

\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}

That’s it!

Cheers,
Stefan

BibTeX: full entry in text with the package bibentry

October 21st, 2010

I wanted to put full citations of a BibTeX entry in the text and it took me a while to find the right package. It can be done using the package “bibentry”. Here is an example of how I did it. There were some problems when I used other stylefiles such as chicago.

\documentclass{scrartcl}

\usepackage[latin1]{inputenc}
\usepackage[ngerman]{babel}

\usepackage{textcomp}
\usepackage{graphicx}
\usepackage{natbib}
\usepackage{bibentry}

\author{Stefan Strohmeier}
\title{Zusammenfassung von Literatur-und Internetrecherchen}
\date{begonnen am: 15. Oktober 2010,\\ zuletzt geƤndert am:\today}
\begin{document}
\maketitle

\nobibliography{Konzept}
\bibliographystyle{plain}

\section{Literaturzusammenfassungen}
\label{sec:lit-zusammenfassung}
\bibentry{Muhr2010}
\end{document}

A cool editor to layout LaTeX formulas

October 7th, 2010

Today I found a nice little program that helps to layout math formulas in LaTeX. The software can be found here: KLatexFormula

Maybe it is helpful to some of you.
Cheers,
Stefan

How to avoid page numbers in LaTeX for just one page

October 1st, 2010

\makeatletter
\let\@oddfoot\@empty
\let\@evenfoot\@empty
\makeatother

I got this fix from the internet page: http://www.latex-community.org/forum/viewtopic.php?f=5&t=2341&start=0&st=0&sk=t&sd=a

Cheers,
Stefan