Archive for September, 2010

Writing math with XeLaTeX

The following is a short explanation for those who wish to get the basics to write math with XeLaTeX :

  • First, you will notice, if you look at the xelatex directory, that there is a mathspec folder. If you don’t know where is your xelatex folder, then look here if you have installed TeXlive with the installation script :


    Or look here if you have installed TeXlive with your package manager :


  • But a better choice might be to use unicode-math, though it is still in its beta stage. Documentation about this package is located in the following directory in case you have installed TeXlive with the installation script install-tl :


    Or here if you have installed TeXlive with your package manager :


  • Let us assume you wish to use the unicode-math package. Then, you will have to load it :


    And to define the font for math :

    \setmathfont{Asana Math}

    Consequently, here is an example of minimal preamble to write math and compile with XeLaTeX :

    \setmainfont{TeX Gyre Pagella}
    \setmathfont{Asana Math}

    Where article is a class to make a test, unicode-math the package to input math with XeLaTeX, amsmath the usual package for math and xltxtra the usual package for XeLaTeX which load some useful modules (see the xltxtra for a list of these modules).
    Also, \setmainfont{TeX Gyre Pagella} is the definition of the font for your text, and \setmathfont{Asana Math} the definition of the fonts for math as I said previously.

Here is a screenshot of an example of output (a pdf file) we can get with XeLaTeX :


Writing an application letter with XeLaTeX

With LaTeX, several packages are dedicated for letters. For french TeX users, there is for example the class lettre, which might be widely used. For english TeX users, the letter written with the letter class or with koma-script might be also used.

Also, notice that the structure of a letter should be as follows :

Here I will focus on the isodoc class for application letters. I have pushed a template in my repository at Github. If you want documentation for this letter, then type Alt+F2 and in the prompt enter (without quotes) “texdoc isodoc”, or look here. The documentation for this package is really good, and contains some examples, so don’t hesitate to refer to it if you have any problem.

Basically, the .tex file is divided into three parts, that is to say the preamble, the setup of the letter and then the text. The following is a description of the parts from my template that I use for an example :

  1. A brief description of the preamble :
  2. % Created 2010-09-21 Tue 22:02

    First, here is the class of the document, and then the package for XeLaTeX.

    \setmainfont[Numbers=OldStyle,Ligatures=Historic]{TeX Gyre Pagella}

    Here is the usual setup for fonts I use. If you want some documentation about TeX Gyre Pagella, type Alt+F2 and enter in the prompt “texdoc qpl-info”, or look here.


    Some useful packages, nothing special.


    If you are not french, replace it by polyglossia, according to the language you wish to use. For more information, type Alt+F2 and “texdoc polyglossia” in the prompt or look here.

    colorlinks=true, linktocpage=true,breaklinks=true,
    urlcolor=spot, linkcolor=blue, citecolor=green,
    pdftitle={Letter},%the title

    Nothing special, just the usual hyperref setup I use.

    \tolerance=1000 %

    Some nice settings, for hyphenation, and others, such as headcolor, which unable the nice gray color of headers and footers you will see in the screenshot at the bottom of my post.

  3. The following is a brief description of the setup of the letter (notice that the following is just MY setup, an example, there are more options, look at the isodoc documentation I have indicated above if you need more) :
  4. \setupdocument{%about this section, see isodoc, p. 3 to 7
    language = french
    company = Alexandre Krispin
    who = Alexandre Krispin
    street = {41 rue Guynemer}
    city = St-Denis
    zip = 93200

    Here is the first part of my setup. If you are not french, replace french by your language. Since it is not a letter from an employee of a company, I have put my name after “company =”, as it is indicated in the documentation. Then, you have to put your name and adress. Notice that you must put a comma after the information you enter, in order to indicate the end of the information. Also, if you want to put commas in your adress, you will have to use brackets {}. If you don’t use the brackets {}, then you will have erors when compiling your file.

    to = {Université Paris Ouest \\
    Nanterre La Défense\\
    200, avenue de la République\\
    92201 \caps{NANTERRE CEDEX}}
    date = today
    opening = {Madame, Monsieur,}
    subject = {Here goes the subject of your letter}

    “To” indicates the addressee. “Return” the address where you wish to receive an answer, etc. For more information, look at the isodoc documentation, easy to understand and very good.

    closing = {Je me tiens à votre entière disposition pour plus
    d’information, je vous prie d’agréer, Madame, Monsieur, l’expression
    de mes salutations les plus distinguées}
    signature = Alexandre Krispin
    phone = 0628766934
    email =
    website = \url{}

    Then comes the closing, the signature and the footer if you want it. In the footer will appear your phone, email and your website.
    The fill option is to get the text fully justified, on the left and on the right. In other words, “fill” is the option to get the usual hyphenation with LaTeX.

  5. Finally, you have the environment in which your text is written :
  6. \begin{document}
    Je me présente, je m’appelle henri. Je voudrais bien réussir ma vie, être aimé. Quand je serai grand, j’aimerai bien être médecin, ou plombier, ou rappeur, ou dealer, ou braqueur, ou\ldots tout niquer tout dans paname !
    etc, etc.

Here is a screenshot of the output, a pdf file, after compiling with xelatex :

You can find the source file of this example in my repository at Github.

If you have any problem, don’t hesitate to leave a comment.

Writing an article with XeLaTeX : part 2

Writing an article is nothing special, but it might require some skills if your are not used to \LaTeX and want to use some special packages. When I was using pdflatex, one of those I was constantly using was ClassicThesis. Indeed, ClassicThesis is really an amazing package. It is based on the style of The Element of Typographic Style, written by Robert Bringhurst. If you don’t know this famous book, then look here :
The Elements of Typographic Style at
The Elements of Typographic Style at
If you are also interested to this, maybe you should take a look here for an application of this book to the web typography :
The Elements of Typographic Style applied to the web

Anyway, the purpose of this post is to show you a template I have made in order to use classicthesis for an article, and to be able to compile the .tex file with XeLaTeX. To make it work, you have to do the little trick I have previously described :
Modifying the classicthesis package to make it work when compiling the *.tex file with xelatex instead of pdflatex.

Also, I have uploaded the template to my repository at Github. The following is a short description of this template.

\documentclass[10pt,a4paper]{scrartcl} % KOMA-Script article
\usepackage{xltxtra} %some packages for xelatex
]{babel} %for french. If you write in english, then you might want to
%get a try to polyglossia

First I have put the basic packages to write an article which will be compiled with XeLaTeX. But notice that since I am french I use babel, but if, for example, you are indian, english, japanese, etc, then get a try to polyglossia.

%\setmainfont[Numbers=OldStyle,Ligatures=Historic]{TeX Gyre Pagella}

%If you want other fonts, try the following
%\setmainfont{Charis SIL}
%\setmainfont{URW Palladio L}
%\setmainfont{Linux Libertine O}
%\setmainfont{Gentium Book Basic}

%For japanese input :

The above shows you the setup for the fonts. If you don’t want the default font used with the ClassicThesis package, then uncomment any font you want to use instead. I have also included the setup to write in japanese, remove it if you don’t want it.

If you plan to write in japanese your entire articles, then set IPA明朝 as your main font, and if you plan to write in any other language, then set the font corresponding to your language as the main font. If you don’t know what is the font corresponding to your language, then look at the tips I have previously written here.

\usepackage{color} %If you want to use it within your text, use the
%command \textcolor{spot}{your text}

Here I have set a color, just in case I would need it.

colorlinks=true, linktocpage=true, pdfstartpage=3, pdfstartview=FitV,%
% uncomment the following line if you want to have black links (e.g., for printing)
%colorlinks=false, linktocpage=false, pdfborder={0 0 0}, pdfstartpage=3, pdfstartview=FitV,%
breaklinks=true, pdfpagemode=UseNone, pageanchor=true, pdfpagemode=UseOutlines,%
plainpages=false, bookmarksnumbered, bookmarksopen=true, bookmarksopenlevel=1,%
hypertexnames=true, pdfhighlight=/O,%hyperfootnotes=true,%nesting=true,%frenchlinks,%
urlcolor=blue, linkcolor=blue, citecolor=green, %pagecolor=RoyalBlue,%
%urlcolor=Black, linkcolor=Black, citecolor=Black, %pagecolor=Black,%
pdftitle={Article},%the title
pdfauthor={Alexandre Krispin},%your name
pdfproducer={A happy XeLaTeX user}%

