Showing posts with label macports. Show all posts
Showing posts with label macports. Show all posts

10/22/2012

! LaTeX Error: File `algorithm2e.sty' not found.

During yet another LaTeX project on my MacBook, I added some algorithms to my paper. After checking a couple of examples online, and discussing with a colleage I decided to go with algorithm2e over others such as algorithm, algorithmic, algorithmicx, program and pseudocode[1].

However I got the following error "! LaTeX Error: File `algorithm2e.sty' not found." Since I am using macport, to resolve this I needed to install the texlive-science package by executing sudo port install texlive-science, and all was good again.

References:

  1. http://en.wikibooks.org/wiki/LaTeX/Algorithms_and_Pseudocode

7/24/2012

Springer Lecture Notes in Computer Science (LNCS) style

When working on a recent paper for a conference, I was required to produce it using the Spring Lecture Notes in Computer Science (LNCS) style. Being naive, I assumed TeX would automatically download the required package... unfortunately I got the following error "LaTeX Error: File `llncs.cls' not found." So I had to install the class manually. Here are the instructions for installing it on Mac OS X for latex from macport.
  1. Download the llncs2e.zip package from the Springer website [1]
  2. Unzip the file into the tex-live distribution location for macport, i.e. /opt/local/share/texmf-texlive-dist/tex/latex
  3. Rebuild the ls-R databases using TeX by executing sudo texhash
  4. To get the bibliography style setup, change directory by using cd /opt/local/share/texmf-texlive-dist/bibtex/bst
  5. Make a directory to hold the style sudo mkdir splncs; cd splncs
  6. Either copy or link the files sudo ln -s ../../../tex/latex/llncs2e/*.bst .
TexLive
If you are using a variant of TexLive such as MacTex, then you can copy the style files (*.bst) into "/usr/local/texlive/2012/texmf-dist/bibtex/bst/splncs" and the tex files into "/usr/local/texlive/2012/texmf-dist/tex/latex/llncs" and finally to update the ls-R database use "sudo /usr/local/texlive/2012/bin/x86_64-darwin/texhash"


Makefile
My Makefile now run without issues. Here's a copy of my Makefile

PROJ=paper


OS := $(shell uname -s)

.PHONY: all pdf clean read 

all: pdf

pdf: $(PROJ).tex
 pdflatex $(PROJ)
 bibtex $(PROJ)
 pdflatex $(PROJ)
 pdflatex $(PROJ)

diff: $(PROJ)-original.tex
 latexdiff $(PROJ)-original.tex $(PROJ).tex > $(PROJ)-diff.tex
 pdflatex $(PROJ)-diff
 bibtex $(PROJ)-diff
 pdflatex $(PROJ)-diff
 pdflatex $(PROJ)-diff

readdiff:
ifeq ($(OS), windows32)
 start ${PROJ}-diff.pdf
endif
ifeq ($(OS), Darwin)
 open -a /Applications/Preview.app/Contents/MacOS/Preview ${PROJ}-diff.pdf
endif
ifeq ($(OS), Linux)
 acroread ${PROJ}-diff.pdf
endif

read:
ifeq ($(OS), windows32)
 start ${PROJ}.pdf
endif
ifeq ($(OS), Darwin)
 open -a /Applications/Preview.app/Contents/MacOS/Preview ${PROJ}.pdf
endif
ifeq ($(OS), Linux)
 acroread ${PROJ}.pdf
endif

clean:
 rm -f ${PROJ}.ps ${PROJ}.pdf ${PROJ}.log ${PROJ}.aux ${PROJ}.out ${PROJ}.dvi ${PROJ}.bbl ${PROJ}.blg ${PROJ}.toc 

cleandiff:
 rm -f ${PROJ}-diff.ps ${PROJ}-diff.pdf ${PROJ}-diff.log ${PROJ}-diff.aux ${PROJ}-diff.out ${PROJ}-diff.dvi ${PROJ}-diff.bbl ${PROJ}-diff.blg ${PROJ}-diff.toc 

References
  1. http://www.springer.com/computer/lncs/lncs+authors?SGWID=0-40209-0-0-0

10/25/2011

APAcite on Mac OS X (Lion) with texlive

I had to recently rebuild my Mac Book Pro (gasp!), and decided to upgrade to Lion.  The whole process was relatively painless. Files were copied back from backups, and updated from my SVN repositories, however I had troubles installing the appropriate Mac port package for the APACite classes.

sudo port install texlive-bibtex-extra

The latter yielded errors, which were logged in

/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_perl_p5-text-bibtex/p5.12-text-bibtex/main.log

Since the dependency p5.12-text-bibtex could not be installed, examination of the log file provided the following clues; error: 'main' must return 'int'

The same error was reported for;

  1. /opt/local//var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_perl_p5-text-bibtex/p5.12-text-bibtex/work/Text-BibTeX-0.60/btparse/tests/namebug.c
  2. /opt/local//var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_perl_p5-text-bibtex/p5.12-text-bibtex/work/Text-BibTeX-0.60/btparse/tests/tex_test.c

A quick rename of void to int enabled the package to be installed without further issues.

10/17/2011

APAcite on Mac OS X with texlive

While compiling a LaTeX document, a blank template of my PhD thesis to be exact, when I got the following error "! LaTeX Error: File `apacite.sty' not found." Again a quick search for Mac ports indicated that the texlive-bibtex-extra package was required. It was quickly installed using;

sudo port install texlive-bibtex-extra

Subsequent compile yielded more errors, this time it was "! Undefined control sequence. \abstract". This was solved using the texlive-latex-extra package, installed using;

sudo port install texlive-latex-extra


Then adding the following to define the abstract in the book documentclass;

% Define abstract in book documentclass
\pagestyle{empty}
\newenvironment{abstract}%
{
  \onehalfspacing%
  \null
  \vfill
  \chapter*{\centering Abstract}%
  \addcontentsline{toc}{chapter}{Abstract}
}%
{\vfill\null}

% Start the actual abstract
\begin{abstract}
\end{abstract}

More errors resulted "! Use of \@year@ doesn't match its definition." I had to add "\bibliographystyle{apacite}" to the bibligraphy page, and all was well once again.

References:
  1. https://trac.macports.org/wiki/TeXLivePackages
  2. http://www.cs.utexas.edu/~witchel/errorclasses.html