[Tex/LaTex] Using microtype protrusion with XeTeX and Ubuntu

file-lookupmicrotypeUbuntuxetex

I believe I have all the correct versions of the software at hand and installed (v. 2.5 of microtype and .9998 of XeTeX) to get protrusion to work with XeTeX on my Ubuntu system but I keep getting an error when compiling. Here's the MWE:

\documentclass{book}
\usepackage[T1]{fontenc}
\usepackage{lipsum}
\usepackage[protrusion=true]{microtype}
\begin{document}
\mainmatter
\lipsum
\end{document}

But when I attempt to compile with xelatex microtest.tex I get:

This is XeTeX, Version 3.1415926-2.4-0.9998 (TeX Live 2012/Debian)
restricted \write18 enabled.
entering extended mode
(./microtest.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation,     lo
aded.
(/usr/share/texlive/texmf-dist/tex/latex/base/book.cls
Document Class: book 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/bk10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.def))
(/usr/share/texlive/texmf-dist/tex/latex/microtype/microtype.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)


! LaTeX Error: File `microtype-xetex.def' not found.

I have microtype-xetex.def installed in /usr/share/texlive/texmf-dist-tex/latex/microtype:

pwd
/usr/share/texlive/texmf-dist/tex/latex/microtype
ls
letterspace.sty       mt-bch.cfg        mt-eus.cfg               mt-ppl.cfg
microtype.cfg         mt-blg.cfg        mt-LatinModernRoman.cfg  mt-ptm.cfg
microtype.lua         mt-CharisSIL.cfg  mt-msa.cfg               mt-ugm.cfg
microtype-luatex.def  mt-cmr.cfg        mt-msb.cfg               mt-zpeu.cfg
microtype-pdftex.def  mt-euf.cfg        mt-mvs.cfg
microtype.sty         mt-eur.cfg        mt-pad.cfg
microtype-xetex.def   mt-euroitc.cfg    mt-pmn.cfg

I've copied those files over to other spots but I keep getting the same error. Is there perhaps some kind of install script I was supposed to run or compile? All I did was copy the extracted files I downloaded to this directory (replacing the microtype files that were already there).

Best Answer

The TeX systems relies on a cache for finding files, in order to reduce search time in its huge directories.

The main trees all have at their top level a file named ls-R that contains a tree representation of the subdirectories and their contents.

When a new file is installed in a directory in the main tree, the cache needs to be updated by

sudo texhash

However, it's not a good idea to modify the directories in the main tree because they might be restored during an update and you'd end up with an unstable TeX system.

All TeX distributions maintain a "local" tree, which you can find the location of with the shell command

kpsewhich -var-value TEXMFLOCAL

On my machine it is

/usr/local/texlive/texmf-local

You can create the relevant subtree with

sudo mkdir -p $(kpsewhich -var-value TEXMFLOCAL)/tex/latex/microtype

and then copy the files belonging to the microtype package in the created directory by

sudo cp * $(kpsewhich -var-value TEXMFLOCAL)/tex/latex/microtype

assuming you are in a work directory containing the downloaded file. A new

sudo texhash

will enable you to work with microtype version 2.5 without touching the original, since the "local" tree is looked at before the main tree.

Related Question