Here is nothing special, the usual hyperref setup I use.

\usepackage{enumitem} %if you want to customize lists
\usepackage{array} %texdoc array
\usepackage{natbib} % an extension to allow author-year citations
% along wih numerical citations. For more
% informations, texdoc natbib
\usepackage{eukdate} %to redefine the default layout of the date format
\usepackage{textcomp} %some special characters
\usepackage{url} %for url
\usepackage{longtable} %for long tables
\usepackage{textcomp} %additional characters
\usepackage{amsmath} %for maths
\usepackage{graphicx} %to include graphics
\usepackage{wrapfig} %to get nice wrap of figures

Some useful packages. Add or remove some if you need or don’t need something. There is also the command loading the ClassicThesis package.

The so-called Iran’s threat%The title of your article
Facts and analysis
Alexandre Krispin %author name and first name




%The abstract of your article





The usual opening setup, with an abstract and a table of content, nothing special.

Here are screenshots showing you how the template looks like. The first screenshot :

And the second screenshot, which show another page :

I have pushed the source file of this example to my repository at Github.

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 :

Fonts with XeLaTeX : tips and troubleshooting

  • First, one thing about fonts with XeLaTeX. How do I know what fonts I could use for the language I want to typeset ? Open a terminal (with ubuntu, enter alt+f2, and enter gnome-terminal in the prompt), and copy the following :

    fc-list :lang=en

    It will give you all fonts with their style that you can use for each language you specify. If you want to specify another language, then replace the “en” after “lang=” with any other language. For example, if i want to know what are the japanese fonts I can use, I replace “en” with “ja”, it returns :

    $ fc-list :lang=ja
    IPA X0208 P明朝,IPAX0208PMincho:style=Regular
    文泉驛等寬正黑,WenQuanYi Zen Hei Mono,文泉驿等宽正黑:style=中等,Medium
    文泉驛等寬微米黑,WenQuanYi Micro Hei Mono,文泉驿等宽微米黑:style=Regular
    YOzFontEF90:style=Bold Italic
    IPA X0208 Pゴシック,IPAX0208PGothic:style=Regular
    YOzFont:style=Bold Italic
    YOzFont90:style=Bold Italic
    YOzFontF:style=Bold Italic
    YOzFontE:style=Bold Italic
    YOzFontC:style=Bold Italic
    YOzFontA:style=Bold Italic
    YOzFontN:style=Bold Italic
    さざなみ明朝,Sazanami Mincho:style=Regular,Mincho-Regular
    YOzFontEF:style=Bold Italic
    YOzFontAF:style=Bold Italic
    YOzFontCF:style=Bold Italic
    YOzFontNF:style=Bold Italic
    Takao P明朝,TakaoPMincho:style=Regular
    文泉驛正黑,WenQuanYi Zen Hei,文泉驿正黑:style=中等,Medium
    YOzFontCF90:style=Bold Italic
    東風ゴシック,Kochi Gothic:style=標準,Regular
    東風明朝,Kochi Mincho:style=標準,Regular
    IPA X0208 UIゴシック,IPAX0208UIGothic:style=Regular
    IPA X0208 明朝,IPAX0208Mincho:style=Regular
    YOzFontN90:style=Bold Italic
    YOzFontAF90:style=Bold Italic
    文泉驛微米黑,WenQuanYi Micro Hei,文泉驿微米黑:style=Regular
    YOzFontA90:style=Bold Italic
    IPA Pゴシック,IPAPGothic:style=Regular
    YOzFontC90:style=Bold Italic
    IPA X0208 ゴシック,IPAX0208Gothic:style=Regular
    YOzFontE90:style=Bold Italic
    YOzFontNF90:style=Bold Italic
    YOzFontF90:style=Bold Italic
    Takao Pゴシック,TakaoPGothic:style=Regular
    IPA P明朝,IPAPMincho:style=Regular

    If you don’t know how you could know what is the abbreviation for your language, then copy the following line in your terminal :

    ls /usr/share/locale

    It will return all locales :

    The locales show you the abbreviation for each language, which you can use with the “fc-list :lang=*” command. For example, if I want to know the fonts for arabic :

    fc-list :lang=ar
    Times New Roman:style=Normal,obyčejné,Standard,Κανονικά,Regular,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,thường,Arrunta
    PakType Naqsh:style=Regular
    Times New Roman:style=Negreta,tučné,fed,Fett,Έντονα,Bold,Negrita,Lihavoitu,Gras,Félkövér,Grassetto,Vet,Halvfet,Pogrubiona,Negrito,Полужирный,Fet,Kalın,Krepko,đậm,Lodia
    Courier New:style=Normal,obyčejné,Standard,Κανονικά,Regular,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,thường,Arrunta
    PakType Tehreer:style=Regular
    MPH 2B ダマセ,MPH 2B Damase,MPH 2B 大媽賊,MPH 2B 다마세,MPH 2B 大妈贼:style=Regular
    DejaVu Sans,DejaVu Sans Condensed:style=Condensed,Book
    DejaVu Sans,DejaVu Sans Condensed:style=Condensed Bold,Bold
    Courier New:style=Negreta,tučné,fed,Fett,Έντονα,Bold,Negrita,Lihavoitu,Gras,Félkövér,Grassetto,Vet,Halvfet,Pogrubiony,Negrito,Полужирный,Fet,Kalın,Krepko,đậm,Lodia
    DejaVu Sans:style=Bold
    DejaVu Sans:style=Book
    DejaVu Sans Mono:style=Book
    DejaVu Sans Mono:style=Bold

  • Secondly, if you use XeLaTeX for the first time with, let say, Ubuntu 10.04, you are likely to get a problem with your fonts. Indeed, with Ubuntu 10.04 I got error messages when I wanted to use TeX Gyre Pagella. Here is a post to show you how to solve this problem if you get it. Notice that if you have installed TeXlive with your package manager, maybe you won’t get this problem, I don’t know.

    Unfortunately, I am not aware of how XeLaTeX behaves with Microsoft Windows XP, Vista or Seven. For this reason, if you use those operating system, I can try to help you if you post a comment, but I can’t ensure you I can sucessfully help you. If you use a Unix system, then the following method might work, and has been tested with Ubuntu 10.04.

    First, you need to copy texlive-fontconfig.conf in an other part of your system. For this, you need administrator privileges. To do so, you have two ways.

    1. The first way, faster, depends on how you have installed your TeX distribution. If you have installed TeXlive with your package manager (Synaptic or Ubuntu software center in Ubuntu), then copy the following line in a terminal (to run this application, alt+f2 and enter gnome-terminal in the prompt) :
    2. sudo cp /usr/share/texmf-texlive/fonts/conf/texlive-fontconfig.conf /etc/fonts/conf.d/09-texlive.conf

      Since I don’t have installed TeXlive with my package manager, this line may not be correct. If so, don’t hesitate to leave a comment, I can modify it and tell you how to find the right line by yourself. Otherwise, if you are not familiar with the command line, then use your file manager. For this, type Alt+F2, and in the prompt enter gksu nautilus. Here is a screenshot :

      Then, look at the device section in the panel on your left, and go in the file system section :

      Then, search for the right directory in usr, share, something like texmf-texlive (since I can’t try I am not sure), fonts, conf, and copy texlive-fontconfig.conf. Then return select once again the file system directory, go in etc, fonts, conf.d, past the file in this directory and rename it as 09-texlive.conf. Then run the following line in a terminal :

      sudo fc-cache -fsv

    3. If you have installed TeXlive with the install script install-tl, then copy the following line in your terminal :

      sudo cp /usr/local/texlive/2010/texmf-var/fonts/conf/texlive-fontconfig.conf /etc/fonts/conf.d/09-texlive.conf

      And this one :

      sudo fc-cache -fsv

    For more details, see the texlive guide, section 3.4.5, p. 14. To do so, type alt+F2, enter texdoc texlive-en in the prompt. Or look here.

