Bart Kastermans Computing Page

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

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 .tex is around, but you are attached to .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}