## Ipuwer papyrus, ancient teaching

Velikovsky discussed about disorders related in the Bible, the Quran, etc. See here for a video :

His book about the analytic aspect of these disorders is called Worlds in collision. Download here in french :
http://ul.to/ix83lfll
And here in english :
http://ul.to/exl6jpok
The Ipuwer papyrus is one of the sources on which Velikovsky based his study. Very interesting. It can be downloaded here, translated into english :
http://ul.to/cl1e6m47

In time I will upload the book about the factual aspect of the analysis of Velikovsky

## [Update] A script to automate the installation of TeXLive 2011 on Ubuntu

### About the installation of TeXlive 2011 (general matters)

The previous script to install TeXLive 2010 worked fine to install TeXLive 2011 on Ubuntu The previous script to install TeXLive 2010 worked quite fine to install TeXLive 2011, I just had to modify a few things to get settings working correctly. Since I have Kubuntu Natty (11.04), I had to install zenity, but it is just a minor issue. Maybe one day I will write a program more sophisticated with Python, but nothing sure by now.

If you are interested, you are welcome to download this script by clicking here.

For further informations, I encourage you to refer to the previous post :
A script to automate the installation of TeXLive 2010 on Ubuntu

Though the script contain other instructions to install TeXlive on Archlinux, I have not tested it on this platform, only on Kubuntu 11.04.

### More updates for LuaLaTeX users

Finally, if you use LuaLaTeX to compile your documents, you might be interested in further updates from TLContrib. In particular, at the time I am writing this blog post, a newer version of the microtype package is available.

To install packages from TLContrib you can refer to the official site or to my previous blog post.

Basically you have to call tmlgr by the following command (depending on your computer’s architecture, mine is 64bit)
sudo /usr/local/texlive/2011/bin/x86_64-linux/tlmgr --gui
And then, you have to write the repository of TLContrib by loading an other repository (in the menu : tlmgr –> Load other repository, and then push the button “Update all installed”)

## Writing with Emacs and AucTeX part 2

Here I will describe some tips that I have learned during the period I have been trying Emacs. But again, I recommend Vim if you want to be efficient, although the choice of your text editor might depend on your habits, your relationships or people who influence you. I won’t repeat some features already pointed earlier in the first part of my post, so if you want to get information about snippets, abbrev mode and completion-ui, look at the first part.

For the following basic tips I assume that you use the configuration I have set and briefly described previously. If you don’t want to use my configuration and are a beginner, then use easymacs. To use it, look here.

C-_ : undo
C-x C-_ : redo

Notice that C-* means to press the control key and the * key. Also for example if you want to redo something, you will have to press the control key and “x” in the same time, and then control key again with the _ key in the same time.

C-h m : list of command you can use in your buffer.
C-h k : to get help for a shortcut
C-h f : help to describe a function
C-space or C-@ : sets a mark to mark a block of text

Notice that if you use ibus to write in japanese, chinese, arabic or any other language, you will have to use C-@, since C-space is a shortcut calling ibus.

Ctrl-v : page forward
Esc v : page back
Esc q : fill (reformat) paragraph
ESC x : allows you to enter a command by spelling it out (typing a space will complete a non-ambigous partial command)
C-c C-c : compile
C-c C-v : viewer
Time-stamp: : writing it at the beginning of a file allow you to get the last time when saved your file

Notice 2 things. The first is that C-c C-c will compile your files with xelatex since it is the way I compile all my files. Secondly, writing Time-stamp: is useful if you want to know easily the date when you last modified a file. And if you want to use it, you should write a snippet to write it automatically with a template or a simple command.

C-w : cut
ESC w : copy
C-y : paste
M-^ : merge two lines (or in other words delete indentation)
alt+shift+\% : replace
alt+shift+\%, replace, then if ! is pressed, all strings are replaced
C-i or C-q C-i : indent
C-z : minimize the window

Notice that I have used C-z with Gnome (Ubuntu 10.04), and I don’t know the effect in other operating systems like Microsoft Windows.

C-c C-c : compile
C-c C-v : view with evince the pdf produced after you compiled the file
C-x C-c : quit emacs
C-x C-s : save your file
C-x C-f : open a new file
M-x dired : open the file browser in emacs

Notice that these commands are the basics, and if you don’t know the basics you should look at the following websites :
An Emacs introduction course
A quick guide
Emacs basics
The Emacs wiki
A really good tutorial
A reference card
For french users look here and also here
A page from the FreeBSD developer’s handbook
Finally, if you are interested in ESS, look here.

The following is a brief description of what you can do with my configuration (since I don’t use anymore Emacs, I may have forgotten some things I have done) :

• Compiling with Emacs will be done automatically with XeLaTeX (the default compiler)
• ispell is configured for english and french
• you can configure your own pdf viewer, but default is evince
• there is a template system, with yasnipets.
• you can use gnuplot in emacs (see the first part of this post for more details)
• there is a tabbar to easily switch from a buffer to another one and see them
• you can see all recently opened files in the menu
• you can get fullscreen
• you can get abbreviation working with Emacs, and auto-completion
• there is a time stamp system to insert time at the beginning of the files
• and maybe some others things that I don’t remember

In any case, I prefer Vim, and I think that auto-completion with Vim is better, and abbreviations easier to configure.

## Writing with Emacs and AucTeX part 1

The purpose of this post is to explain my setup for GNU/Emacs I made during the period I got a try to it to write files compiled with XeLaTeX. First, here is not a place where I want to restart the childish “war editor”. Like the “FreeBSD vs Linux”, it would make no sense. Be sure that if you find a post about Emacs criticizing Vim, even if they are hosted by websites which seems serious, you should not pay attention to them. Of course, in these posts like, say, “Emacs: an advertisement” at charlietanksley.net, some criticize the “unin­tu­itive way that Vim forces you to move around”. The only advice someone should tell is : make your own choice after trying both text editors. Also, I personally recommend Vim.

1. If you plan to use Emacs, since I had problem with Ubuntu 10.04, I recommend not to install it from you package manager, but from the official website. The download link is the following :

choose emacs-23.2.tar.bz2

f you are not familiar with Unix command, then save your emacs version in you home (/home/username, where username is the name of your computer). To install it, you will have to use the terminal (press alt+F2 and enter gnome-terminal in the prompt). Then, enter the following commands :

cd ~ tar xjvf emacs-23.2.tar.bz2 cd emacs-23.2 ./configure make sudo make install

The installation will take some time to process.

2. After the installation has completed, you will have to download all the files I have put at Github. To do so, you will have to use the terminal (with Ubuntu, press ctrl+t and gnome-terminal will appear), to install git if you don’t have it yet, and to download all the files at github. To do so, copy-paste the following, and type enter after all new lines :
cd ~ sudo apt-get instal git git 

Notice that my .emacs.d contains several plugins, such as yasnippet, completion-ui, autopairs, etc.

Finally, I will make a short description of my file init.el, important to be aware of all configurations I have made to make emacs work like I wanted :

;;##################################################################################################
;;##################################################################################################

; LaTeX

;;##################################################################################################

; ——————————————————————————————————————
; ——————————————————————————————————————
(require ‘tex-site)
(require ‘tex-style)
; ——————————————————————————————————————
; To turn on RefTeX Minor Mode for all LaTeX files, and other
; ——————————————————————————————————————
(add-hook ‘LaTeX-mode-hook ‘turn-on-reftex) ; with AUCTeX LaTeX mode

‘(lambda ()
(setq TeX-open-quote “«~”)
(setq TeX-close-quote “~»”)
(auto-fill-mode t)
))

; ——————————————————————————————————————
; Smart quotes
; ——————————————————————————————————————
(setq TeX-open-quote “<<“) (setq TeX-close-quote “>>”)

; ——————————————————————————————————————
;LaTeX-math and other usefull stuff
; see http://www.emacswiki.org/emacs/AUCTeX
; ——————————————————————————————————————

;;; ———————— dictionnaire – correction orthographique ———–
;(setq-default ispell-program-name “hunspell”)

; (lambda ()
; (flyspell-mode 1)
; (ispell-change-dictionary “francais”)
; (turn-on-auto-fill)
;))
;————————————————————————————————–
; completion, style file, or multi-file stuff work
;————————————————————————————————–
(setq TeX-auto-save t)
(setq TeX-parse-self t)
;————————————————————————————————–
;;Mode PDFLatex par défaut ou non
;————————————————————————————————–
(setq TeX-PDF-mode t); pour mettre par défaut décommenter cette ligne et commenter celle du dessous

;————————————————————————————————–
;;Visualiseurs
;————————————————————————————————–
(setq TeX-output-view-style (quote (
(“^pdf$” “.” “evince %o”) (“^ps$” “.” “gv %o”)
(“^dvi$” “.” “xdvi %o”) ))) (setq tex-dvi-view-command “xdvi”) (setq tex-dvi-print-command “dvips”) (setq tex-alt-dvi-print-command “dvips”) ;————————————————————————————————– ;; Pour aller a la ligne automatiquement ;————————————————————————————————– (turn-on-auto-fill) ; —————————————————————————————————————— ; Autopairs ;see http://autopair.googlecode.com/svn/trunk/autopair.el ; —————————————————————————————————————— (add-to-list ‘load-path “~/.emacs.d/lisp”) (require ‘autopair) (autopair-global-mode) ;; to enable in all buffers ;see http://www.emacswiki.org/emacs/AutoPairs#Discussion ; ————————————————- (setq skeleton-pair t) ; enable pairing ; —————————————————————————————————————— ; master file ; —————————————————————————————————————— (setq-default TeX-master nil) TeX-master nil ;; ;;; ———————— Template ——————————- ;; (setq load-path (cons (expand-file-name “~/.emacs.d/lisp”) ;; load-path)) ;; (require ‘template) ;; (template-initialize) ;; ;;;; If you don’t want to use yasnippet, look download the tarball here : ;; ;;;; voir http://emacs-template.sourceforge.net/ ; —————————————————————————————————————— ; Wrapping the region in double quotes ; —————————————————————————————————————— (defadvice TeX-insert-quote (around wrap-region activate) (cond (mark-active (let ((skeleton-end-newline nil)) (skeleton-insert (nil ,TeX-open-quote _ ,TeX-close-quote) -1))) ((looking-at (regexp-opt (list TeX-open-quote TeX-close-quote))) (forward-char (length TeX-open-quote))) (t ad-do-it))) (put ‘TeX-insert-quote ‘delete-selection nil) ; —————————————————————————————————————— ; Inserting and wrapping single quotes ; —————————————————————————————————————— (defun TeX-insert-single-quote (arg) (interactive “p”) (cond (mark-active (let ((skeleton-end-newline nil)) (skeleton-insert (nil ? _ ?’) -1))) ((or (looking-at “\\<“) (looking-back “^\\|\\s-\\|”)) (insert “”)) (t (self-insert-command arg)))) (add-hook ‘LaTeX-mode-hook ‘(lambda () (local-set-key “‘” ‘TeX-insert-single-quote))) ; —————————————————————————————————————— ;;set xetex mode in tex/latex ; —————————————————————————————————————— (add-hook ‘LaTeX-mode-hook (lambda() (add-to-list ‘TeX-command-list ‘(“XeLaTeX” “%xelatex%(mode)%’ %t” TeX-run-TeX nil t)) (setq TeX-command-default “XeLaTeX”) (setq TeX-save-query nil) (setq TeX-show-compilation t) )) ;———————————————————————————————— ;Whizzy TeX ;———————————————————————————————— ;; (setq my-toggle-whizzy-count 0) ;; (defun my-toggle-whizzy-mode () ;; (interactive) ;; (if (= (mod my-toggle-whizzy-count 2) 0) ;; (progn ;; (whizzytex-mode) ;; (message “WhizzyTeX on”)) ;; (progn ;; (whizzy-mode-off) ;; (kill-buffer (concat “*” (buffer-name) “*”)) ;; (message “WhizzyTeX off”))) ;; (setq my-toggle-whizzy-count (+ my-toggle-whizzy-count 1))) ;; (add-hook ‘LaTeX-mode-hook ;; (lambda () ;; (define-key LaTeX-mode-map (kbd “”) ‘my-toggle-whizzy-mode))) This first part load AucTeX when a .tex file is opened, turn on reftex, enable hook for math, turn on pdf by default instead of dvi, command AucTeX to use evince as pdf viewer, gv for postscript and xdvi for dvi, automatically close bracket or complete the other bracket once you have opened one, etc. Notice that some things which you might think useful are commented, such as whizzy tex and flyspell. Therefore you will have to uncomment it if you want to use it. One other important thing for me is to unable compilation for XeLaTeX. For this reason, XeLaTeX is the default setting. ;——————————————————————————— ;Yasnippet ;; Auto completion / snippets (add-to-list ‘load-path “~/.emacs.d/lisp/yasnippet.el”) (require ‘yasnippet) (setq yas/root-directory “~/.emacs.d/snippets”) (yas/load-directory yas/root-directory) (yas/global-mode) (define-key global-map [f6] ‘yas/expand) (require ‘dropdown-list) ;; (setq yas/prompt-functions ‘(yas/dropdown-prompt ;; yas/ido-prompt ;; yas/completing-prompt)) Yasnippet is used by default. For this reason, if you want to use it and want to know what are the files available, just look at the menu : ;;################################################################################################## ;; ;; GNUPlot ;;################################################################################################## (add-to-list ‘load-path “~/emacs.d/lisp/”) (autoload ‘gnuplot-mode “gnuplot” “gnuplot major mode” t) (autoload ‘gnuplot-make-buffer “gnuplot” “open a buffer in gnuplot mode” t) ;; this line automatically causes all files with the .gp extension to ;; be loaded into gnuplot mode (setq auto-mode-alist (append ‘((“\\.gp$” . gnuplot-mode)) auto-mode-alist))

;; This line binds the function-9 key so that it opens a buffer into
;; gnuplot mode
(global-set-key [(f9)] ‘gnuplot-make-buffer)

;;##################################################################################################
;; key board / input method settings
;;##################################################################################################

;————————————————————————————————–
;; key board / input method settings
(setq locale-coding-system ‘utf-8)
(set-terminal-coding-system ‘utf-8)
(set-keyboard-coding-system ‘utf-8)
(set-language-environment ‘UTF-8) ; prefer utf-8 for language settings
(load-library “iso-transl”) ; for accent ^
;see http://tldp.org/HOWTO/Keyboard-and-Console-HOWTO-12.html
;http://www.docmirror.net/fr/linux/howto/hardware/Keyboard-and-Console-HOWTO/Keyboard-and-Console-HOWTO-8.html
;http://www.faqs.org/docs/Linux-HOWTO/Keyboard-and-Console-HOWTO.html
;(iso-accents-customize french)
;;; Pour le clavier
;(iso-accents-mode)

;————————————————————————————————–
;Keyboard shortcuts
;————————————————————————————————–
(require ‘redo)
(define-key global-map (kbd “C-_”) ‘undo)
(define-key global-map (kbd “C-x C-_”) ‘redo)
;if you want to keep the C-w, M-w, and C-y original settings, there is a way is to bind cut,
;copy and past keys by using the default X11 :
;http://www.emacswiki.org/emacs/CopyAndPaste
;; (global-set-key [(shift delete)] ‘clipboard-kill-region)
;; (global-set-key [(control insert)] ‘clipboard-kill-ring-save)
;; (global-set-key [(shift insert)] ‘clipboard-yank)

;;######################################################################################################
;;######################################################################################################
;————————————————————————————————–
;————————————————————————————————–
(tool-bar-mode -1)
(toggle-scroll-bar -1)
;(set-scroll-bar-mode ‘right) ;;スクロールバーを右に表示
;————————————————————————————————–
;menu avec les buffer dans une tabbar
; thanks to http://www.emacswiki.org/emacs/TabBarMode
;————————————————————————————————–
(require ‘tabbar)
(tabbar-mode 1)

;; the following is taken from http://d.hatena.ne.jp/alfad/20100425/1272208744
;; 左に表示されるボタンを無効化
;———————————–
;(setq tabbar-home-button-enabled “”)
;(setq tabbar-scroll-left-button-enabled “”)
;(setq tabbar-scroll-right-button-enabled “”)
(setq tabbar-scroll-left-button-disabled “”)
(setq tabbar-scroll-right-button-disabled “”)

;; Firefoxライクなキーバインドに
;———————————–
(global-set-key [(f8)] ‘tabbar-forward)
(global-set-key [(f7)] ‘tabbar-backward)

;all tabs is just one group
;———————————–
(setq tabbar-buffer-groups-function
(lambda ()
(list “All”))) ;; code by Peter Barabas

;————————————————————————————————–
; one more item n the menu for new files
;————————————————————————————————–

:help “Specify a new file’s name, to edit the file”))

;————————————————————————————————–
;; A list of recent files
;————————————————————————————————–

(require ‘recentf)
(setq recentf-exclude ‘(“^/ftp.*” “^/ssh.*” “^/private.*” ))
(setq recentf-save-file “~/.emacs.d/recentf”)
(recentf-mode 1)

;; GS-05/07/2006-12:15
;; http://www.emacswiki.org/cgi-bin/wiki/RecentFiles#toc6
(defun recentf-interactive-complete ()
“find a file in the recently open file using iswitchb for completion”
(interactive)
(let* ((all-files recentf-list)
(file-assoc-list (mapcar (lambda (x) (cons (file-name-nondirectory x) x)) all-files))
(filename-list (remove-duplicates (mapcar ‘car file-assoc-list) :test ‘string=))
(iswitchb-make-buflist-hook
(lambda ()
(setq iswitchb-temp-buflist filename-list)))
(filename (iswitchb-read-buffer “Find Recent File: “))
(result-list (delq nil (mapcar (lambda (x) (if (string= (car x) filename) (cdr x))) file-assoc-list)))
(result-length (length result-list)))
(find-file
(cond
((= result-length 0) filename)
((= result-length 1) (car result-list))
( t
(let ( (ido-make-buffer-list-hook
(lambda ()
(setq iswitchb-temp-buflist result-list))))
))))

;; to open recent files with keyboard
;;(global-set-key “\C-x\C-r” ‘recentf-open-files-compl)
(global-set-key “\C-x\C-r” ‘recentf-interactive-complete)

;————————————————————————————————–
;; the minibuffer
;————————————————————————————————–
(setq
enable-recursive-minibuffers nil ;; allow mb cmds in the mb
max-mini-window-height .25 ;; max 2 lines
minibuffer-scroll-window nil
resize-mini-windows nil)

;(icomplete-mode t) ;; completion in minibuffer
;; (setq
;; icomplete-prospects-height 1 ;; don’t spam my minibuffer
;; icomplete-compute-delay 0) ;; don’t wait
;; (require ‘icomplete+ nil ‘noerror) ;; drew adams’ extras

The first part is for Gnuplot, then for the encoding (utf-8). Notice that at the line 211, I load something to get the dead key working for accent circumflex with an azerty keyboard. Also, I have a shortcut to undo and redo an action, a setup for the menu, the toolbar and the scrollbar, a setup for the tabbar, etc.

;;################################################################################################
;; FULLSCREEN : appuyer sur F11
;;thanks to http://www.emacswiki.org/emacs/FullScreen
;;################################################################################################

; ———————————————————————————–
;F11 is for fullscreen
; ———————————————————————————–
(defun fullscreen (&optional f)
(interactive)
(set-frame-parameter f ‘fullscreen
(if (frame-parameter f ‘fullscreen) nil ‘fullboth)))

(global-set-key [f11] ‘fullscreen)

; ———————————————————————————–
;Send X Messages to the Window Manager
; ———————————————————————————–
(defun fullscreen ()
(interactive)
(x-send-client-message nil 0 nil “_NET_WM_STATE” 32
‘(2 “_NET_WM_STATE_FULLSCREEN” 0)))

; ———————————————————————————–
; fullscreen mode
; ————————————————————————————–
(run-with-idle-timer 0.1 nil ‘fullscreen)

; —————————————————————————————–
;To maximize the window only, uncomment
; —————————————————————————————–
(defun fullscreen (&optional f)
(interactive)
(x-send-client-message nil 0 nil “_NET_WM_STATE” 32
‘(2 “_NET_WM_STATE_MAXIMIZED_VERT” 0))
(x-send-client-message nil 0 nil “_NET_WM_STATE” 32
‘(2 “_NET_WM_STATE_MAXIMIZED_HORZ” 0)))

;;#################################################################################################
;; MOUSE, CURSOR
;;#################################################################################################

(mouse-wheel-mode t)
(setq scroll-conservatively 10000)

;————————————————————————————————–
;; If you like to get a scroll one line at a time (less “jumpy” than defaults), uncomment
;;thanks to http://www.emacswiki.org/emacs/SmoothScrolling
;————————————————————————————————–
; (setq mouse-wheel-scroll-amount ‘(1 ((shift) . 1))) ;; one line at a time

(setq mouse-wheel-progressive-speed nil) ;; don’t accelerate scrolling
; (setq mouse-wheel-progressive-speed true) ;;accelerate scrolling

;(setq mouse-wheel-follow-mouse ‘t) ;; scroll window under mouse

;(setq scroll-step 1) ;; keyboard scroll one line at a time
;(setq scroll-step 0) ;; keyboard don’t scroll one line at a time

;————————————————————————————————–
; Molette de la souris
;————————————————————————————————–
(defun up-slightly () (interactive) (scroll-up 5))
(defun down-slightly () (interactive) (scroll-down 5))
(global-set-key [mouse-4] ‘down-slightly)
(global-set-key [mouse-5] ‘up-slightly)
(defun up-one () (interactive) (scroll-up 1))
(defun down-one () (interactive) (scroll-down 1))
(global-set-key [S-mouse-4] ‘down-one)
(global-set-key [S-mouse-5] ‘up-one)
(defun up-a-lot () (interactive) (scroll-up))
(defun down-a-lot () (interactive) (scroll-down))
(global-set-key [C-mouse-4] ‘down-a-lot)
(global-set-key [C-mouse-5] ‘up-a-lot)

;————————————————————————————————–
;; curseur en barre et non clignotant
;————————————————————————————————–
;;(setq cursor-type ‘bar) -> default-frame-alist
;;(set-cursor-color “black”)

;————————————————————————————————–
; Laisser le curseur en place lors d’un défilement par pages.
; Par défaut, Emacs place le curseur en début ou fin d’écran
; selon le sens du défilement.
;————————————————————————————————–

;(setq scroll-preserve-screen-position t)

;————————————————————————————————–
;; Use box cursor for overwrite-mode, and red cursor for quail active input.
;;thanks to http://www.jurta.org/en/emacs/dotemacs
;————————————————————————————————–
(defun my-change-cursor ()
“Change cursor color and type depending on insertion mode and input method.”
(set-cursor-color
(cond (current-input-method “red3”) ; “AntiqueWhite4”
((eq (frame-parameter (selected-frame) ‘background-mode) ‘dark)
“DarkGrey”)
(t “black”)))
(setq default-cursor-type ;; set-cursor-type
(cond (overwrite-mode ‘box)
(t ‘bar))))

;;###########################################################################################################
;; Title bar
;;###########################################################################################################

(setq frame-title-format ‘(buffer-file-name “Emacs: %b (%f)” “Emacs: %b”)) ;CHEMIN COMPLET DANS LA BARRE DE TITRE

;————————————————————————————————–
;; de jolis noms pour les buffers sur un meme *nom* de fichier
;————————————————————————————————–
(require ‘uniquify)
(setq uniquify-buffer-name-style ‘post-forward-angle-brackets)

Here is the setup for fullscreen mode, the mouse, the cursor, the title.

;;##################################################################################################
;;Writing
;;##################################################################################################

;——————————————————————————-
;; Complétion automatique
;;Work in progress
;;see http://www.dr-qubit.org/emacs.php
;——————————————————————————-
;—————————————————————–
(abbrev-mode t) ; completion automatique
(global-set-key (quote [tab]) (quote dabbrev-expand))

(setq default-abbrev-mode t)
(define-abbrev-table ‘global-abbrev-table ‘(
(“\.\.\.” “\ldots” nil)
(“letat” “l’État” nil)
(“comeur” “Commission Européenne” t 4)
(“coneur””Conseil Européen” nil)
))

;; ;——————————————————————
;; ;to enable or disable completion-ui, comment or uncomment the following lines
(require ‘completion-ui)
(auto-completion-mode)
;(global-set-key [?\M-/] ‘complete-dabbrev)

;; ;——————————————————————-
;; ;auto-complete-mode

;; (setq dabbrev-case-replace nil)
;; (require ‘auto-complete-config)
;; (auto-complete-mode)
;; (ac-config-default)

;; ;(require ‘auto-complete)
;; ;(setq ac-auto-start 1)
;; ;(require ‘auto-complete-config)
;; (require ‘popup)
;; ;(require ‘fuzzy)
;; (global-auto-complete-mode t)
;; (setq ac-auto-start t)

;; ;————————————————————————
;predictive
;; predictive install location
;; ;; dictionary locations
;; (require ‘predictive)
;; “Turn on Predictive Completion Mode.” t)

Here is the setup for autocompletion. You will notice that there are several ways to get autocompletion with Emacs. The first, really great (though all features that I discussed here might be great), is the abbrev mode. So if you often type a word, define an abbreviation. Say, a french word, “l’État”. Writing l’État is painful with an azerty keyboard : you have to press l”‘”, then the caps lock key, then press “é”, then again caps lock key, and then “tat”. Defining letat allow you to get l’État when typing space after to have writen letat. Really great.

Completion-ui is another really great completion utility for emacs. For more details, look at the Emacs wiki. The other ways of completion, such as “predictive mode”, are also well explained in the Emacs wiki, therefore I won’t describe them.

;——————————————————————————-
;; SUPPRIME TOUS LES ESPACES EN FIN DE LIGNE
;——————————————————————————-

;——————————————————————————-
;Wrap Long Lines By Word Boundary
;——————————————————————————-
(global-visual-line-mode 1) ; 1 for on, 0 for off.

;——————————————————————————-
; TEXT AND AUTO FILL MODE
;——————————————————————————-

(setq default-major-mode ‘text-mode)

;——————————————————————————-
;; PARENTHESE MATCHING, PERMET DE VERIFIER AU FUR ET À MESURE DE LA FRAPPE QUE
;; L’ON FERME BIEN CE QUE L’ON OUVRE, AUSSI BIEN POUR LES PARENTHÈSES QUE LES
;——————————————————————————-

(require ‘paren)
(show-paren-mode 1)
(setq-default hilight-paren-expression t)

Here are some useful settings for editing, like the feature to automatically format your text, insert the closing parenthesis when you have inserted the opening one, etc.

;——————————————————————————-
;;TIME STAMPS
;;thanks to http://www.djcbsoftware.nl/dot-emacs.html
;——————————————————————————-
;;Emacs permet d’insérer automatiquement des time stamps, typiquement
;;pour indiquer la date de dernière modification d’un fichier.
;;Pour utiliser les time stamps, indiquer dans les 8 premières lignes d’un fichier ceci :
;;Time-stamp:
(setq ;; when there’s “Time-stamp: ” in the first 10 lines of the file
time-stamp-active t ; do enable time-stamps
time-stamp-line-limit 10 ; check first 10 buffer lines for Time-stamp:
time-stamp-format “%04y-%02m-%02d %02H:%02M:%02S (%u)”) ; date format
(add-hook ‘write-file-hooks ‘time-stamp) ; update when saving

If you want to have the time displayed at the beginning of your file, insert “Time-stamp: “, and save your file. It will add automatically the date.

;;################################################################################
;; File browser
;;################################################################################

(defun my-dired-mode-init ()
(hl-line-mode 1)
(setq truncate-lines t))
;; Image viewer.
(when (require ‘image-mode nil)
(defun my-image-next-by-number ()
(interactive)
(let ((file-name (buffer-file-name))
base num suffix
num-width fmt)
(unless (string-match
“^\$$.*[^0-9-]\$$?\$$?:[0-9]+-\$$?\$$[0-9]+\$$\$$\\.[^.]+\$$?$” file-name) (error “Improper file name”)) (setq base (match-string 1 file-name)) (setq num (match-string 2 file-name)) (setq suffix (match-string 3 file-name)) (setq num-width (length num)) (setq fmt (format “%%s%%0%dd%%s” num-width)) (setq num (1+ (string-to-number num))) (setq file-name (format fmt base num suffix)) (unless (file-exists-p file-name) (setq fmt (format “%%s%%0%dd-*%%s” num-width)) (setq file-name (format fmt base num suffix)) (setq file-name (file-expand-wildcards file-name)) (if file-name (setq file-name (car file-name)) (error “No more files”))) (find-alternate-file file-name))) (defun my-image-scroll-up-or-next-by-number () (interactive) (let* ((image (image-get-display-property)) (edges (window-inside-edges)) (win-height (- (nth 3 edges) (nth 1 edges))) (img-height (ceiling (cdr (image-size image))))) (if (= (window-end) (point-max)) (goto-char (point-max)) (View-scroll-page-forward-set-page-size)))) (define-key view-mode-map [(meta up)] (lambda () (interactive) (if (<= (window-start) (point-min)) (goto-char (point-min)) (View-scroll-page-backward-set-page-size)))) ;; qv http://thread.gmane.org/gmane.emacs.devel/111117/focus=112357 (defadvice View-scroll-line-forward (after my-View-scroll-line-forward activate) "Fix point position to be at the bottom line." (move-to-window-line -1) (beginning-of-line)) )) ;;; doc-view ;——————————————————————————- (eval-after-load "doc-view" '(progn ;; Shift-Space to scroll back. (define-key doc-view-mode-map [?\S- ] 'doc-view-scroll-down-or-previous-page) )) ;;; image ;——————————————————————————- ;; This is now in image-dired-cmd-create-standard-thumbnail-command' ;; (used by C-t C-t' in Dired). (defun my-make-thumbnail (file) (let* ((image-file (concat "file://" (expand-file-name file))) (thumb-file (expand-file-name (concat "~/.thumbnails/normal/" (md5 image-file) ".png"))) (file-attrs (file-attributes file)) (modif-time (float-time (nth 5 file-attrs)))) (unless (file-exists-p thumb-file) (shell-command (mapconcat 'identity (list "convert" (format "\"%s\"" file) ;; "-size 128×128" (format "-set \"Description\" \"Thumbnail of %s\"" image-file) (format "-set \"Software\" \"ImageMagick, GNU Emacs %s\"" emacs-version) (format "-set \"Thumb::URI\" \"%s\"" image-file) (format "-set \"Thumb::MTime\" \"%.0f\"" modif-time) "-set \"Thumb::Size\" \"%b\"" "-set \"Thumb::Image::Width\" \"%w\"" "-set \"Thumb::Image::Height\" \"%h\"" "-set \"Thumb::Image::Mimetype\" \"image/jpeg\"" "-resize 128×128" ;; "-resize 64×64" "+profile \"*\"" "-type TrueColorMatte" ;; "-sharpen 11" ; TRY THIS (format "png:\"%s\"" thumb-file)) " "))) thumb-file)) ;;; thumbs ;——————————————————————————- (defadvice thumbs-mode (after my-thumbs-mode activate) (toggle-truncate-lines -1)) ;;; dired ;——————————————————————————- (require 'dired-x) ;; HINT: the following expression is useful for M-(' dired-mark-sexp' ;; to mark files by their type: ;; (string-match "perl" (shell-command-to-string (concat "file " name))) ;; Uses editor/viewer info from /usr/bin/run-mailcap (defun my-dired-run-find-file () "My view file for dired." (interactive) (let* ((file (dired-get-filename))) (cond ((let* ((command (and (functionp 'mm-mime-info) (mm-mime-info (mm-extension-to-mime (file-name-extension file)))))) (if (and command (stringp command)) ;; always return t' for cond' (or (ignore (shell-command (concat (format command file) "&"))) t)))) ;; ((string-match "\\.html?$" file) (w3-open-local file))
((string-match "\\.html?$" file) (cond ((fboundp 'w3m-goto-url-new-session) (w3m-find-file-new-session file)) ((fboundp 'browse-url) (browse-url file)))) ((string-match "\\.elc?$" file)
((string-match "\\.info?$" file) (info file)) (;; (or (string-match "\\.jpe?g$" file)
;; (string-match "\\.gif$" file) ;; (string-match "\\.pdf$" file))
(let* ((file-list (list (dired-get-filename)))
(command (dired-guess-default file-list)))
(if (listp command)
(setq command (car command)))
(if command
(shell-command
(dired-shell-stuff-it command file-list nil 0)))))
(t
(message file)))))