writing an article with XeLaTeX : part 1

Writing an article with LaTeX and compiling it with pdflatex might be a good solution if you don’t expect to use japanese, chinese, arabic characters or anything else which is not included in the roman alphabet. But if you plan, for example, to write in japanese, then pdflatex is not the better way. Moreover, the documentation on the web about CJK, LaTeX and japanese is generally outdated. See for example the japanese documentation for LaTeX in the japanese wiki of Ubuntu. In the outlook section of LaTeX packages, it is even recommended to install pTeX, based on TeTeX.

Nowadays, we don’t have to use LaTeX anymore, we can use XeLaTeX. Compiling a *.tex file with XeLaTeX can be done with TeXLive 2009 or TeXLive 2010, so you don’t have to update your TeX distribution if you use Ubuntu 10.04 or any other operating system with a recent TeX distribution. I have made a template to be compiled with XeLaTeX, based on classicthesis.sty, mathspec.tex and many other informations I found on the web. Here is a brief description of the template I have pushed to my repository at Github :

%footsepline, %to get a line separating footnote from page number.
%titlepage=true, %if you want an entire page for you title, name and date.
%twoside=true, %if you want to print on both side (recto-verso) of the %page.

The above code show you scrartcl with some options, depended of what you want, you can comment, uncomment or add others. If you need documentation about the class scrartcl, and if you use Ubuntu with gnome, type alt+F2 and in the prompt enter texdoc scrguien. If you don’t use Ubuntu, and you don’t know where are the files related to Koma-script, you can download it at


