Bart Kastermans Computing Page

About: This page contains some LaTeX snippets (more to come).

xdvirc | LaTeX makefile | LaTeX snippets | Emacs | Moving an LCD from iBook to Powerbook | Lecture List Script

.xdvirc

The following two lines ensure (for me) that xdvi starts up with the right scaling of the page, and it updates automatically when the dvi file changes (b/c I run LaTeX again).
xdvi.shrinkFactor:  6
xdvi.watchFile: 1

Current Makefile

# Makefile for LaTeX files
#
# \author Bart Kastermans, www.bartk.nl
#

TEXFILE = ahmadTriple.tex
# number of seconds to wait between successive updates with watch
PATIENCE = 1
HOSTNAME = $(shell hostname)
SHELL = /bin/sh
LATEX_OPTIONS ?= "--src-specials"

# Use a different goal depending on which computer I am on
OFFICE = kasterma-pc
ifeq ($(HOSTNAME), $(OFFICE))
	GOAL = $(subst tex,dvi, $(TEXFILE))
else
	GOAL = $(subst tex,pdf, $(TEXFILE))
endif

# phony rules, targets are not names of created files
.PHONY: clean default view watch

default: $(GOAL)

%.dvi: %.tex
	latex $(LATEX_OPTIONS) $<
	bibtex $(subst tex,aux, $<)
	latex $(LATEX_OPTIONS) $<
	latex $(LATEX_OPTIONS) $<

%.pdf: %.tex
	pdflatex $(LATEX_OPTIONS) $<
	bibtex $(subst tex,aux, $<)
	pdflatex $(LATEX_OPTIONS) $<
	pdflatex $(LATEX_OPTIONS) $<

view: $(GOAL)
ifeq ($(HOSTNAME), $(OFFICE))
	xdvi -watchfile 1 $(subst tex,dvi, $(TEXFILE)) &
else
	open $(subst tex,pdf, $(TEXFILE)) &
endif

watch:
	while true; do \
		make LATEX_OPTIONS="--src-specials -interaction=nonstopmode"; \
		sleep $(PATIENCE); \
		clear; \
	done

clean:
# before deleting files, check that the original tex file is around
# if <filename>.tex is around, but you are attached to <filename>.aux
# or similar you are getting what you deserve.
	@if test -e $(TEXFILE); then \
		echo removing files derived from $(TEXFILE); \
		rm -f $(subst .tex,.dvi, $(TEXFILE)); \
		rm -f $(subst .tex,.aux, $(TEXFILE)); \
		rm -f $(subst .tex,.log, $(TEXFILE)); \
		rm -f $(subst .tex,.pdf, $(TEXFILE)); \
		rm -f $(subst .tex,.tex~,$(TEXFILE)); \
		rm -f $(subst .tex,.out, $(TEXFILE)); \
	else \
		echo the file $(TEXFILE) does not exist; \
	fi

Snippets.

\usepackage {amsmath, amssymb, amsthm}
% DeclareMathOperator without the repetition
\newcommand {\DMO} [1]
            {\expandafter\DeclareMathOperator\csname #1\endcsname
              {#1}}
% unified quick way to defining new axioms
\newcommand {\newaxiom} [1]
            {\expandafter\newcommand\csname #1\endcsname
              {\ensuremath {\mathsf {#1}}}}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newenvironment{definitions}
  {  \begin{definition}
        \renewcommand{\theenumi}
        {(\roman{enumi})}
        \begin{enumerate}}
  {\end{enumerate}
   \end{definition}}
\newcommand{\separate}{%
\begin{center}
  \begin{picture}(100,5)
    \thicklines
    \put(0,0){\line(1,0){100}}
    \put(0,5){\line(1,0){100}}
  \end{picture}
\end{center}
}
\DeclareRobustCommand{\edit}[1]{%
   \ifmmode
      \mathbf{\blacktriangleright #1 \blacktriangleleft }%
   \else
      \textbf{$\blacktriangleright$ #1 $\blacktriangleleft$ }%
   \fi
}
\bibliographystyle{plain}
\bibliography{FILENAME}

Emacs

Site dependent configuration in .emacs

If you use different computers (in my case one running Debian in my office and a macbook otherwise) you might want different configurations for your emacs. The following gives an example of how to achieve this.
(setq hostname (shell-command-to-string "hostname"))

(setq TeX-PDF-mode t)

(cond
 ((string-match "vv519" hostname)
  (setq TeX-PDF-mode nil)
  (setq TeX-Omega-mode t)))

Moving an LCD from an iBook to a Powerbook

Step 1: Removing an LCD from an iBook.

I have a 12″ PowerBook with a broken lcd. A friend of mine had a 12″ iBook with a good lcd but broken logic board. This friend gave me the remains of his laptop after removing the hard disk, memory, and one or two other parts that he will sell on ebay. Now I have the project of attempting to move the lcd from his iBook into my PowerBook.

It is rather a big question if the lcd will fit. I have not been able to find reliable information about this on the internet (other than suggestions in the direction that it might), so I will just try. And if it does not fit I will probably purchase a replacement, so that it is still needed to remove the old lcd.

Since the friend removed some parts, his iBook was already partly disassembled. This resulted in the following starting setup. Starting setup.

The Starting Setup
Starting setup.

The two broken laptops, and my current working laptop to look up things in the internet if I get stuck. ifixit seems to be a very good source of information about this. All tools I need to do this (spudger, #00 phillips screw driver, 4mm nut driver, and torx drivers of sizes 5 to 10) had arrived over the weekend from amazon.com and ifixit.com.

The first order of business is to remove the lcd from the iBook. The strategy for this is to just remove many screws and remove parts until the lcd has been removed. From ifixit I had already learned that removing the lcd does require essentially to take the whole laptop apart.

Since I do not intend to put this one back together I was not too careful about documenting the process, also twice I was sufficiently careless to actually break something: The bottom of the computer was extremely strongly attached where the cdrom drive was located. And the front of the monitor was fairly strongly attached to the back and made of rather soft material.

This is the result.

The Leftovers
The Leftovers.
The LCD
The LCD

Step 1 in the project is a success. I did learn however that it is really very involved, so I plan to go very slow taking very detailed notes when I take my PowerBook apart. That one definitely should go back together again.

Step 2: Putting it in the powerbook.

First to kill the suspension, it worked (almost) perfect.

The Result
The Result

The almost is because in the removing of the keyboard I broke a key (the R). I have already checked and a new (used) keyboard is $100, so a lot cheaper than an lcd. First I’d have to figure out how to properly remove keys, i.e., without breaking them.

I just followed the instructions on ifixit. Interestingly enough I should not have. In the end I found that since I really just wanted to replace the lcd and not the frame holding it, I could just have opened the frame right away. If you look at the picture from yesterday (the one from the back), liberating the cable that you see there means taking the whole laptop apart, however, this cable can be removed. And if you do that all you have to do is take the monitor frame apart (for which ifixit does not have instructions) and you can replace the lcd.

Before giving the photos I took while doing this, some observations. In the instructions a screw is indicated as allowing you to remove some emi finger, however this screw actually only keeps the keyboard in place. Since I did not realize this I removed more keys from the keyboard (breaking the R) before figuring this out.

The screws in the battery compartment are hard to reach. My screw driver was too long, so I had to work them under an angle (something my dad certainly would have shaken his finger at). Worked well enough in the end. Though getting them back in took a while.

I am slightly worried about the heatsink. I have heard that when removing this, new heat conducting putty needs to be applied. Since I do not have this putty, I just tried it without. So far it seems to work well.

The subwoofer was really strongly attached to the metal frame. In the end it only came of while I was working at opening the monitor frame.

Opening the frame was really painful. I did not have instructions, and therefore I was not quite sure which of the two parts the dark grey plastic was supposed to go with. It worked by having it go with the back of the monitor. This was still very difficult to do though, and not having instructions I was only reassured it had worked when I had it back together again. Unfortunately this meant I forgot to take pictures.

Lastly, the numbers of the two lcds are not exactly the same. The one from the iBook had number LP121X04 (C2), the one that came out of the PowerBook was LP 121X04 (C2) (K2). It has been on for a while now, and so this does not seem to matter (thus far).

Ok, the pictures then.

The Result
Battery Removed
The Result
Memory Cover Removed
The Result
Keyboard Removed
The Result
Upper cover removed
The Result
Heatsink removed
The Result
Metal frame removed.
The Result
Nearly empty.
The Result
The Result

A Lecture List Script

On my teaching page (www.bartk.nl/teach.php) I like to provide a list of topics covered during different lectures and a list of current assignments. To not have to edit html every time I give a lecture or assign homework I have written a little script.

For when my page changes from the current version, here is a screenshot of what it looks like right now picture of teaching page.

Screenshot Teaching Page
Screenshot Teaching Page

in this page I have the following php code

<?php include ("lectlistfile.html") ?>

the script writes and uploades the file lectlistfile.html quickly. It can be found on my bitbucket page and in the blog post I wrote about it.