(define-key dired-mode-map [(control return)] 'my-dired-run-find-file)

;; Add different directory sorting keys
;——————————————————————————-
(mapc (lambda (elt)
(define-key dired-mode-map (car elt)
(lambda ()
(interactive)
'(([(control f3)] "" "by name")
([(control f4)] " -X" "by extension")
([(control f5)] " -t" "by date")
([(control f6)] " -S" "by size")
([(control shift f3)] " -r" "by reverse name")
([(control shift f4)] " -rX" "by reverse extension")
([(control shift f5)] " -rt" "by reverse date")
([(control shift f6)] " -rS" "by reverse size")))

;; The following two bindings allow to open file for editing by [f4],
;; and return back to dired without killing the buffer.
;;——————————————————————————–
(define-key dired-mode-map [f3] 'dired-find-file) ;; 'dired-view-file
(define-key global-map [f3] 'dired-jump)

(define-key dired-mode-map [(shift f4)] 'dired-count-sizes)

Some settings for the dired mode (to display the mode, press alt+x in emacs and write dired in the bottom).

;;##################################################################################################
;highlighting
;;##################################################################################################
;;——————————————————————————–
;; Syntaxe highlighting pour tout
;;——————————————————————————–

(require ‘font-lock)
(setq initial-major-mode
(lambda ()
(text-mode)
(font-lock-mode)))
(setq font-lock-mode-maximum-decoration t
font-lock-use-default-fonts t
font-lock-use-default-colors t)

;;——————————————————————————–
;; hl-line: highlight the current line
;;(thanks to http://www.djcbsoftware.nl/dot-emacs.html)
;;——————————————————————————–
(when (fboundp ‘global-hl-line-mode)
(global-hl-line-mode t)) ;; turn it on for all modes by default

;;——————————————————————————–
;; ACTIVER LA COLORATION SYNTAXIQUE
;;——————————————————————————–
(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)
(setq font-lock-maximum-size nil)
;;——————————————————————————–
;; SURLIGNAGE D’UNE RÉGION SÉLECTIONNÉE ET EFFACER
;;——————————————————————————–

(transient-mark-mode 1) ; highlight text selection
(delete-selection-mode 1) ; delete seleted text when typing

Here are settings for highlighting. You will notice that the line where your cursor is is highlighted. I prefer to highlight a line than to get an annoying blincking cursor.

;;##################################################################################################
;;Sauvegardes, bookmarks, etc
;;##################################################################################################
;;——————————————————————————–
;; bookmarks
;;——————————————————————————–
(setq bookmark-default-file “~/.emacs.d/data/bookmarks” ;; bookmarks
bookmark-save-flag 1) ;; autosave each change

;;——————————————————————————–
;; saveplace: save location in file when saving files
;;——————————————————————————–
(setq save-place-file “~/.emacs.d/cache/saveplace”)
(setq-default save-place t) ;; activate it for all buffers
(require ‘saveplace) ;; get the package

;;——————————————————————————–
;; savehist: save some history
;;——————————————————————————–
‘(search ring regexp-search-ring) ;; … my search entries
savehist-autosave-interval 60 ;; save every minute (default: 5 min)
savehist-file “~/.emacs.d/cache/savehist”) ;; keep my home clean
(savehist-mode t) ;; do customization before activation

;;——————————————————————————–
;; Save/restore sessions on exit/startup.
;;——————————————————————————–

; (desktop-save-mode 1)

;;——————————————————————————–
;; POUR ENREGISTRER AUTOMATIQUEMENT LA POSITION DU CURSEUR QUAND ON QUITTE UN
;; FICHIER, ET Y RETOURNER AUTOMATIQUEMENT À LA RÉOUVERTURE
;;——————————————————————————–

(require ‘saveplace)
(setq-default save-place t)

;;——————————————————————————–
;; backups
;;——————————————————————————–
(setq make-backup-files t ;; do make backups
backup-by-copying t ;; and copy them here
backup-directory-alist ‘((“.” . “~/.emacs.d/backups”))
version-control t
kept-new-versions 2
kept-old-versions 5
delete-old-versions t)

Settings for backups. Nothing special.

;;##################################################################################################
;;APPEARENCE, etc
;;##################################################################################################
;————————————————————————————————–
;; Status bar
;————————————————————————————————–

(column-number-mode t) ;Affiche le numéro de ligne, de colonne
(line-number-mode t) ;Affiche le numéro de colonne

(size-indication-mode t) ;; show file size (emacs 22+)

(display-time) ;POUR AVOIR L’HEURE DANS LA BARRE D’ETAT
(setq display-time-24hr-format t) ;; Format 24 heures

Some settings to get the line and column number, the time, the size of your file in the status bar. Useful.

;————————————————————————————————–
; folding mode
;work in progress \o/
;————————————————————————————————–

;————————————————————————————————–
; show hide
;————————————————————————————————–

(defun toggle-selective-display (column)
(interactive “P”)
(set-selective-display
(or column
(unless selective-display
(1+ (current-column))))))

(defun toggle-hiding (column)
(interactive “P”)
(if hs-minor-mode
(if (condition-case nil
(hs-toggle-hiding)
(error t))
(hs-show-all))
(toggle-selective-display column)))

(global-set-key (kbd “C-+”) ‘toggle-hiding)
(global-set-key (kbd “C-\\”) ‘toggle-selective-display)

I tried to get the same settings I had with Vim, but without success. And since I won’t use Emacs anymore, I stopped my researches.

;————————————————————————————————–
;; tabulations
;; Comment changer la longueur des tabulations
;; pour un code écrit par
;; des sagouins.
;————————————————————————————————–

(defun tab4()
“Les tabulations vaudront 4 espaces”
(interactive “*”)
(setq tab-width 4)
)

(defun tab8()
“Les tabulations vaudront 8 espaces”
(interactive “*”)
(setq tab-width 8)
)

;————————————————————————————————–
;pour ne pas avoir de bandes verticales
;thanks to http://www.emacswiki.org/emacs/beginner.el
;————————————————————————————————–
;(set-fringe-mode 0)
;; don’t show tiny scroll bar in echo area
;(set-window-scroll-bars (minibuffer-window) nil)
;————————————————————————————————–
;Misc
;————————————————————————————————–

(setq visible-bell t) ;;警告音を消す

Some settings I have copy-pasted from somewhere a long time ago, for tabulations, scroll-bars and bell.

;;################################################################################
;;; ESS
;;################################################################################

;; (require ‘ess-site)
;; ;(require ‘ess-eldoc)

;; (ess-add-MM-keys) ;; notamment pour des “squelettes” de fonctions

;; “View *R* objects in a dire-like buffer.” t)

;; (setq-default ess-ask-for-ess-directory t) ;; demande le dossier de travail à chaque démarrage de R
;; (setq-default ess-directory “/media/ifremer/Analyses/R/”) ;; répertoire de travail proposé par défaut

;; ‘(lambda ()
;; (auto-fill-mode t)
;; ;;(flyspell-mode t)
;; (setq-default fill-column 100)
;; )
;; )

;; ;; Pour ajouter à la liste d’association les .Rhistory pour les traîter comme
;; ;; des fichiers sources R
;; (setq auto-mode-alist
;; (append
;; ‘((“\\.[rR]history\\'” . R-mode))
;; auto-mode-alist))

;; (define-key ess-mode-map [f6] ‘comint-dynamic-complete-filename)

;; ;; Montrer “au vol” les arguments de fonctions:

;; ;; ess-r-args-noargsmsg is printed, if no argument information could
;; ;; be found. You could set it to an empty string (“”) for no message.
;; (setq ess-r-args-noargsmsg “No args found.”)

;; ;; ess-r-args-show-as determines how (where) the information is
;; ;; displayed. Set it to “tooltip” for little tooltip windows or to
;; ;; nil (the default) which will use the echo area at the bottom of
;; ;; (setq ess-r-args-show-as “tooltip”)

;; ;; ess-r-args-show-prefix is a string that is printed in front of the
;; ;; arguments list. The default ist “ARGS: “.
;; (setq ess-r-args-show-prefix “ARGS: “)

;; (defun Rnw-mode ()
;; (require ‘ess-noweb)
;; (noweb-mode)
;; (if (fboundp ‘R-mode)
;; (setq noweb-default-code-mode ‘R-mode)))

;; (setq-default inferior-R-args “–no-restore-history –no-save “)

;; (defun my-ess-options ()
;; (ess-set-style ‘C++)
;; (column-number-mode t)
;; (lambda ()
;; (nuke-trailing-whitespace)))
;; (define-key ess-mode-map [(meta backspace)] ‘backward-kill-word))

;; (defun my-iess-keybindings ()
;; (define-key inferior-ess-mode-map [(control ?a)] ‘comint-bol)
;; (define-key inferior-ess-mode-map [home] ‘comint-bol))

Here are settings for ESS if yo plan to use it.

;;##################################################################################################

;;CUSTOMIZATION-FACE : FONT, COLOR
;; Modifications de l’apparence
;; font : aller dans Option –> Set default font ; pour sauvegarder : Option –> Save Options
;; color : pour tester les couleurs, aller dans le Menu –> Tools –> Color Themes
(require ‘color-theme)
‘(progn
(color-theme-initialize)
(color-theme-andreas)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (require ‘color-theme)
; (color-theme-initialize)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (color-theme-andreas)
;; pour color theme voir aussi dans dans Option –> Customize emacs –> Browse customization groups –> Group “Faces” –> Group “Color Theme”
;; pour LaTeX :
;; – \emph –> font-latex-italic-face
;; – \footnote –> font-lock-constant-face
;; – commandes (\emph, \textsc) –> font-lock-keyword-face

;;##################################################################################################

;————————————————————————————————–
;Default font
;thanks to http://www.emacswiki.org/emacs/XftGnuEmacs
;————————————————————————————————–
;; To me, the best fonts are as follow ; modify if you prefer Bitstream or another font :

;(set-default-font “Deja Vu Sans Mono 10”)

;————————————————————————————————–
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won’t work right.
‘(column-number-mode t)
‘(display-time-mode t)
‘(show-paren-mode t)
‘(size-indication-mode t))

Here are settings related to appearance. You will notice that you can easily change that with emacs, and that there are plainty of choices. But Vim’s color schemes are better (in my humble opinion).

;;##################################################################################################
;; MISCELLANEOUS
;;##################################################################################################
;————————————————————————————————–
;; do not show the startup message and other stuff
;; at http://www.djcbsoftware.nl/dot-emacs.html
;————————————————————————————————–

(put ‘narrow-to-region ‘disabled nil) ;; enable…
(put ‘erase-buffer ‘disabled nil) ;; … useful things

(setq inhibit-startup-message t ;; don’t show …
inhibit-startup-echo-area-message t) ;; … startup messages

;————————————————————————————————–
;; POUR NE PAS AVOIR À TAPER EN ENTIER LA RÉPONSE YES/NO
;————————————————————————————————–

(fset ‘yes-or-no-p ‘y-or-n-p)

;————————————————————————————————–
;; Fichiers annexes dans ~/.emacs.d/lisp
;————————————————————————————————–
;;stuff in separate files;; maybe use autoload?

;;inclusion de la gestion des couleurs
;(require ‘couleurs nil ‘noerror)
;—————————————-
;;inclusion du calendrier
;(require ‘calendrier nil ‘noerror)
;—————————————-
;;afficher les numéros de ligne
;(and (< emacs-major-version 20) (eval-when-compile (require 'cl)))
;—————————————-
;(require 'linum)

;display line numbers in margin (fringe). Emacs 23 only.
;(global-linum-mode 1) ; always show line numbers

Some settings such as “no startup message” (really useful if you are tired of this), and some others that you can enable or disable. But notice I have disable the option allowing you to get line numbers at the left. By the way, the display of line numbers with Vim is better, so if you want to get it, try to use Vim.

;————————————————————————————————–
;; THUMBS-MODE
;————————————————————————————————–
(autoload ‘thumbs “thumbs” “Preview images in a directory.” t)

;————————————————————————————————–
;Search and case sensitivity
;————————————————————————————————–

; (setq case-fold-search nil) ; make searches case sensitive
(setq case-fold-search t) ; make searches case insensitive

;————————————————————————————————–
;; Switch ispell dictionary locally.
;————————————————————————————————–
;;; Mode Ispell
;; (require ‘ispell)
;; (setq ispell-dictionary “francais”)

;; (global-set-key (kbd “C-c d e”)
;; (lambda () (interactive)
;; (ispell-change-dictionary “english”)))
;; (global-set-key (kbd “C-c d f”)
;; (lambda () (interactive)
;; (ispell-change-dictionary “francais”)))

;————————————————————————————————–
; Comment rafraîchir un fichier dans .emacs lorsqu’il
; a été modifié par un autre programme ?
; thanks to http://www.emacswiki.org/emacs/RevertBuffer
;————————————————————————————————–

(global-auto-revert-mode 1)

;———————————————————–
; a function to revert all buffers :
;———————————————————–
(defun revert-all-buffers ()
“Refreshes all open buffers from their respective files”
(interactive)
(let* ((list (buffer-list))
(buffer (car list)))
(while buffer
(when (buffer-file-name buffer)
(progn
(set-buffer buffer)
(revert-buffer t t t)))
(setq list (cdr list))
(setq buffer (car list))))
(message “Refreshing open files”))

;————————————————————————————————–
(defun my-info-refresh (&optional arg)
“Display some useful information in the echo area instead of the mode line.
With prefix arg, insert the current timestamp to the current buffer.”

;; §§ WORK IN PROGRESS §§ doesn’t work !

;————————————————————————————————–
(interactive “P”)
(cond
((equal arg ‘(4)) ; C-u f5
(insert (format-time-string “%Y%m%d” (current-time))))
((equal arg ‘(16)) ; C-u C-u f5
(insert (format-time-string “%Y-%m-%d” (current-time))))
(t (message “%s”
(concat
(format-time-string “%Y-%m-%d %H:%M:%S %z” (current-time)) ;; ISO
” ”
(aref calendar-day-abbrev-array (nth 6 (decode-time (current-time))))
” : ”
(or (buffer-file-name) default-directory))))))

;(define-key my-map [f5] ‘my-info-refresh)
;(define-key global-map [f5] ‘my-info-refresh)

;; open Word files with antiword
(autoload ‘no-word “no-word” “word to txt”)
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won’t work right.
‘(default ((t (:inherit nil :stipple nil :background “white” :foreground “black” :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry “unknown” :family “DejaVu Sans Mono”)))))

Finally, here are some settings which might be useful but nothing special, and others who are related to appearance.

In the future I will continue to use Vim. For this reason I will just make a short description of some useful commands with Emacs in the second part.

## A script to automate the installation of TeXLive 2010 on Ubuntu

#******************************************************
2010年 11月 20日 土曜日 19:08:00 CET
– Several improvements thanks to Cédrik Copol
among them, translation in french, function for
– Fixed some problems
– I suggest to use Vim to benefit from folding and
thus to get a clarified file
#*******************************************************
2010年 11月 11日 木曜日 12:52:53 CET
Improvements for several things, passwords are
now hidden.
#*****************************************************
2010年 11月 06日 土曜日 00:00:00 CEST
Script improved thanks to Matthew Mower.
#*****************************************************
– choice between opensuse and ubuntu available
– choice between i386 and x64 installation process
– improved some parts
#*****************************************************
#3rd update, 2010/10/16 1:27 pm
#improved choice dialog box, now it is easier
#to select install or update, no need to write
#it. Replaced also if else statement by case.
#improved update process
#*****************************************************
#2nd update, 2010/10/15 08:33pm
#improved the script with just a small “trick”
#(nothing smart at all, just a simple modification)
#to enable the user not to enter the date
#*****************************************************

#*****************************************************
#Updated the post on 2010/10/14, 07:22
#corrected html code to unable correct copy-
#paste in a text editor: code instead of
#features to the script to make it easier
#to use
#*****************************************************

Recently I had to install several times TeXLive 2010 on different computers. Also, I have friends who do not feel comfortable with command line and don’t want to install the last version of TeXLive for this reason. Consequently, I have written a small script to automate the task and to allow others to easily install TeXlive 2010 (or at least, I hope it will be more easy with this script).

Also, this script has been written for Ubuntu users, but if you use another operating system, you might be used to command line. So if you use for example Archlinux, replace “apt-get install” by “pacman -S”.

TO USE THIS SCRIPT you have 2 choices :

2. Save it in your home directory, and open a terminal (press Ctrl+Alt+t). Then, copy-paste the following in the terminal :
chmod +x install_update_tex ./install_update_tex

And follow the instructions. If you have any problem, let a comment (it has only been tested on my computer at the moment).

3. The second way is to copy the script in your text editor, let say gedit. Press Alt+F2, and in the prompt, enter gedit. Then, copy the following : #======================================================================= # FILE: install_update_texlive.sh # USAGE: Run from the terminal # DESCRIPTION: Automatic install/update of TeXLive 2010 # OPTIONS: — # REQUIREMENTS: Ubuntu or OpenSuse # BUGS: — # NOTES: Website: https://alexkrispin.wordpress.com/ # AUTHORS: Alexandre Krispin, k.m.alexandre@gmail.com, Matthew D. Mower, Cédrick Copol # COMPANY: — # CREATED: 2010 Oct 11, 20:25:43 UTC # REVISION: 2010年 11月 20日 土曜日 19:06:34 CET #======================================================================= #! /bin/bash

sudo -k

 #------------------------------------------------------------------------------- # Translations #------------------------------------------------------------------------------- #{{{ echo $LANG | grep -i fr; if [ "$?" == "0" ]; then #La langue est le français {{{ SELECT="Sélectionnez" CHOISE="Choix" IN_UP_TITLE="Installation ou mise à jour" IN_UP_TEXT="Souhaitez-vous faire une (ré)installation ou une mise à jour ?" IN_UP_TRUE="Installation" IN_UP_FALS="Mise à jour" DISC_TITLE="Espace disque" DISC_TEXT="Une installation complète nécessite ~2,3GB d'espace libre. Appuyer sur Oui pour continuer ou Non pour quitter." PASSWD_TITLE="Mot de passe" PASSWD_TEXT="Votre mot de passe est nécessaire pour continuer." BAD_PASSWD_TITLE="Mot de passe invalide" BAD_PASSWD_TEXT="Mot de passe invalide. Veuillez recomposer celui-ci :" EXIT_BAD_PASSWD="Désolé 3 mauvais mot de passe donné.\n$0 va se fermer." INFO_TEXT="L'installation va commencer et une fenêtre s'ouvrira. Pour exemple voir\nhttp://www.tug.org/texlive/doc/texlive-common/install-lnx-main.png\n\nVérifiez la taille du papier (A4 en général) puis cliquer sur 'Install TeX Live' pour continuer. (Notez que ce script ne fonctionne correctement qu'avec le dossier d'installation par défaut de TeX Live)" INFO_TITLE="Dernière notification avant installation" FILE_TITLE="Fichiers d'installation" FILE_TEXT="Voulez-vous conserver les fichiers d'installation téléchargés ? (Ils ne sont pas nécessaire au fonctionnement de TeX Live)" FONT_TITLE="Remarque informative" FONT_TEXT="Les fontes vont maintenant être installées." IN_END_TITLE="Installation terminée" IN_END_TEXT="L'installation est terminée. Vous pouvez périodiquement relancer ce script plus tard afin de mettre à jour votre distribution. Pour appliquer les modifications veuillez fermer votre session puis la réouvrir." UP_END_TITLE="Mise à jour terminé" UP_END_TEXT="TeXlive a été mis à jour." #}}} else # Default language is English {{{ SELECT="Select" CHOISE="Choice" IN_UP_TITLE="Install or update" IN_UP_TEXT="New install or update?" IN_UP_TRUE="Install" IN_UP_FALS="Update" DISC_TITLE="Disc space" DISC_TEXT="A full installation requires ~2.3GB of disc space. Press Yes to preceed or No to halt" PASSWD_TITLE="Password" PASSWD_TEXT="Your password is needed to continue:" BAD_PASSWD_TITLE="Invalid password" BAD_PASSWD_TEXT="Invalid password. Please re-enter a sudo capable password:" EXIT_BAD_PASSWD="Sorry 3 incorrect password attempts.\n$0 will be closed" INFO_TEXT="The installation process will begin and a window will appear. See here for an example:\nhttp://www.tug.org/texlive/doc/texlive-common/install-lnx-main.png\n\nCheck that paper size is correct. Then click 'Install TeX Live' to continue. (Note that this script is hard coded to work only with the default installation directory)" INFO_TITLE="Last notification before installation" FILE_TITLE="Install files" FILE_TEXT="Would you like to keep the downloaded installation files? (They are not necessary to use TeXLive)" FONT_TITLE="Information notice" FONT_TEXT="Now fonts will be configured." IN_END_TITLE="Installation finished" IN_END_TEXT="Installation finished. You can periodically run this script at later dates to update your distribution. In order for environment variables to be set, you still need to log out and log back in" UP_END_TITLE="Update finished" UP_END_TEXT="TeXlive has been updated." fi #}}} #}}} #=== FUNCTION ================================================================ # NAME: ask_passwd # DESCRIPTION: ask the password, and stop if there is more than 3 errors # PARAMETERS: # RETURNS: #=============================================================================== # {{{ ask_passwd() { PASSWORD=zenity --title='$PASSWD_TITLE' --text="$PASSWD_TEXT" --hide-text --entry if [ "$?" -eq "1" ] ; then exit fi # Count of the times you try to enter the password nb_inputpwd=1 echo$PASSWORD | sudo -S echo -e '\nPassword test.' while [ "$?" -eq "1" ]; do # Only 3 errors are authorized if [ "$nb_inputpwd" -eq "3" ]; then zenity --title='$BAD_PASSWD_TITLE' --text="$EXIT_BAD_PASSWD" --error exit else PASSWORD=zenity --title='$BAD_PASSWD_TITLE' --text="$BAD_PASSWD_TEXT" --hide-text --entry if [ "$?" -eq "1" ]; then exit fi # Incrementation nb_inputpwd=$(( nb_inputpwd+1 )) echo $PASSWORD | sudo -S echo -e '\nPassword test.' fi done } #}}} #------------------------------------------------------------------------------- # Select platform automatically, i386 or x64 {{{ #------------------------------------------------------------------------------- PLATFORM=uname -m case "$PLATFORM" in i386 | i486 | i586 | i686 | k7) BITTAG="i386-linux";; x86_64 | EM64T) BITTAG="x86_64-linux";; *)echo -e "$BAD_PLAT_TEXT" | zenity --title="$BAD_PLAT_TITLE" --text-info --width 500 --height 200;exit;; esac #}}} #------------------------------------------------------------------------------- # Install or Update choice {{{ #------------------------------------------------------------------------------- INSTALL_OR_UPDATE=$(zenity --title="$IN_UP_TITLE" --text="$IN_UP_TEXT" --list --radiolist --column "$SELECT" --column "$CHOISE" true "$IN_UP_TRUE" false "$IN_UP_FALS") if [ "$?" -eq "1" ] then exit; fi #}}} #------------------------------------------------------------------------------- # Case Install {{{ #------------------------------------------------------------------------------- case "$INSTALL_OR_UPDATE" in "$IN_UP_TRUE") #------------------------------------------------------------------------------- # Select OS {{{ #------------------------------------------------------------------------------- OS=$(zenity --title="Your OS"\ --text="Choose your OS:"\ --list\ --radiolist\ --column "Select"\ --column "Choice"\ true "Ubuntu"\ false "ArchLinux"\ false "OpenSuse") if [ "$?" -eq "1" ] then exit; fi #}}} #------------------------------------------------------------------------------- # Installing a package for the official install script of TeXLive 2010 {{{ #------------------------------------------------------------------------------- case "$OS" in "Ubuntu") PKGMGR_PERL="apt-get install perl-tk";; "SUSE LINUX") PKGMGR_PERL="zypper perl-Tk";; "ArchLinux") PKGMGR_PERL="pacman -S perl-tk";; *) echo -e "$BAD_OS_TEXT" | zenity --title="$BAD_OS_TITLE" --text-info --width 500 --height 200;exit;; esac #}}} zenity --question --title="$DISC_TITLE" --text="$DISC_TEXT" if [ "$?" -eq "1" ] then exit; fi STARTDIR=$(pwd) ask_passwd echo$PASSWORD | sudo -S $PKGMGR_PERL wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz tar -xf install-tl-unx.tar.gz echo -e "$INFO_TEXT" | zenity --title="$INFO_TITLE" --text-info --width 550 --height 200 cd$STARTDIR/install-tl-2* echo $PASSWORD | sudo -S ./install-tl -gui cd$STARTDIR zenity --question --title="$FILE_TITLE" --text="$FILE_TEXT" if [ "$?" -eq "1" ] then rm -rf install-tl* fi echo -e "\nPATH=/usr/local/texlive/2010/bin/$BITTAG:\$PATH; export PATH\nMANPATH=/usr/local/texlive/2010/texmf/doc/man:\$MANPATH; export MANPATH\nINFOPATH=/usr/local/texlive/2010/texmf/doc/info:\$INFOPATH; export INFOPATH\n" >> ~/.profile zenity --info --title="$FONT_TITLE" --text="$FONT_TEXT" echo$PASSWORD | sudo -S cp /usr/local/texlive/2010/texmf-var/fonts/conf/texlive-fontconfig.conf /etc/fonts/conf.d/09-texlive.conf echo $PASSWORD | sudo -S fc-cache -fsv zenity --info title="$IN_END_TITLE" --text="$IN_END_TEXT" ;; esac #}}} #------------------------------------------------------------------------------- # Case Update {{{ #------------------------------------------------------------------------------- case "$INSTALL_OR_UPDATE" in "$IN_UP_FALS") ask_passwd echo$PASSWORD | sudo -S /usr/local/texlive/2010/bin/$BITTAG/tlmgr update --self echo$PASSWORD | sudo -S /usr/local/texlive/2010/bin/$BITTAG/tlmgr update --all zenity --info --title="$UP_END_TITLE" --text="$UP_END_TEXT" ;; esac #}}} exit  #}}}  Save the file in your home directory under the name install_update_tex, and open a terminal (press Ctrl+Alt+t). Then, copy-paste the following in the terminal : chmod +x install_update_tex ./install_update_tex If you have any problem, comments are welcome. UPDATE OF THE POST, 03/05/2011 : With the update of this post we will see, first, how to overide the installation of TeXlive 2009 for the packages which have TeXlive 2009 as a dependency, and secondly, we will see how to use an external repository to make an update (let say, for example, to have the latest luatex engine) : 1. With Ubuntu, to disable unwanted texlive-* packages to be installed, you have to open a Terminal (press Alt+F2, and in the newly opened window, enter gnome-terminal) and then copy-past the following : sudo apt-get install equivs mkdir ~/tmp cd !$
equivs-control texlive-local

Then, open the file created in the tmp directory with, let say Gedit (press Alt+F2 and enter gedit in the prompt), and copy in this file the following :

Section: misc
Priority: optional
Standards-Version: 3.6.2

Package: texlive-local
Version: 2008-1
Maintainer: MPG
Provides: cm-super, cm-super-minimal, context, latex-beamer,
latex-cjk-all, latex-cjk-chinese, latex-cjk-chinese-arphic-bkai00mp,
latex-cjk-chinese-arphic-bsmi00lp, latex-cjk-chinese-arphic-gbsn00lp,
latex-cjk-chinese-arphic-gkai00mp, latex-cjk-common, latex-cjk-japanese,
latex-sanskrit, latex-xcolor, lmodern, luatex, musixtex, pgf, prosper,
tex4ht, tex4ht-common, texinfo, texlive-base, texlive-base-bin,
texlive-base-bin-doc, texlive-bibtex-extra, texlive-common,
texlive-doc-base, texlive-doc-bg, texlive-doc-cs+sk, texlive-doc-de,
texlive-doc-el, texlive-doc-en, texlive-doc-es, texlive-doc-fi,
texlive-doc-fr, texlive-doc-it, texlive-doc-ja, texlive-doc-ko,
texlive-doc-mn, texlive-doc-nl, texlive-doc-pl, texlive-doc-pt,
texlive-doc-ru, texlive-doc-th, texlive-doc-tr, texlive-doc-uk,
texlive-doc-vi, texlive-doc-zh, texlive-extra-utils, texlive-font-utils,
texlive-fonts-extra, texlive-fonts-extra-doc, texlive-fonts-recommended,
texlive-fonts-recommended-doc, texlive-formats-extra, texlive-full,
texlive-games, texlive-generic-extra, texlive-generic-recommended,
texlive-humanities, texlive-humanities-doc, texlive-lang-african,
texlive-lang-arab, texlive-lang-armenian, texlive-lang-croatian,
texlive-lang-cyrillic, texlive-lang-czechslovak, texlive-lang-danish,
texlive-lang-dutch, texlive-lang-finnish, texlive-lang-french,
texlive-lang-german, texlive-lang-greek, texlive-lang-hebrew,
texlive-lang-hungarian, texlive-lang-indic, texlive-lang-italian,
texlive-lang-latin, texlive-lang-manju, texlive-lang-mongolian,
texlive-lang-norwegian, texlive-lang-other, texlive-lang-polish,
texlive-lang-portuguese, texlive-lang-spanish, texlive-lang-swedish,
texlive-lang-tibetan, texlive-lang-ukenglish, texlive-lang-vietnamese,
texlive-latex-base, texlive-latex-base-doc, texlive-latex-extra,
texlive-latex-extra-doc, texlive-latex-recommended,
texlive-latex-recommended-doc, texlive-latex3, texlive-math-extra,
texlive-metapost, texlive-metapost-doc, texlive-music, texlive-omega,
texlive-pictures, texlive-pictures-doc, texlive-plain-extra,
texlive-pstricks, texlive-pstricks-doc, texlive-publishers,
texlive-publishers-doc, texlive-science, texlive-science-doc,
texlive-xetex, tipa,
Architecture: all
Description: Installation locale de TeX Live.
Installation locale d’une TeX Live nature complete.

After saving the file, copy-paste the following in the terminal :

equivs-build texlive-local
sudo dpkg -i texlive-local_2008-1_all.deb

From now on, you will be able to install any package usually requiring TeXlive 2009 as a dependency without installing TeXlive 2009. This tip is from Manuel Pegourier-gonard, see his post for more details (in french), modified a little to make it work with Ubuntu 10.10 and earlier.

2. To install packages from TLContrib (for more details about it see the corresponding website), you will have to use the terminal (press alt+f2 and in the prompt write gnome-terminal and press enter) :

sudo /usr/local/texlive/2010/bin/i386-linux/tlmgr –gui

If your computer doesn’t use the i386 version of TeXLive, then do as follows :

sudo /usr/local/texlive/2010/bin/x86_64-linux/tlmgr –gui

In the window newly opened, select an other repository :

Then, enter the url :

And then, push the button to start the update :

Finally you will just have to wait until it finishes.

## Writing LaTeX files with GVim

In this post I will show some useful links, some tips and shortcuts I have set in my settings for Vim.

1. First, here are screenshots and videos you might find useful if you are a beginner :
• If you don’t know how GVim looks like, here is the screenshot taken from a video at youtube.com :

And here is how GVim looks like with my own settings :

• Here is a screencast which explains the basics of vim that you can find with youtube or google videos :

An other screencast with some explanations about basic but useful plugins available for Vim, which will save your time when you edit files (such as LaTeX files) :

Once you get the basic idea of what GVim is, here are some lessons :

2. Secondly, here are some explanations about plugins I use in GVim :
• MRU is a vim script which enable you to use the Most Recently Used files. If you use the settings I have put in my repository at Github, then press F8, and you will get files you closed recently :

• When I don’t have used a file recently and want to open one, I press F4 and I get the Vim Explorer

If you want to enter in a directory, move the cursor to this directory and press enter. If you want to move back, press Backspace. To open a file, place the cursor on this file and press enter.
You will also notice that all files are sorted according to the extension, a nice feature of the plugin.

• NerdTree is an other way to search files. When another file is already opened, NerdTree will be opened automatically in a small part of the window, on the left :

To open it, press Shift+F4. To switch from the buffer opened on the left to the main buffer, you will have to use the mouse, or to type twice ctrl+w, a keystroke which will move automatically the cursor to the main part of the window.

You can also look at this screencast showing you more about the NerdTree plugin :

• If you are editing a LaTeX file (it works with other sort of files), select the block you wish to comment, and then type “,ci”. It will comment it, thanks to the plugin NerdCommenter. To uncomment it, do the same thing. Here are screenshots showing you a selected block and then the same block commented after typing ,ci :

• Thanks to the AutoComplPop plugin, when you type a word, a popup will automatically be displayed, and will show you all words available in your dictionaries’ directory specified in the settings I have made (~/.vim/ftplugin/tex.vim) :

• Let us assume you wish to enter a section in your LaTeX file. With the plugin SnipMate, you will only have to type sec and press tab, and you will have everything expanded. Then when you will enter the title, it will automatically write the same for the label, and once you will have pressed tab again, the cursor will automatically jump to the place where you will have to begin your section. In this screenshot I enter sec :

Here is what I get when I press tab :

And while I am typing the title, it automatically type the label :

And then, pressing tab will make the cursor jump to the right place between the delimited space defined with the snippet (for Ubuntu users not aware of what a snippet is, basically let us say it is similar to a template).

Also, many other snippets are already defined, and I have defined others snippets by myself. If you want to get a try or to look at it, see the corresponding file in my repository at Github.

If you don’t get the idea of Snipmate, then look at this video :

• Let us assume you have multiple files (which we call in this case “buffer“) opened in the same window, and you wish to select one. With the plugin SelectBuffer, you will just have to press F10 and it will open a small area where you will can select the one you want. Once you get it, press F10 again and it will automatically close itself :

If you don’t understand what a buffer is, since it is important to understand the use of this plugin, look at this screencast :

• Let us assume the cursor is positioned on a bracket. Press % in normal mode, and your cursor will automatically jump to the other one, thanks to the matchit plugin. It might be useful for footnotes or other things in *.tex files.

The following screencast show an example at 8 min 01 s :

Let us assume you wish to get 2 files in the same screen. In normal mode, type ;bv and press enter, and the screen will split vertically thanks to the buffer explorer plugin :

You can try yourself other commands like ;be and ;bs if you are interested.

• Other plugins are also in my .vim directory. FuzzyFinder for example. If you type :FuzzyFile, you will get the following :

For more details, look at the documentation of the plugin or see this screencast.

• If you type :Calendar and press enter in normal mode, a calendar will be displayed thanks to the calendar plugin

• Other plugins may be interesting for you, such as the multiple search plugin, the align plugin and the time stamp plugin. But for these plugins, I will let you look by yourself the documentation.
If you don’t know how to look to the relevant documentation corresponding to the plugin, then do as follow. In normal mode, type :h Align and press enter, and you will get a new buffer displayed for the Align documentation :

3. Though it is not plugins, here are some other tips you need to know if you wish to use my settings :
• If you want to save a file, press F2.
• If you want to open a terminal, press shift+F2
• If you want to open nautilus, press Alt+F2. Notice that if you want to open another file manager, you will have to change it in THE settings. For this, look in the .vimrc file.
• If you want to close a buffer, that is to say a file, then press F3. If you want to close all buffers currently opened in a window, press shift+F3. And if you don’t want to save and want to exit, press Alt+F3.
• If you want to compile a *.tex file, press F11. It will also automatically start the viewer after finishing to compile. If you just want to compile, and don’t want to see the result, press Alt+F11. Notice that the default compiler is XeLaTeX, and not pdfLaTeX. If you want to change the compiler, you will have to change my settings, and to do so you will have to modify the tex.vim located in ~/.vim/ftplugin. And if you don’t understand how to modify it after looking at the tex.vim file, let a comment (though you should get a try to XeLaTeX).
• If you want to enable spell checking for french, press F12. If you want to disable it, press F12 again. If you want to enable spell checking for english, press Alt+F12. If you use most of the time english files, you might change the default mapping in .vimrc to replace the mapping for french by the mapping for english.
• When you want to copy a selected line, word, etc, press Ctrl+Insert. To cut a selected line, word or other, press Insert+Suppr. And to paste it, press Shift+Insert. If you are not familiar to these shortcuts, then learn to like it instead of changing it, because these shortcuts are also used in other programs.
• To search a word, type “/” in normal mode, and then enter your word. If several words exist, press enter and then type “n”, which means “next”. The cursor will jump to the next word each time you will press “n”. Once your searches are finished, enter Ctrl+n to cancel highlighting.
• To open a new tab, press Ctrl+t in normal mode. To move to the next tab, press Ctrl+”left arrow” or Ctrl+”right arrow” depending on what tab you want to select.
• To format a paragraph, press Shift+q in normal mode. But be aware that you should avoid it with my settings, which won’t let you get a correct formatting with LaTeX files.
• To emphasize a word, select it and press “,em” in normal mode. See other shortcuts in the latex-suite documentation. But notice that I have changed the default mapping. Instead of pressing  and the abbreviation, you will have to press “,” and the abbreviation (the reason of this mapping is that a comma is easier to type than a “” with a french keyboard). Here are some examples of shortcut :

Shortcuts LaTeX commands
,md \textmd{}
,tt \texttt{}
,sf \textsf{}
,up \textup{}
,bf \textbf{}
,sl \textsl{}
,sc \textsc{}
,it \textit{}
,em \emph{}
,a \alpha
,b \beta
,A \Alpha
,B \Beta
And so on
etc, etc
I won’t show you
all shortcut
for more details,
see the latex-suite
documentation

In any case this setting is for french keyboards, if you use another keyboard, change this in tex.vim if you want.
• If you want to search a word in google with firefox, then select the word, and press “f” in visual mode. If you want to search in Wikipedia instead of google, press “w” instead of “f” in visual mode.
4. Here is another tip with Vim, really useful. Let us assume you wish to enter a word or several words which are painful to typeset with your keyboard, and let us also assume that you often use this or these words. Then using abbreviations is a nice idea. My abbreviations are set in the tex.vim, see the line 33. Basically, an abbreviation is something you type and which will expand automatically to the word or the words you have set previously after you press the space key. So for example, since I have :

iab bcp beaucoup
iab qqn quelqu’un
iab qqc quelque chose

When I will write bcp, it will transform automatically in beaucoup when I will press the space bar.

Look here or here for further explanations.

5. With Vim, another thing really useful is imap (or nmap for normal mode, and vmap for visual map). Imaps are mappings set to work in insert mode. So for example, let us assume you wish to insert a bracket, say “(“. Since I have defined “imap ( ()” in my tex.vim, pressing ( will automatically load the other bracket. So writing ( will write automatically (). When you write “,ja”, it will automatically write {\ja }. Same thing for “…”, it will be replaced automatically by “\ldots”. For further details, see the vim documentation (in normal mode, type “:h imap”).
6. Don’t forget that Vim is not as bad as Microsoft Word, OpenOffice.org Writer and other similar text processors are. Let us take an example. If you have the following :
a b c
d e f
i j k
Could you insert a & between each letter in each lines easily ? No. But with Vim it is easy. With Word or other similar softwares, could you easily replace each letter or each word of the beginning of a line ? No. But with vim it is easy to do so. Therefore, if you are a beginner, don’t forget to search with google if something you need to do is painful, maybe there is an easy way with Vim to automatize your task and to achieve your goal.

Finally, here are some links which you could find useful :

Vim tips if you don’t want to use my settings, or are just curious
A course, “Vi : introduction”
The LaTeX suite documentation in html or in txt format (available in Vim)
A nice ref card of Vim in several formats (download the pdf file) and another one in html, maybe more clear
French speakers should also take a look here
In case you wish to ask a question, Google group is a good place.
Another Vim tutorial
If you are japanese, you could find this blog useful.
If you are french and want to use the bépo keyboard

## Installing and setting up the Vim text editor

To write LaTeX files, I use GVim which is basically Vim with a modern outlook. If you are interested to get a good text editor, use Vim or GVim with free Unix operating systems (that is to say operating systems which are under GPL or BSD license), MacVim with Mac OSX, and maybe GVim or Evim with Microsoft Windows operating systems (XP, Vista, Seven).

If you make some researches about text editors, you may notice that there is a stupid “war” between Emacs and Vim. Actually, both are excellent text editors, only the approach changes. Also, though comparing a text editor might be highly controversial and subjective, it might be right to say that Vim is one of the best text editors, available for all platforms.

If you wish to write LaTeX files, a well configured text editor like GVim will make your life easier, and will increase your efficiency in typesetting. Once you will have learned how to use Vim, you will also understand how ridiculous are Word processors like Microsoft Word or OpenOffice.org Writer compared to Vim or Emacs.

In this post I will explain, first, how to install Vim in GNU/Linux, FreeBSD, Microsoft Windows and Mac OSX, and secondly, I will write a short explanation of my setup.

1. For GNU/Linux To install GVim with GNU/Linux, the version of Vim with a modern interface, you have 2 choices. (1) To install it with your package manager. If you have Ubuntu, install Vim-gtk with Ubuntu Software Center :

(2) Th second choice is to install GVim from the official website, useful if you want the latest version of Vim (currently, 7.3) :
http://ftp.vim.org/pub/vim/unix/
Download the latest version, at the bottom of the page. Notice that to install it with Ubuntu, you will need some development libraries, such as libx11-dev, libgtk2.0-dev and another one but I don’t remember (look at the compilation errors, or the INSTALL* file). So if you are not familiar with command line and compilation errors, I recommend to use your package manager instead of the tarball file of the official website.
2. For FreeBSD To install GVim with FreeBSD, you could choose the second way I have described above for GNU/Linux, or to install it from ports (notice that the install process with ports is quite long thanks to patches) :
 su cd /usr/ports/editors/vim make WITH_GTK2=yes make install clean 
3. For Microsoft Windows Though I am not really aware of the install process with any version of Windows (I have never used Windows on my laptop), I suppose you will have to install and download it from the following url :
4. For Mac OSX I don’t have tried to install Vim on Mac OSX, but try the following link :
http://macvim.org/OSX/index.php

Secondly, you have to make Vim work like you want. Indeed, you won’t be efficient with Vim if you don’t have a good setup. Since I have already done the job (thanks to all informations I have gathered from the internet), you will just have to make a copy of my git repository. To do so, you will need to install git if you don’t have it. If you are not familiar with the command line and use Ubuntu, copy-paste the following in a terminal (to open a terminal, press “ctrl+alt+t”) :
 cd ~ sudo apt-get install git git https://alexandre-k@github.com/alexandre-k/repository_alexandre_krispin.git cp ~/repository_alexandre_krispin/configuration_files_for_text_editors/vim_configuration_files/.vim ~/.vim cp ~/repository_alexandre_krispin/configuration_files_for_text_editors/vim_configuration_files/.vimrc ~/.vimrc cp ~/repository_alexandre_krispin/configuration_files_for_text_editors/vim_configuration_files/.gvimrc ~/.gvimrc 
That’s all. Notice that I don’t have used my setup with Mac OSX and Windows, and I don’t know if I will be able to help you if you have any troubles with Windows.

Now I will explain my .vimrc, my .gvimrc and then my tex.vim (located in .vim/ftplugin/) :

1. First, my .vimrc (located in /home/your_username/.vimrc in free Unix operating systems like GNU/Linux and *BSD). You can take a look at it in my Github repository :

“————————————————————————-
” Basic settings for LaTeXsuite
http://vim-latex.sourceforge.net/documentation/latex-suite/recommended-settings.html
“————————————————————————-
” REQUIRED. This makes vim invoke Latex-Suite when you open a tex file.
filetype plugin on

This setting will allow you to get the right settings according to the file extension. In other words, it will load all settings used with LaTeX-suite.

” IMPORTANT: win32 users will need to have ‘shellslash’ set so that latex
” can be called correctly.
“set shellslash

” IMPORTANT: grep will sometimes skip displaying the file name if you
” search in a singe file. This will confuse Latex-Suite. Set your grep
” program to always generate a file-name.
set grepprg=grep\ -nH\ $* ” OPTIONAL: This enables automatic indentation as you type. filetype indent on ” OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to ” ‘plaintex’ instead of ‘tex’, which results in vim-latex not being loaded. ” The following changes the default filetype back to ‘tex’: let g:tex_flavor=’latex’ “To jump from a section to another one map ]s :/\\$$sub$$\{,2}section\s*{ :noh map [s :?\\$$sub$$\{,2}section\s*{ :noh This part is just a copy of the recommended settings from the official website of Latex-suite. “———————————————————————— ” General settings “———————————————————————— let b:loaded_tex_autoclose = 1 let g:autoclose = 1 set backspace=indent,eol,start “allow backspacing over everything in insert mode set textwidth=80 set title ” change the terminal’s title syntax on “switch on syntax highlight set undolevels=1000 “number of undos set history=1000” “sets how many lines of history VIM has to remember set complete+=k ” enable dictionary completion set clipboard+=unnamed ” yank and copy to X clipboard set showmatch “show pairs of brackets set hlsearch ” When there is a previous search pattern, highlight all ” its matches. set incsearch ” While typing a search command, show immediately where the ” so far typed pattern matches. set ignorecase ” Ignore case in search patterns. set smartcase ” Override the ‘ignorecase’ option if set wrapscan ” end of search has been achieved! set magic “regexp version magic set cursorline “highlight current line set cursorcolumn “highlight current column set wildmenu set wildignore=*.o,*~,*.cmo,*.cmi,*.a,*.cmx,*.cmxa,*.lo,*.log,*.aux,*.dvi,*.aut,*.aux,*.bbl,*.blg,*.dvi,*.fff,*.out,*.pdf,*.ps,*.toc,*.ttt set number “to show line number “set nocompatible “seems that setting Vim not to be compatible with Vi disables the setting bellow, whichwrap. “Therefore I disable it set whichwrap=b,s,,[,] ” Allow specified keys that move the cursor left/right ” to move to the previous/next line when the cursor is on the first/last character ” in the line. b (backspace), s (space) and the arrows. set nostartofline ” Do not place the cursor at the start of the line when using Page up/down. set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.out,.toc “for file names completion set hi=2000 ” remember last 2000 typed commands set autoread ” Set to auto read when a file is changed from the outside set enc=utf-8 set hidden ” It hides buffers instead of closing them. This means that you ” can have unwritten changes to a file and open a new file using :e, without being ” forced to write or undo your changes first. Also, undo buffers and marks are ” preserved while the buffer is open. set visualbell ” don’t beep set noerrorbells ” don’t beep set list ” Vim can highlight whitespaces for you in a convenient way: set listchars=tab:>.,trail:.,extends:#,nbsp:. set laststatus=2 “status bar set statusline=%n:\ %f%m%r%h%w\ [%Y,%{&fileencoding},%{&fileformat}]\ [%l-%L,%v][%p%%]\ [%{strftime(\”%l:%M:%S\ \%p,\ %a\ %b\ %d,\ %Y\”)}] set ruler set rulerformat=%25(%n%m%r:\ %Y\ [%l,%v]\ %p%%%) ” toujours afficher le mode courant set showcmd “show the command being typed Then come the general settings. Since they are well commented, I let you read by yourself. To sum up, I have put here some settings about the text width, the search, the cursor, the status line, and other stuff for convenience that you can find everywhere on the internet. “—————————————– ” change cursor colour depending upon mode if exists(‘&t_SI’) let &t_SI = “\]12;lightgoldenrod\x7” let &t_EI = “\]12;grey80\x7” endif “——————————– ” Backups “——————————– set nobackup set backupcopy=auto set backupskip=/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*test*,*temp*,*tmp*,*tst*,*~,*bak

“———————————–
“nice colors and fonts
“———————————–
colorscheme herald
colors herald
“set guifont=DejaVu\ Sans\ Mono\ 10
set guifont=Inconsolata\ 12 ” very nice, but leaves terrible artefacts with national (mostly russian) characters
“set guifont=Terminus\ 10 ” wonderful, yet smallish, and sucks at larger sizes
“———————————-
” GUI Options
“———————————-
“if has(“gui_running”)
” ” GUI cursor: no blinking

” ” no toolbar
” set guioptions-=T
” ” no autoselect
” set guioptions-=a

” ” Use console messages instead of GUI dialogs
” set guioptions+=c
“endif

The most important thing here is the settings for backups. Since backup files annoyed me, I have set it to “nobackup”. If you prefer to get backup, replace “set nobackup” by “set backup”. Also, the color scheme is “herald”, a nice one, and the font is inconsolata. If you prefer to get a more shiny or simply another color scheme you would like, check the demos at the following url :
Color sampler pack
Or this one :
Color samples with LaTeX files
Once you have chosen, replace the “herald” colorscheme by the one you want.

“——————
“formatting
“——————
set formatoptions=tcroqn ” see help
“set formatoptions=c,q,r,t ” This is a sequence of letters which describes how
” automatic formatting is to be done.

” letter meaning when present in ‘formatoptions’
” —— —————————————
” c Auto-wrap comments using textwidth, inserting
” the current comment leader automatically.
” q Allow formatting of comments with “gq”.
” r Automatically insert the current comment leader
” after hitting in Insert mode.
” t Auto-wrap text using textwidth (does not apply
“—————
set smartindent ” turn on smart indenting
set autoindent ” always set autoindenting on
set copyindent ” copy the previous indentation on autoindenting
set shiftwidth=4 ” number of spaces to use for autoindenting
set shiftround ” use multiple of shiftwidth when indenting with ‘<‘ and ‘>’
set smarttab ” insert tabs on the start of a line according to
” shiftwidth, not tabstop
“setlocal indentkeys+=},=\\item,=\\bibitem,=\\else,=\\fi,=\\or,=\\]

“————————–
” indentation automatique (à la Emacs)
“vnoremap =$“vnoremap = “nnoremap =$
“nnoremap mzvip=z

“let g:tex_indent_items = 1

Here are settings to make formatting work… But it doesn’t work well for LaTeX files, I am sorry for the inconvenience. Since I don’t really need to format LaTeX files (I write it correctly), I don’t really care of this. If one day I receive files badly formatted, then I will try to make it work. However, if you just plan to write LaTeX files, then the current settings might be sufficient.

“—————————-
“TAB BAR
“—————————-
” set up tab labels with tab number, buffer name, number of windows
function! GuiTabLabel()
let label = ”
let bufnrlist = tabpagebuflist(v:lnum)

” Add ‘+’ if one of the buffers in the tab page is modified
for bufnr in bufnrlist
if getbufvar(bufnr, “&modified”)
let label = ‘+’
break
endif
endfor

” Append the tab number
let label .= tabpagenr().’: ‘

” Append the buffer name
let name = bufname(bufnrlist[tabpagewinnr(v:lnum) – 1])
if name == ”
” give a name to no-name documents
if &buftype==’quickfix’
let name = ‘[Quickfix List]’
else
let name = ‘[Not yet saved]’
endif
else
” get only the file name
let name = fnamemodify(name,”:t”)
endif
let label .= name

” Append the number of windows in the tab page
let wincount = tabpagewinnr(v:lnum, ‘$’) return label . ‘ [‘ . wincount . ‘]’ endfunction ” set up tab tooltips with every buffer name function! GuiTabToolTip() let tip = ” let bufnrlist = tabpagebuflist(v:lnum) for bufnr in bufnrlist ” separate buffer entries if tip!=” let tip .= ‘ | ‘ endif ” Add name of buffer let name=bufname(bufnr) if name == ” ” give a name to no name documents if getbufvar(bufnr,’&buftype’)==’quickfix’ let name = ‘[Quickfix List]’ else let name = ‘[Not yet saved]’ endif endif let tip.=name ” add modified/modifiable flags if getbufvar(bufnr, “&modified”) let tip .= ‘ [+]’ endif if getbufvar(bufnr, “&modifiable”)==0 let tip .= ‘ [-]’ endif endfor return tip endfunction set guitablabel=%!GuiTabLabel() set guitabtooltip=%!GuiTabToolTip() Here are settings for the tab bar. Notice that for some Vim users, it seems to be a kind of pride an joy, but you can get tab bars with Emacs, Kile, and other softwares. “————– “spelling… “————– “to enable spell checking by default, uncomment the following line, “set spell ” automatic spell checking in your language for .txt et .tex. Replace “fr” by your default ” language, “en” if english : “augroup filetypedetect “au BufNewFile,BufRead *.txt setlocal spell spelllang=fr “au BufNewFile,BufRead *.tex setlocal spell spelllang=fr “augroup END “———————————— ” painless spell checking ” for French, you’ll need ” wget http://ftp.vim.org/pub/vim/runtime/spell/fr.utf-8.sug ” wget http://ftp.vim.org/pub/vim/runtime/spell/fr.utf-8.spl ” which you may move into ~/.vim/spell “————————————- function s:spell_fr() if !exists(“s:spell_check”) || s:spell_check == 0 echo “Spell checking activated (french)” let s:spell_check = 1 setlocal spell spelllang=fr else echo “Spell checking canceled” let s:spell_check = 0 setlocal spell spelllang= endif endfunction ” for English function s:spell_en() if !exists(“s:spell_check”) || s:spell_check == 0 echo “Spell checking activated (english)” let s:spell_check = 1 setlocal spell spelllang=en else echo “Spell checking canceled” let s:spell_check = 0 setlocal spell spelllang= endif endfunction “See mapping for spell checking in the relevant section, l. 361 “——–Another trick for spell checking is the following line : “uncomment if you want to use it, type “,C” if you want to enable it, “and replace aspell by any other dictionary you use (ispell, hunspell) “map ,C :w:!aspell -c %:e %” Here are settings for spell checking. If you want to enable spell checking by default, there are several ways. One is to uncomment the lines : ""augroup filetypedetect "au BufNewFile,BufRead *.txt setlocal spell spelllang=fr "au BufNewFile,BufRead *.tex setlocal spell spelllang=fr "augroup END" and to replace “fr” by “en” or any other abbreviation depending on the language you use. “————————— “For tags, but doesn’t work let tlist_tex_settings = ‘latex;s:sections;g:graphics;l:labels’ let tlist_make_settings = ‘make;m:makros;t:targets’ Here was a rest of the period when I tried to set up tags for LaTeX files, but didn’t get it successfully working. And since I don’t care and don’t have time for it, I let it for better days. “———————————————————————— ” MAPPING “———————————————————————— “—————————- “Saving “————————— map :w imap :w “—————————— ” Terminal “—————————— map :!gnome-terminal & imap :!gnome-terminal & “——————————- ” Graphical file manager “——————————– map :!nautilus & map :!nautilus & “—————————- “Exit “—————————- “exit map :q imap :q “exit all map :qall imap :qall “force Exit map :qall! imap :qall! “—————————- “Mapping to activate file explorer “of the specified directory “—————————- “To display NERDTree nnoremap :NERDTree /home/freeman/ ” To display VimExplorer nmap :VE %:p:h “—————————- “Mapping to explorer of recent file, “Most recently used files “—————————- map :Mru imap :Mru “————- “SelectBuf “————- nmap SelectBuf noremap SelBufHelpKey “—————————– “Compiling and viewing its .tex file “with XeLaTeX and evince (set in tex.vim) “—————————– “Compile and start viewer map ;ll ;lv imap ;ll ;lv “Compile only map ;ll imap ;ll “————————– “To enable spell checking for french : noremap :call spell_fr() inoremap :call spell_fr() vnoremap :call spell_fr() ” and for english : noremap :call spell_en() inoremap :call spell_en() vnoremap :call spell_en() Here are settings related to F* keys. I will explain their use latter, though you might be able to undestand it easily by yourself thanks to comments. Notice that if you don’t use gnome-terminal as terminal and nautilus as file manager, you will have to change the settings (if you don’t understand what I am talking about and use Ubuntu, then don’t worry and don’t change anything). “——————————— “Ctrl+Insert to copy into clipboard “Shift+Insert to paste from clipboard “Shift+Delete to cut into clipboard “Ctrl+a to select all “—————————- nmap “+gP imap i vmap “+y map ggVG map “+x “—————————- “Mapping to desactivate highligting “of search results “—————————- nnoremap :noh “——————————– ” firefox like shorcuts “——————————– map :tabnew map :tabnext map :tabprevious map :e “——————————– ” Quickly edit/reload the vimrc file “——————————- nmap ev :e$MYVIMRC
nmap sv :so $MYVIMRC “——————————– ” Use Q for formatting the current paragraph (or selection) “——————————– vmap Q gq nmap Q gqap “——————————– “If you like long lines with line wrapping enabled “——————————– nnoremap j gj nnoremap k gk “——————————– ” unmap arrows/pgdn/pgup so you learn to use hjkl map \ map \ map \ map \ map \ map \ imap imap imap imap imap imap “——————————– “Tired of clearing highlighted searches ? “——————————– nmap ,/ :nohlsearch “——————————– “Will search the word in firefox where “the cursor is when typing g in visual mode “big thanks to http://la.firme.perso.esil.univmed.fr/website/article.php3?id_article=70 vmap f :!firefox “http://www.google.fr/search?hl=fr&q=&btnG=Recherche+Google&meta=&#8221; >& /dev/null “A similar behaviour but for Wikipedia vmap w :!firefox “http://en.wikipedia.org/wiki/&#8221; >& /dev/null “——————————– “For qwerty keyboards : instead of “pressing “shift”+”;”, you will just “have to press ;, and say w to save. “——————————- “nnoremap ; : “——————————– “when you forgot to sudo before editing a file that requires root privileges “(typically /etc/hosts). This lets you use w!! to do that after you opened the “file already “——————————– cmap w!! w !sudo tee % >/dev/null Here are other settings to easily copy, paste, etc. Notice that I have disable arrow keys to force beginners to use hjkl keys. “—————————————————————— ” MiSCELLANOUS “—————————————————————— “——————————————————– ” Go back where I left off autocmd BufReadPost * call RestoreCursorPos() autocmd BufWinEnter * call OpenFoldOnRestore() ” Restore my cursor position function! RestoreCursorPos() if expand(“:p:h”) !=?$TEMP
if line(“‘\””) > 1 && line(“‘\””) <= line(“$”) let line_num = line(“‘\””) let b:doopenfold = 1 if (foldlevel(line_num) > foldlevel(line_num – 1)) let line_num = line_num – 1 let b:doopenfold = 2 endif execute line_num endif endif endfunction ” Open the fold if restoring cursor position function! OpenFoldOnRestore() if exists(“b:doopenfold”) execute “normal zv” if(b:doopenfold > 1) execute “+”.1 endif unlet b:doopenfold endif endfunction “————————- ” 日本語入力に関する設定: if has(‘multi_byte_ime’) || has(‘xim’) ” IME ON時のカーソルの色を設定(設定例:紫) highlight CursorIM guibg=Purple guifg=NONE ” 挿入モード・検索モードでのデフォルトのIME状態設定 set iminsert=0 imsearch=0 if has(‘xim’) && has(‘GUI_GTK’) ” XIMの入力開始キーを設定: ” 下記の s-space はShift+Spaceの意味でkinput2+canna用設定 “set imactivatekey=s-space endif ” 挿入モードでのIME状態を記憶させない場合、次行のコメントを解除 “inoremap :set iminsert=0 endif ” 日本語入力用のkeymapの設定例 (コメントアウト) “if has(‘keymap’) ” ” ローマ字仮名のkeymap ” “silent! set keymap=japanese set iminsert=0 imsearch=0 ” 入力時の初期状態 = IME OFF “endif Finally, here are settings to restore the position when you open again your file, and some settings to use ibus with japanese. Unfortunatly, it seems ibus conflicts with Latex-suite, and I don’t have time to search where does the problem come from. Since I don’t expect to write japanese files at the moment, I won’t search a solution until I have time. But if you can use ibus with GVim, then comments are welcome. 2. Secondly, here are my settings for .gvimrc. You can find it in my repository at Github : ” ウインドウの幅 set columns=200 ” ウインドウの高さ set lines=150 “set guioptions+=c ” use console dialogs, not the gui ones set guioptions-=T ” don’t show the toolbar set guioptions-=m ” don’t show the menu set guioptions-=r ” don’t need right scrollbar set guioptions-=L ” don’t show left scrollbars Basically, it will allow you to get a bigger window at startup than the default one, and it will disable useless things like scrollbars. 3. Thirdly, I will present my tex.vim file, that you can also find in my repository at Github : “————————————————————————– ” General settings “————————————————————————– “let g:autoclose = 1 “let g:Tex_SmartKeyQuote = 1 setlocal efm+=%E%f:%l:\ %m let g:Tex_DefaultTargetFormat=’pdf’ let g:Tex_CompileRule_pdf=’/usr/local/texlive/2010/bin/i386-linux/xelatex$*’

let g:Tex_ViewRule_dvi = ‘xdvi’
let g:Tex_ViewRule_ps = ‘gv’
let g:Tex_ViewRule_pdf = ‘evince’

Here are some settings to make Vim call the correct software related to the corresponding output. So for *.dvi files, I use xdvi, for *.ps files, gv, and for *.pdf files, evince. If you use other softwares, then replace the settings accordingly. If you use Ubuntu, then don’t do anything.

“———————————
“Enhanced Vim formatting of LaTeX files
“———————————
“map \gq ?^$\\|^\s*$$\\begin\\|\\end\\|\\label\\|\\documentclass\\|\\usepackage\\|\\paragraph\\item$$?1gq//+1 “omap lp ?^$\\|^\s*$$\\begin\\|\\end\\|\\label$$?1//-1.

“”To format LaTeX files,

“———————
“Dictionaries
autocmd Filetype tex,latex :set dictionary=~/.vim/ftplugin/latex-suite/dictionaries/dictionary,/home/linux/.vim/spell

Here are other rests from the period when I tried to setup a correct formatting with Vim for LaTeX files. Also, there is the settings for dictionaries, which are located in my home directory, ~/ (the abbreviation of /home/your_username).

“———————————————————————-
” Abbreviations
“———————————————————————-
iab ds dans
iab bcp beaucoup
iab qqn quelqu’un
iab qqc quelque chose
iab pol politique
iab leurope l’Europe
iab tv télévision
iab ceca CECA
iab ue Union Européenne
iab CE Commission Européenne
iab AL Amérique Latine
iab letat l’État
iab socio sociologie
iab éco économie
iab math mathématique
iab xelatex \XeLaTeX
iab latex \LaTeX
iab ak Alexandre Krispin

Here are settings for abbreviations. Remove them if you don’t use it. Also, notice that since the abbreviations are in the file “tex.vim” (~/.vim/ftplugin/tex.vim), they won’t be available for other files. If you want to make your abbreviations available for all files (.txt, .tex, .sty, etc), then copy your’s in the file .vimrc.

“—————————————————————————
” MAPPING
“—————————————————————————

“——————————–
“Change the mapleader from \ to ,

“——————————–
“fixing of é letter :
imap it
Tex_InsertItemOnThisLine
imap
Tex_MathBF
imap
Tex_MathCal
imap
Tex_LeftRight

“—————————————
“Another shortcut for placeholders.
“The default one is ctrl+j, really
“annoying. Pressing shift+tab is easier
imap
IMAP_JumpForward

“—————————————
“useful imaps
imap ,ja {\ja
“the above imap is intended to work with
“my setup for japanese in my templates compiled
“with XeLaTeX. For more details, look at my
“blog : https://alexkrispin.wordpress.com/
imap … \ldots

“———————————
“autoclose brackets
“Actually you can get a similar
“behavior with snippets : just type (,
“and then press the tab key. In case
“you prefer snippets, comment the
“following 3 lines
imap { {}
imap ( ()
imap [ []

“—————————————
“With XeLaTeX, these imaps are no longer
“required since you compile with
“unicode. In case you use pdfLaTeX to
“compile, enable the following :
“imap « \og
“imap » \fg
“imap € \EUR
“imap ~ \$\sim\
“imap ” \textquotedblleft
“imap ¢ \textquotedblright\

“————————————–
“If you have a french keyboard, this setting
“will let you easily put, let say bf.
“Instead of inserting bf in normal mode
“you will just have to insert ,bf (therefore,
“no need of the Alt Gr key)
vmap , 

Finally, I have set up my mappings :

• since I use an azerty keyboard, I have changed the map leader (“\”) to “;”. If you have another type of keyboard, then set the map leader to any other key you want.
• Also, if you don’t need to write the “é”, remove this setting.
• Notice that I have made another setting to move the cursor to the placeholder (“<++>”), I prefer to type shift+tab rather than “ctrl+j”, but remove it if you want.
• Since one day I will use Vim to write in japanese and maybe in arabic or persian (who knows) I have set the command “,ja” to write automatically “{\ja }” in LaTeX files. Further informations in the second part of my post about Vim.
• An other thing which might be worth to say is that if you write “…” in a LaTeX file, it will be automatically replaced by “\ldots”. If you don’t use XeLaTeX but LaTeX, you might find useful to uncomment lines like “imap € \EUR.
• lastly, notice that I have change the “” to “,” (more easy to type with french keyboard). So if you want to enter, let say, \textbf{}, then press “,bf” instead of the usual “`bf”.

## 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 :

/usr/local/texlive/2010/texmf-dist/doc/xelatex/mathespec/

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

/usr/share/doc/texlive-doc/xelatex/mathspec/

• 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 :

/usr/local/texlive/2010/texmf-dist/doc/latex/unicode-math

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

/usr/share/doc/texlive-doc/latex/unicode-math

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

\usepackage{unicode-math}

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 :

\documentclass{article}
\usepackage{unicode-math}
\usepackage{amsmath}
\usepackage{xltxtra}
\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
\documentclass{isodoc}
\usepackage{xltxtra}

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.

\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{url}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{soul}
\usepackage{textcomp}

Some useful packages, nothing special.

\usepackage[frenchb]{babel}

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.

\usepackage{hyperref}
\hypersetup{
pdftitle={Letter},%the title
pdfauthor={}
}

Nothing special, just the usual hyperref setup I use.

\tolerance=1000 % http://dcwww.camd.dtu.dk/~schiotz/comp/LatexTips/LatexTips.html
\usepackage{pdfpages}
\definecolor{spot}{rgb}{0.6,0,0}

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) :
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}}
,
return
,
,
date = today
,
,
subject = {Here goes the subject of your letter}
,

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
,
footer
,
phone = 0628766934
,
email = k.m.alexandre@gmail.com
,
website = \url{https://alexkrispin.wordpress.com/}
,
fill
,
}

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}
\letter{
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.
}
\end{document}

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.

## 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{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
\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{%
% uncomment the following line if you want to have black links (e.g., for printing)
plainpages=false, bookmarksnumbered, bookmarksopen=true, bookmarksopenlevel=1,%
pdftitle={Article},%the title
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{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
%********************************
%*******************************

%\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.