\usepackage{xltxtra} %include fontspec, xunicode, etc. For more %details, texdoc xltxtra
%\usepackage{polyglossia} %xetex version of the babel %package. Since it is incomplete, %french users have to use babel. For %other users, replace french by your language
%\setmainlanguage[variant=british]{english} %for english users. For
%more documentation, texdoc polyglossia.

The above are the package xltxtra which load other packages to be used with xelatex. Also, since I need the french localization, I load frenchb with babel, but if you are english, german, etc, you just have to comment frenchb and uncomment or add other one. More details about it with texdoc babel, or at ctan. Notice that you could use polyglossia, the replacement of babel made for XeTeX. Unfortunately, the french option for polyglossia is not as good as the one for babel, that’s why I use babel with XeLaTeX. But if you are not french, you should try polyglossia.

%Comment or uncomment to select one of the following fonts
%\setmainfont{Charis SIL}
%\setmainfont{URW Palladio L}
%\setmainfont{Linux Libertine O}
%\setmainfont{Gentium Book Basic}
% \usepackage[scaled=0.85]{berasans}
% \usepackage[scaled=0.85]{beramono}
\setmainfont[Numbers=OldStyle,Ligatures=Historic]{TeX Gyre Pagella}

Here are some examples of fonts commented. TeX Gyre Pagella is uncommented since it is the font I use by default for my articles.

%For japanese input \newfontfamily\ja[Scale=0.8]{IPA明朝} %If you wish to write in
%japanese, then use the command
%\jap. Here is an example : “Hello, here is a test : {\ja ここはテストしてま〜〜〜す!}.” Try to compile it. %***********************************************************
%If you want to write in arabic from the right to the left load the %following package :
%\usepackage{bidi} %then, use the command \setRL to right from the right to the left. For more details, texdoc bidi.

Here are the settings for japanese, and an example. Also, notice that you can write your texts from the right to the left with the package bidi.

%Other useful packages for a basic article
\usepackage{url} %for url
\usepackage{longtable} %for long tables
\usepackage{textcomp} %additional characters
\usepackage{amsmath} %for maths
\usepackage{graphicx} %to include graphics
\usepackage{wrapfig} %to get nice wrap of figures
\usepackage{eukdate} %to redefine the default layout of the date format
% ********************************************************************
% Hyperreferences setup
\hypersetup{% colorlinks=true, linktocpage=true, pdfstartpage=3, pdfstartview=FitV,%
% uncomment the following line if you want to have black links (e.g., for printing)
%colorlinks=false, linktocpage=false, pdfborder={0 0 0}, pdfstartpage=3, pdfstartview=FitV,
% breaklinks=true, pdfpagemode=UseNone, pageanchor=true, pdfpagemode=UseOutlines,
% plainpages=false, bookmarksnumbered, bookmarksopen=true, bookmarksopenlevel=1,
% hypertexnames=true, pdfhighlight=/O,
urlcolor=blue, linkcolor=blue, citecolor=green,
%pagecolor=RoyalBlue,% %urlcolor=Black, linkcolor=Black, citecolor=Black,
%pagecolor=Black,% pdftitle={Article},%the title pdfauthor={Alexandre Krispin},%your name pdfsubject={},% pdfkeywords={},% pdfcreator={XeLaTeX},% pdfproducer={A happy XeLaTeX user}% }

