Archive for September 26th, 2010

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 amazon.com
Or
The Elements of Typographic Style at wikipedia.org
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
\usepackage[frenchb
%arabic
%english
]{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 :
\newfontfamily\ja[Scale=0.8]{IPA明朝}

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}
\definecolor{spot}{rgb}{0.6,0,0}
\definecolor{boxframe}{rgb}{0.6,0,0}
\definecolor{boxfill}{rgb}{1,.95,.95}

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

\usepackage{hyperref}
\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,%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
pdfsubject={},%
pdfkeywords={},%
pdfcreator={XeLaTeX},%
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
\usepackage[nochapters]{classicthesis}
\usepackage[nochapters]{classicthesis-ldpkg}

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

\title{\rmfamily\normalfont\spacedallcaps{
The so-called Iran’s threat%The title of your article
}}
\subtitle{\rmfamily\normalfont\spacedallcaps{
Facts and analysis
}}
\author{\spacedlowsmallcaps{
Alexandre Krispin %author name and first name
}}

\begin{document}

\maketitle

%\begin{abstract}

%\noident
%********************************
%The abstract of your article
%*******************************

%\end{abstract}

\tableofcontents

%\section{}

%\subsection{}

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.

Advertisement
%d bloggers like this: