Archive for September 25th, 2010

Using the classicthesis package with XeLaTeX

Compiling an article or anything else with classicthesis package will return errors. Indeed, something written and compiled with the classicthesis package loaded must be compiled with pdflatex (and maybe also latex, I don’t know).

Anyway, here is a little trick to compile your documents with XeLaTeX using your prefered template. First of all, we have to make a backup of our file classicthesis.sty. If you use Ubuntu and have installed TeXlive with your package manager, do as follows either with a terminal or your file manager with root privileges (for this, type Alt+F2 and enter gksu nautilus in the prompt) :

sudo cp /usr/share/texmf-texlive/tex/latex/classicthesis/classicthesis-ldpkg.sty /usr/share/texmf-texlive/tex/latex/classicthesis/classicthesis-ldpkg_backup.sty

If you have installed TeXlive with the installation script install-tl, then do as follows :

sudo cp /usr/local/texlive/2010/tex/latex/classicthesis/classicthesis-ldpkg.sty /usr/local/texlive/2010/tex/latex/classicthesis/classicthesis-ldpkg_backup.sty

Then, open classicthesis-ldpkg.sty in a text editor, let say gedit. If you have installed TeXlive with your package manager :

gksu gedit /usr/share/texmf-texlive/tex/latex/classicthesis/classicthesis-ldpkg.sty

And if not :

gksu gedit /usr/local/texlive/2010/tex/latex/classicthesis/classicthesis-ldpkg.sty

In this file, you will have to comment the following lines :

% ********************************************************************
% Using PDFLaTeX:
% ********************************************************************
\RequirePackage[pdftex,hyperfootnotes=false,pdfpagelabels]{hyperref} % backref linktocpage pagebackref
\RequirePackage[pdftex]{graphicx} % PDFTeX driver for graphicx
%\DeclareGraphicsRule{*}{mps}{*}{} % enables use of MetaPost graphics with pdflatex

% for German texts to get \autoref macros right

Then, save your file. Here is a screenshot of what I get after commenting on the left side, and before on the right side :

That’s all, folks ! Now if you compile a file with XeLaTeX using the classicthesis package, it will work. I will write soon a post about it, and will show you a sample of file I have successfully compiled.

EDIT : There is no need to comment the lines :


But in order to get mathematical symbols working with the specific setup of XeLaTeX, we have to comment the following lines :

% default: Palatino
\RequirePackage[osf,sc]{mathpazo} % Palatino with real small caps and old style figures
\linespread{1.05} % a bit more for Palatino

Which are in the file classicthesis.sty, lines 183-187 (don’t forget to comment the “{” l. 183). With that, everything will work fine with math font setup and unicode-math with XeLaTeX.


XeLaTeXで書く仕方 ・ Writing in japanese with XeLaTeX

  • 日本人であれば、XeLaTeXを使っていいです。長い説明するより簡単な例を示します。
  • \documentclass{article}
    \usepackage{xltxtra} %xltxtra = fontspec, xunicode, etc.
    \newfontfamily\en[Numbers=OldStyle,Ligatures=Historic]{TeX Gyre Pagella}

    \verbatim{\en your text goes here}

    たとえば、{\en here is a test to show you how writing both in
    english and in japanese is easy with \XeLaTeX. Of course, you can also mix any
    other languages you want.}

    {\en \XeLaTeX}に関しては次の{\en url}を参照してください:




  • If you plan to write english text with some japanese text or quotes included in your text, and not an entire text in japanese, then you should only put the following command in your preamble :


    This way, you will just have to insert {\ja } and to typeset japanese inside the {}. Therefore if you wish to write, in your english text 一言だけ, you have to do like this {\ja 一言}. As an example of my short explanation, you can try to compile the following file :

    \usepackage{xltxtra} %xltxtra = fontspec, xunicode, etc.
    \setmainfont{TeX Gyre Pagella}
    Here is an english sentence, followed by {\ja 日本語の例。} \XeLaTeX {\ja は便利ですね。}

    Here is a screenshot showing the output and the .tex file :

%d bloggers like this: