[XeTeX] Where to start

Peter Dyballa Peter_Dyballa at Web.DE
Fri Feb 8 14:36:14 CET 2008


Am 08.02.2008 um 12:50 schrieb Benjamin Koppe:

> Where do all you guys have your knowlegde from? Do you read the source
> code?


I think: no (at least not all). Most knowledge comes from discussions  
on this list. There were a few introductions posted lately.

You need to bear in mind that XeTeX accepts by default UTF-8 (or  
UTF-16) encoding. Fontencoding plays no big role, Unicode is assumed  
for it. For Hebrew right-to-left typesetting needs to be enabled.

	\TeXXeTstate=1

in the preamble, i.e. before \begin{document}, allows this, and then  
you need to use ``\beginR some text«« or {\beginR* some text \endR}?

Franois Charette has written the bidi package, either on CTAN or  
here: http://ankabut.net/xetex/bidi.zip

Could this template of a preamble provide the necessary hints? It's  
meant to be useful for XeLaTeX and LaTeX files, processed by XeTeX,  
pdfTeX, or pre-pdfTeX, i.e. using dvips (dvipfm support is still  
missing), so from the differences you might be able to find you're  
missing. Besides, the fontspec package is documented. Xltxtra  
provides macros and some subtleties. It's also documented. Xunicode  
is meant to allow LaTeX macro constructs like \i or \^{u} to not  
having to write ``õ«« or ``ž««.

\documentclass[a4paper,11pt,oneside,onecolumn,final]{article}
\usepackage{ifpdf,ifxetex,graphicx}
\usepackage[ngerman]{babel}
\ifxetex
      \immediate\write16{==Wir sind mit XeTeX==}
   \usepackage[no-math]{fontspec}
   \usepackage{xltxtra,xunicode}
%¥  \special{pdf:tounicode [CMapFile]}
   \defaultfontfeatures{Mapping=tex-text}
%  \setmainfont{Lucida Bright}
      \immediate\write16{Wir sind vor Lucida Bright}%
   \setromanfont{Lucida Bright}
      \immediate\write16{Wir sind vor Lucida Sans}%
   \setsansfont{Lucida Sans}
      \immediate\write16{Wir sind vor Lucida Sans Typewriter}%
   \setmonofont{Lucida Sans Typewriter}
%    \DeclareGraphicsExtensions{.pdf,.png,.jpeg,.bmp}			% formats  
with xdvipdfmx
%    \DeclareGraphicsExtensions{.mac,.pict,.psd,.sgi,.tga,.tif,.gif}	 
% additionally with xdv2pdf
%  \usepackage{hyperref}
\else
   \immediate\write16{==Wir sind ohne XeTeX==}
   \usepackage[utf8]{inputenc}
   \ifpdf
     \immediate\write16{==\jobname: Bonjour, PDF!==}
     \def\fileinfo{Ein ganz ausfŸhrlicher Text}
     \usepackage{cmap}
%    \DeclareGraphicsExtensions{.pdf,.png,.jpeg}			% allowed graphics  
formats
     \usepackage[activate={true,nocompatibility}]{microtype}
%    \usepackage[protrusion=true,expansion=true]{microtype}
     \usepackage{lucida}
     \usepackage{hyperref}						% needed at least for pdffilemoddate  
etc.
     \makeatletter
     \@ifundefined{pdffilemoddate}{%
        \PackageError{sourcetime}{%
          pdfTeX >= 1.30.0 required%
        }%
        \let\pdffilemoddate\@gobble
     }{}%
     \newcommand*{\SourceFile}[1]{%
       \edef\@SourceFileDate{\pdffilemoddate{#1}}%
       % empty in case of errors, but don't harm in next comparison
       \ifnum\pdfstrcmp{\@SourceFileDate}{\@CurrentSourceFileDate}>0 %
         \let\@CurrentSourceFileDate\@SourceFileDate
         \expandafter\@ParseDate\@SourceFileDate\@nil
         \hypersetup{%
           pdfcreationdate={\@SourceFileDate},%
           pdfmoddate={\@SourceFileDate}%
         }%
         \PackageInfo{sourcetime}{%
           Using file `#1'%
         }%
       \fi
     }
     \newcommand*{\@CurrentSourceFileDate}{}
     \expandafter\def\expandafter\@ParseDate\detokenize{D:} 
#1#2#3#4#5#6#7#8{%
       \year=#1#2#3#4\relax
       \month=#5#6\relax
       \day=#7#8\relax
       \@ParseTime
     }
     \def\@ParseTime #1#2#3#4#5\@nil{%
       \time=\numexpr #1#2 * 60 + #3#4\relax
     }
     \makeatother
     \SourceFile{\jobname.tex}
     \pdfinfo
       { /Title		(Mein Text)
	/Author		(Bruse Wayne)
	/Subject	(\fileinfo)
	/Keywords	(Batman, Batwoman, Batpyjamas, Batcave, Batbed,  
Commissioner Gordon, Alfred)
     }
   \else
     \immediate\write16{==ÁHola \jobname: DVI!==}
%    \DeclareGraphicsExtensions{.ps,.eps}		% allowed graphics formats
     \usepackage[protrusion=true,expansion=false]{microtype}
     \usepackage{times}
   \fi
   \usepackage[T1]{fontenc}
   \usepackage[portrait,nohead]{geometry}
   %%%%\renewcommand{\sfdefault}{pag}
   %%%%\renewcommand{\rmdefault}{ppl}
   %%%%\renewcommand{\ttdefault}{pcr}
   \makeatletter
   \newcommand*\TeX at logo@spacing[6]{%
     \def\xxt at kern@Te{#1}%
     \def\xxt at kern@eX{#2}%
     \def\xxt at lower@e{#3}%
     \def\xxt at kern@La{#4}%
     \def\xxt at kern@aT{#5}%
     \def\xxt at kern@eL{#6}%
   }
   \DeclareRobustCommand\XeTeX{%
     \leavevmode
     \smash{%
       X\lower\xxt at lower@e
       \hbox{\kern\xxt at kern@eX
         \setbox0=\hbox{E}\dimen0=\ht0\advance\dimen0by\dp0%
         \reflectbox{E}%
      }\kern\xxt at kern@Te\TeX}}%
   \DeclareRobustCommand\XeLaTeX{%
     \leavevmode
     \smash{%
       X\lower\xxt at lower@e
       \hbox{\kern\xxt at kern@eX
         \setbox0=\hbox{E}\dimen0=\ht0\advance\dimen0by\dp0\relax
         \reflectbox{E}%
     }\kern\xxt at kern@eL\LaTeX}}
   \TeX at logo@spacing{-0.15em}{-0.125em}{0.5ex}{-0.36em}{-0.12em} 
{-0.13em}
   \makeatother
\fi


--
Mit friedvollen Gr٤en

   Pete

Eternity is a terrible thought. I mean, where's it going to end?
				- Tom Stoppard





More information about the XeTeX mailing list