Apr 03 2008

Fonts in LaTeX

Published by Xavier under computer

For anyone using LaTeX, it is sometimes appreciable to be able to change the font. Thus, some packages will change everything for you, like palatino package. If you add \usepackage{palatino} in your header, then the font will be changed. But personally, I like the original sans-serif font , and I do not like seeing it replaced.

So let us have a look at the palatino.sty file.

\renewcommand{\rmdefault}{ppl}
\renewcommand{\sfdefault}{phv}
\renewcommand{\ttdefault}{pcr}

Actually, only the first line redefines the roman style to Palatino. Because of next lines, sans-serif style will be also changed to Helvetica, and typewriter style will be changed to Courrier.

Therefore, it is possible to redefine the font of any style, the default one being
{\rmdefault}{cmr}
{\ttdefault}{cmtt}
{\sfdefault}{cmss}
{\mddefault}{m}
{\bfdefault}{bx}
{\updefault}{n}
{\itdefault}{it}
{\scdefault}{sc}
{\sldefault}{sl}

if we refer to the list hereunder:

bch Charter
lmr Latin Modern Roman
lmss Latin Modern Sans Serif
lmssq Latin Modern Sans Serif extended
lmtt Latin Modern Typewriter
lmvtt Latin Modern Typewriter proportional
pag Avant Garde
pbk Bookman
pcr Courier
phv Helvetica
pnc New Century Schoolbook
ppl Palatino
ptm Times
put Utopia
pzc Zapf Chancery

I would keep a very simple header for my files:

\usepackage[T1]{fontenc} # for the font family, the accents
\usepackage[utf8]{inputenc} # for the utf8 encoding
\renewcommand{\rmdefault}{ppl} # for the Palatino font
\usepackage{mathpazo} # for the math fonts in Palatino

No responses yet

Nov 02 2007

macVim and skim

Published by Xavier under computer

macVim

If you read this page, it means that you are already fond of vim, this wonderful text editor, most popular on Unix systems. Now that you bought a Mac, if you miss the eye candy part, you should have a look at macVim.

The transition phase is quite smooth, since macVim will use your current .vimrc.

The software is still under development, but the current version is still very promising, and I can only recommend you to download a nightly build and start using it.

For information, some of the keyboard shortcuts were not available under my gVim version for Mac, since I use a different dvorak keyboard layout, but the problem is solved with macVim. :)

skim

skim is a pdf viewer for Mac OS, but it has a lot of extra functions, like

  • adding and editing notes
  • highlighting text
  • focus using a reading bar
  • support for Apple Remote Control
  • interaction with LaTeX and PDFSync

and many other specifications available on the website.

It is quite handy to use it with macVim, described here above! ;)

One response so far

Jul 02 2007

LaTeX en japonais

Published by Xavier under computer

C’est toujours un peu la lutte d’arriver à écrire des documents sous LaTeX en insérant des caractères japonais.

Le paquet platex permet bien de créer des documents exclusivement japonais, cependant, il ne permet pas de coupler ce document avec des spécificités d’une autre langue, je pense en particulier aux accents, cédilles et autres joyeusetés du français.

J’ai réussi à empaqueter une arborescence qui parvient à créer des documents japonais avec le minimum d’efforts. À un paramètre près, toute l’installation peut se faire en utilisateur.

Commencer d’abord par télécharger l’archive.

Sous Linux,

Décompresser l’archive dans le répertoire utilisateur ~, puis exécuter les commandes suivantes :
user$ texhash texmf
root$ cp texmf/fonts/map/cyberbit.map /usr/share/texmf/fonts/map/

Ensuite, rajouter la ligne suivante dans /var/lib/texmf/web2c/updmap.cfg :
Map cyberbit.map
Puis exécuter :
root$ updmap

Sous MacOS,

Décompresser l’archive dans ~/Library/ (à la ligne de commande pour qu’il s’insère correctement dans l’arborescence déjà présente), puis exécuter les commandes suivantes :
$ texhash
$ sudo cp texmf/fonts/map/cyberbit.map /sw/share/texmf-dist/fonts/map/

Ensuite, rajouter la ligne suivante dans /sw/share/texmf-dist/web2c/updmap.cfg :
Map cyberbit.map
Puis exécuter :
$ sudo updmap

Partie commune : test de l’installation

Créez un fichier encodé en unicode (utf8), avec les lignes suivantes en en-tête :
% Japanese input
\usepackage[utf8]{inputenc}
\usepackage{CJK}
\newcommand\japonais[1]{\begin{CJK*}{UTF8}{song}#1\end{CJK*}}

Ensuite dans le corps du document, tapez :
Ceci est un test avec des lettres accentuées. \japonais{これは日本語のテキストである。}

Compilez et vérifiez que les lettres latines, accentuées, kanji, hiragana et katakana s’affichent correctement.

Feedback

Si vous voyez un moyen d’améliorer, ou d’alléger la procédure, n’hésitez pas à laisser des commentaires ! Je ferais de mon mieux pour éditer ce billet et proposer quelque chose qui marche enfin.

De même, si vous avez des messages d’erreur, n’hésitez pas à les poster !

5 responses so far