Here is nothing special, just some packages that can be useful, and the hyperref setup.

%Appearance, etc
\usepackage{xcolor} %use color with the command \textcolor{spot}{some text to
%with your color previously defined}

%redefining the section command in order to get previously defined
%color for each section title.
% \makeatletter
% \renewcommand\section{\@startsection {section}{1}{\z@}%
% {-3.5ex \@plus -1ex \@minus -.2ex}%
% {2.3ex \@plus.2ex}%
% {\color{spot}\normalfont\Large\bfseries}}
% \makeatother

\areaset[5mm]{312pt}{761pt} % 686 (factor 2.2) + 33 head + 42 head \the\footskip

%\pagestyle{scrheadings} %for more information about headings, texdoc scrguien,
%chp. 4

Here is the setup for the margins, etc. You will notice that I tried to set a color for the sections, but haven’t been able to get it successufly working. And since I don’t really care about it, I have given up.

% for the following, see mathspec.tex (for me /usr/local/texlive/2010/texmf-dist/xelatex/mathspec/mathspec.tex
% for ubuntu users who have install texlive with the package manager, replace /usr/local/texlive/2010 by /usr/share/texmf-texlive (but I’m not sure, you have to check your directory /usr/share)

\if b\expandafter\@car\f@series\@nil
\math@fontsfalse\selectfont A%
\scshape a%
\if b\expandafter\@car\f@series\@nil%
\newcommand\tablerowa[3]{$\csname #1#3\endcsname$ & \cmd{#1#3} & $\csname #2#3\endcsname$ & \MakeLowercase{\cmd{#2#3}}}
\newcommand\tablerowb[1]{$\csname #1\endcsname$ & $\csname var#1\endcsname$ & \cmd{var#1}}
\ifdim\captionwidth \captionwidth
{\begin{minipage}[t]{\textwidth}\begin{description}\item[\rmfamily\mdseries\scshape\footnotesize\spotcolor advanced]\itshape\footnotesize}

The above code show you the definition of the color “spot” and other settings. Since it is just a copy of settings found in mathspec.tex, you can look at your xelatex directory of your TeX distribution. For me it is at /usr/local/texlive/2010/texmf-dist/doc/xelatex/mathspec/mathspec.tex. If you don’t find where is your directory, take a look at ctan.

\usepackage{booktabs} % for better rules in tables
\usepackage{textcase} % for \MakeTextUppercase
% sections \FloatBarrier
\titleformat{\section} {\relax}{\textsc{\MakeTextLowercase{\thesection}}}{1em}{\large\scshape\lowercase}
% subsections
\titleformat{\subsection} {\relax}{\textsc{\MakeTextLowercase{\thesubsection}}}{1em}{\normalsize\rmfamily\mdseries\itshape\lowercase}

% subsubsections
\titleformat{\subsubsection} {\relax}{\textsc{\MakeTextLowercase{\thesubsubsection}}}{1em}{\normalsize\rmfamily\mdseries\itshape\lowercase}

% paragraphs

% descriptionlabels

% spacedlowsmallcaps textit textsc
% spacing

Here is some code I have taken from the classicthesis package. This code modify the layout of sections, subsections, subsubsections, paragraphs and of text in \items[]. If you want to look at the original file, classicthesis.sty, you can find it in directory */texmf-dist/tex/latex/classicthesis/, where * could be /usr/share, or /usr/local/texlive/2010, depending on the installation way you have chosen to install TeXlive. Otherwise, take a look at


p, li { white-space: pre-wrap; }


%Table of content


\usepackage{multicol} %useful here to get a table of contents with 2 columns




%If you don’t want to make subsubsections appear in your table of contents



\def\@seccntformat#1{\protect\makebox[0pt][r]{\csname the#1\endcsname\hspace{\marglistsep}}}




%if you want to get dot between the word and the page number in the

%table of contents, uncomment the lines between \makeatletter and \makeatother.

% \makeatletter

% \renewcommand\l@section[2]{%

% \ifnum \c@tocdepth >\z@

% \addpenalty\@secpenalty

% \addvspace{1.0em \@plus\p@}%

% \setlength\@tempdima{1.5em}%

% \begingroup

% \parindent \z@ \rightskip \@pnumwidth

% \parfillskip -\@pnumwidth

% \leavevmode {\bfseries

% \advance\leftskip\@tempdima

% \hskip -\leftskip

% #1}\nobreak\

% \leaders\hbox{$\m@th\mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$}

% \hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par

% \endgroup

% \fi}

% \makeatother


I have taken the code for the table of content from mathspec.tex, so once again if you like it look at this file in the directory previously indicated. I have added the package multicol in order to get the same layout than the one you can see in mathspec.pdf. Also, though I don’t like it, you can uncomment the lines between makealetter and makeatother if you want to get dots between the name of your titles and the page number.



%Here goes your title

%Enter here your subtitle
%Enter your name and first name



%\addtocontents{toc}{\protect\begin{multicols}{2}} %if you want to get a table of
% contents with 2 columns. If you prefer one column, comment this line and
% the one just before \end{document}

% your text goes here


The settings for the title is similar to those of mathspec.tex, but since in mathspec.tex a different document class is used, I have changed some settings to make it work with the koma-script class, scrartcl.

Also, if you want a table of contents divided in two columns, then uncomment the line “\addtocontents{toc}{\protect\begin{multicols}{2}}”, and the other just before \end{document}, “\addtocontents{toc}{\protect\end{multicols}}”.

Lastly, if you want to use the color spot previously defined, write \textcolor{spot}{the text you want to colorize} and you will get it. Here are 2 screenshots showing how this template looks with an example of short article :

And the other picture :

You can find this example at the same directory of my repository, here.

Installing a TeX distribution : Windows, Mac OSX, GNU/Linux, FreeBSD

Here is a walkthrough for those who wish to install a TeX distribution in their Operating system, but who don’t know the right place from where they should start, and who are not so familiar with google searches.

  1. For Windows : Installing MikTeX is easy and has already been well described by others. That’s why rather than describing you the installation process, look at this page :
    Tutorial of the installation of MikTeX by Philippe Goutet, professor at the University Paris 6 (Jussieu).
    For english users who don’t understand french, and who wish to understand this page, you have 2 choices : (1) to focus on images and ignore the french explanations (2) to understand that if you don’t play video games, you should install Ubuntu on your computer as a replacement of Microsoft Windows, and follow the second item of this post
  2. For GNU/Linux part 1 : You can install TeXlive 2009 with the package manager. With Ubuntu, open Ubuntu Software center, search for texlive-full, and install it :
  3. For GNU/Linux part 2 : If for any reason, you prefer to install the latest TeXlive version, currently 2010, then do as follows :
    • Go here and download :
    • Then, expand the archive, open it, copy the install-tl in your home directory, open a terminal (type alt+F2 and in the prompt enter “gnome-terminal” without the quotes), launch install-tl with “sudo ./install-tl -gui”, and enter your password :
    • After that the installation interface will launch :
      You don’t have to make any change, just click the button at the bottom, on the left (in english it may be “install TeX Live”, in japanese it is “TeX Live の導入”). Then, the installation process will begin (you may have to wait more than 1h until it finishes, so be patient) :

    • After this installation process is finished, you will have to add a PATH to get your installation work. For this, add the following lines at the end of your .bashrc (type alt+f2 and enter in the prompt “gedit /home/username/.bashrc”, where username is you user name) :

      PATH=/usr/local/texlive/2010/bin/i386-linux:$PATH; export PATH
      MANPATH=/usr/local/texlive/2010/texmf/doc/man:$MANPATH; export MANPATH
      INFOPATH=/usr/local/texlive/2010/texmf/doc/info:$INFOPATH; export INFOPATH

      Here is a screenshot :

      Add the same lines in your .profile (/home/username/.profile)

    • Finally, if you use TeXWorks, open TeXworks, go in Edition, Settings, Typesetting :

      Then, add the path “/usr/local/texlive/2010/bin/i386-linux” :

      And everything will work well.

  4. For FreeBSD : the installation process is similar to the one for GNU/Linux I have described in the second part. But if you use the default shell, that is to say, csh, you will just have to change the PATH. It might be something like the following :

    setenv PATH /usr/local/texlive/2010/bin/i386-freebsd:$PATH
    setenv MANPATH /usr/local/texlive/2010/texmf/doc/man:$MANPATH
    setenv INFOPATH /usr/local/texlive/2010/texmf/doc/info:$INFOPATH

  5. For Mac OSX : MacTeX is the distibution Mac users should use. Download the zip file located here. Then, unzip it, click on the *.dmg file and install it. You will notice that you have TeXworks installed in your TeX folder located in your Applications folder. TeXworks is an easy to use and good TeX editor.

In all cases (Windows, GNU/Linux, FreeBSD, Mac OSX), if you are a beginner, then use TeXWorks. For GNU/Linux, Kile is also a good choice, but if you don’t plan to typeset mathematical symbols, TeXWorks may remain a better choice with useful options (such as commenting a block of text, very useful) which are not available in Kile. But of course, the choice of your TeX editor depends on several variables such as your skills, your habit. That’s why I would recommend to try both if you don’t know or simply hesitate.

If you are not a beginner, then use Emacs or Vim. I will write a post about these text editors soon.

Writing a cv with LaTeX

In the past I used classicthesis as a template to write my cv with LaTeX. If you want to get a template for this, I have uploaded one recently at github. Here is the link :
cv_classicthesis.tex at github

I compiled this template with pdflatex. Here is an example of output I get when I compiled this template from this file :

Also, notice that you can get a modified template (which I personally dislike) made by an italian. Here is the link at ctan :

Arsclassica at

If you use Ubuntu or any other Unix Operating system with Gnome, then type Alt+F2 and in the prompt enter texdoc arsclassica :

And here is the output you get when you compile the *.tex file :

But recently, I have stopped to use classicthesis as the template of my cv, and I have sticked to another one, really amazing, called moderncv.

I have put a copy of the template and my cv made with it at Github. For a complete documentation and examples, take a look at the directory where the documentation of your distribution is located. If you use Ubuntu with TeXlive 2009, you might find it at /usr/share/doc/texlive-latex-extra/moderncv. If you don’t find it, then take a look at here :

moderncv at

Here is an example of the output you will get when you will compile your cv with the casual version of moderncv :

Pretty great, huh ?

Also, when you will take a look at the template, you will notice there is a choice between 2 flavors, casual and classic. Here is a picture of a classic version (and its source file is here) :

If you have any problem, don’t hesitate to leave a comment.

The documentation with LaTeX

If you don’t know where is the documentation of a package included in your TeX distribution because, for example, you are not familiar with the Unix filesystem locations, then there is a simple way to get the pdf documentation related to any package.

When you get the name of a package, say for example classicthesis, then type Alt+F2 to get a prompt (it depends on your desktop environment, but if you use Gnome or KDE it will work, and if not, you can use gmrun). Then, enter “texdoc” followed by the name of the package. Here is a screenshot of what you get in Ubuntu after typing Alt+F2 :

After typing “texdoc” and the name of the package, you will get its related documentation in pdf format :

Here is a link toward a description of the texdoc command. Not really useful, just in case you want it.

If you don’t want to use texdoc, or just want to get the .tex format of the pdf documentation, then look at this directory if you have installed TeXLive in Ubuntu with the usual method :


If you use the default file manager of Ubuntu, type TeXLive, and you will have all the documentation about latex, xelatex, etc. If you use pdflatex to compile your files, then you might find all the doc you need in :


Finally, if you don’t have installed TeXLive with the usual method, but with the script install-tl of the TeX User Group, then look here :


By the way, if you are interested in the Unix filesystem hierarchy of GNU/Linux, then here is a link you might find interesting :

And here is for FreeBSD users :

%d bloggers like this: