Archive for the ‘latex’ Category

Fonts of Fantasy

Sunday, October 12th, 2008

Problem: My thesis requires fonts from Star Trek and Bladerunner, but they’re TrueType and LaTeX does not play well with them.

Briefly: LaTeX is anal about the directory tree. So learn the right directory names and save yourself a bundle of trouble.

Solution: The LaTeX fundus package has Star Trek font; but turns out it doesn’t work with my Ubuntu. So I wrote a script to install a ttf in a local texmf tree. Note that the tex tree conventions
leave you have little flexibility in naming directories. So ${TEXMF}/fonts/tfm, ${TEXMF}/tex/latex/, ${TEXMF}/fonts/truetype, etc. need to be acceptable to tex.
(more…)

LaTeX/Python Weekly Planner

Monday, April 7th, 2008

Problem: The LaTeX planner is cool, but how do I make one for me without much hassle?
thumbnail for planner pdf
Briefly: Separate out the configurable part (photo, schedule etc.), and generate the remaining calendar file automagically (using a programming language instead of bash this time around).

Solution:
The pdf calendar: newcal.pdf

The tex source with dates (generated from lc.py script weekly): newcal.tex

The tex source with graphics and schedule (edited manually): personalizations.tex

The python source that generated the tex code for newcal.tex: lc.py

LaTeX Math appears in font other than Computer Modern

Wednesday, March 12th, 2008

Problem: I want Computer Modern fonts in my presentation, but these weird text-land fonts show up in my equations. CM are there in dvi and ps (and even pdf) when I use gv for preview, but disappear in Ad0b3 Reader.

(Btw, I needed to use a symbol, and to use it I used the package txfonts (or pxfonts). That couldn’t hurt?)

Resolution: txfonts adjusts Times for mathematics, and pxfonts adjusts Palatino. Thus, these packages effect all the math, and are not “just for a few symbols” packages.

The symbol you’re looking for — if you found it in tx/pxfonts — will definitely be available from some other package (latex pre-defined or amsfonts, etc.); so look harder in symbols-letter.pdf (or symbols-a4.pdf) and DON’T use tx/pxfonts if Times/Palatino math is not your thing.

LaTeX/bash Calendar

Monday, February 18th, 2008

Problem How do I create a manageable calendar that:

  • Is on paper, because I’m cool
  • Has my weekly schedule, so I don’t rewrite my schedule every week
  • Has customizable daily schedule
  • Has space for general todo lists
  • Has space for regular todo lists, e.g. research and course commitments
  • Is cool

Weekly calendar jpeg preview

Briefly LaTeX/Python Planner post makes it easier to generate this. Go read it instead. Use bash to generate the dates; and use latex command definitions to insert weekly schedule. A list of reminders (TODO list with due dates) is maintained at the beginning of the file; when the date appears on the planner, the task appears on the calendar. Monthly schedules don’t recur — each monthly due-date is added iindividually in the TODO list. A three-month calendar a la published calendars is printed on every planning page.

The P/K/M/N are symbols for my commitments B-) and, needless to say, are customizable.

(more…)

PDF File jpeg Preview

Thursday, December 13th, 2007

Problem I have a pdf file, and I want to show it off on the interwebb. How can I get a good jpg thumbnail?
Solutionpdftoppm (from xpdf) -> pnmtojpeg (from Netpbm) -> convert (from ImageMagick) to scale

Try pdfcover.sh

[[code]]DQojIS9iaW4vYmFzaA0KDQppZiBbWyAkIyAtbHQgMSBdXTsgdGhlbiBlY2hvIHVzYWdlOiAkMCBwZGZmaWxlbmFtZSA7IGV4aXQ7IGZpDQoNClNDQUxFPTQwDQpUTVBQUE09L3RtcC90bXAtcHBtDQpQUkVGSVg9YGJhc2VuYW1lICR7MX0gLnBkZmANClBSRUZJWD1gYmFzZW5hbWUgJHtQUkVGSVh9IC5QREZgDQpwZGZ0b3BwbSAtZiAxIC1sIDEgLXIgMTAwICR7MX0gJHtUTVBQUE19DQpwbm10b2pwZWcgYGxzICR7VE1QUFBNfS0qWzBdMS5wcG1gID4gJHtUTVBQUE19LmpwZw0KY29udmVydCAtc2NhbGUgJHtTQ0FMRX0lICR7VE1QUFBNfS5qcGcgJHtQUkVGSVh9LXRodW1iLmpwZw0K[[/code]]

LaTeX Best Practices

Thursday, December 13th, 2007
  • \caption[brief caption for list of figures/tables/etc.]{long caption that appears in text}
  • Use bibtex
  • Include figures without extension \includegraphics{fig}, instead of \includegraphics{fig.eps} or \includegraphics{fig.jpg}. LaTeX can pick up the appropriate file depending upon the compiler (.eps for latex, and .jpg for pdflatex etc.)
  • AMS for extensive Mathy stuff instead of hacks.
  • Acknowledge source of figures and data on slides.
  • Date and version document, and provide bibliographic information about your document in bibtex or some other popular format
  • Use Beamer for presentations, and not seminar. Beamer is under active development and is designed for computer-based presentations (whereas seminar was designed for use with overhead projector presentations). Also, beamer uses document structuring with sections/subsections, which can directly be printed in article form.
  • Resources:

MATLAB Code in LaTeX

Wednesday, December 12th, 2007

Problem I write decent prototypes in MATLAB. How do I include it in a report so it doesn’t look too bad?

Demonstration of lstlisting code

Solution The latex listings package does a pretty good job. And you want some heavy customization. TODO.
(more…)

LaTeX presentations

Thursday, December 6th, 2007

Problem I like P0w3rPoint quite a bit. Mainly for the following:

  • Overlaid lists
  • Customizable style
  • Include page numbers/footers
  • Include running title
  • Image backgrounds

But I want to use LaTeX to do it, as quickly as possible with as little pain as possible.

Solution Use beamer. Ignore the rest of this post, which tries to accomplish all this using seminar.sty, but the pain involved is considerable.
Title slide
The code and accompanying figures are here.

LaTeX Image issues with pdflatex/latex

Tuesday, November 27th, 2007

Problem I want to use jpg for quick previews and eps files for high quality final document.

Solution Create both eps and jpg files at the same location with the same filename (and different suffixes, lol).

includegraphics{filename-prefix} automagically includes the eps file when compiled with latex/dvips, or latex/dvipdfm, and uses the jpg file when working with pdflatex.

Various conversion tools exist. Here’s what I have:

jpg to eps: jpeg2ps
eps to jpg: pstopnm | pnmtojpeg

LaTeX fullpage background

Monday, November 26th, 2007

Problem For title sheets I want a cool fullpage image background.

Solution eso-pic package, with \AddToShipoutPicture

LaTeX fullpage background demo

(more…)