Frequently Asked Questions - XeLaTeX

The short answer is that TeX doesn't know how to deal with UTF-8 (or rather non-ASCII) characters. XeTeX has been designed to work around these limitations. The easiest way to generate PDFs is to install Xe(La)TeX and use the 'xedemo' templates - these templates have been 'ported' from LaTeX to XeLaTeX.

Distribution specific install instructions listed below.

Debian / Ubuntu 

Install texlive-xetex that includes xelatex

apt-get install texlive-xetex

but you need to patch LaTeX::Driver
Install liblatex-{driver,encode,table}-perl for latex

apt-get install liblatex-{driver,encode,table}-perl

and libmoosex-followpbp-perl for Template::Plugin::Latex

apt-get install libmoosex-followpbp-perlafter that:

apt-get install libtemplate-plugin-latex-perl  (or cpan Template::Plugin::Latex)
 

LedgerSMB xelatex configuration

Install xelatex and change the LedgerSMB configuration from the menu:
System -> System Defaults -> Templates directory
Change to "xedemo"

Change a path

From the mailing list: (Chris Travers)
Right now, I am open to suggestions on a better approach, as the Template::Latex api's don't seem to work to do this, but I resorted to changing the paths in LaTeX::Driver::Paths directly (find the location with locate LaTeX/Driver/Paths.pm). This file gets written at installation time for the LaTeX::Driver module and so I consider it reasonably editable.

locate LaTeX/Driver/Paths.pm

If locate is not installed you can do:  find /usr . |grep "LaTeX/Driver/Paths.pm"
/usr/share/perl5/LaTeX/Driver/Paths.pm  ( Debian / Ubuntu )

Make a backup copy of  LaTeX/Driver/Paths.pm (you have to have root priviliges to do this or use sudo)

cp /usr/share/perl5/LaTeX/Driver/Paths.pm /usr/share/perl5/LaTeX/Driver/Paths.pm.backup(Change the path to your path for LaTeX/Driver/Paths.pm)

User your text editor to edit LaTeX/Driver/Paths.pm  (you have to have root priviliges to do this or use sudo)

In LaTeX/Driver/Paths.pm change

$program_path{pdflatex} = '/path/to/pdflatex;

to

$program_path{pdflatex} = '/path/to/xelatex';

 

This is the error you get, if you do not change:
/usr/share/perl5/LaTeX/Driver/Paths.pm  (Debian path)  :


Error!

latex error - pdflatex exited with errors:
!
l.26 \RequireXeTeX
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! Fatal fontspec error: "cannot-use-pdftex"
!
! The fontspec package requires either XeTeX or LuaTeX to function.
!
! You must change your typesetting engine to, e.g., "xelatex" or "lualatex"
! instead of plain "latex" or "pdflatex".
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................
l.38 }



 

The utf8 character "hack fix"

Before making this change will UTF8 characters appear as squares in the PDF file. To print utf8 characters in pdf files, you must make the following change:

These are the steps:
su root
open /usr/share/perl5/LaTeX/Driver.pm
in your text editor
go to line 174 on Debian Squeeze (6.x) and line 176 on Debian Wheexy (7.x)
you see "write_file( ..." there
change

".tex", $source

to

".tex", {binmode=>':utf8'}, $source

 

Font fix

In order for Verdana to work, install the package ttf-mscorefonts-installer (Debian/Ubuntu)

apt-get install ttf-mscorefonts-installer

In versions 1.3.28 and up, the demo templates no longer depend on Verdana though, but use the non-proprietary Liberation font set, which can be installed using

apt-get install fonts-liberation
 

Code reference to LedgerSMB

The code for this is LedgerSMB/Template/Latex.pm

Component: 
Base
Release: 

The templates use the Template Toolkit scripting language to generate actual content.
Depending on the typesetting language, the files use
* HTML;
* (Xe)LaTeX; or
* plain text
as the typesetting system.

While LaTeX and XeLaTeX are extremely similar, some differences exist, mainly in the area of font selection and document preamble.

Latex cheat sheet - http://www.stdout.org/~winston/latex/
Latex in 157 minutes - http://tobi.oetiker.ch/lshort/lshort.pdf

The LATEX Font Catalogue - http://www.tug.dk/FontCatalogue/about.html
Guide in Norwegian: http://dag.at.ifi.uio.no/latex-links/uiofonts.pdf

Component: 
Base
Release: 

When trying to use XeLaTeX, you may get a message like:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! You are attempting to make a LaTeX format from a source file
! That is more than five years old.
!
! If you enter to scroll past this message then the format
! will be built, but please consider obtaining newer source files
! before continuing to build LaTeX.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

! LaTeX source files more than 5 years old!.
l.545 ...aTeX source files more than 5 years old!}

?
! Emergency stop.
l.545 ...aTeX source files more than 5 years old!}

No pages of output.
Transcript written on xelatex.log.
Error: `xetex -ini -jobname=xelatex -progname=xelatex -etex xelatex.ini' failed

###############################################################################
fmtutil: Error! Not all formats have been built successfully.
Visit the log files in directory
/var/lib/texmf/web2c
for details.
###############################################################################

This is a summary of all `failed' messages and warnings:
`xetex -ini -jobname=xelatex -progname=xelatex -etex xelatex.ini' failed

This is confirmed to be a problem on CentOS 6, Scientific Linux 6, Red Hat Enterprise Linux 6, and Fedora Core 13.

You can correct this issue (as root) by:

cd /usr/var/texmf/web2c
xetex -ini -jobname=xelatex -progname=xelatex -etex xelatex.ini

Once you type this you will get the same message, but have the option to press return and generate the file anyway.

Component: 
Base
Release: 
FAQ Category: 
Topic: 

Make sure you have TexLive installed. Older TeTeX was recommended but according to Ubuntu repositories, TexLive is the new package to install.

You can install this with the following command:

apt-get install texlive-latex-extra

 

Release: 
FAQ Category: 
Operating system: