Re: [OS X TeX] Kanbun (漢文) and French...
Peter Dyballa
Peter_Dyballa at Web.DE
Fri Jan 2 10:44:09 EST 2009
Am 02.01.2009 um 15:28 schrieb Jean-Christophe Helary:
> I did visit the site, installed xetex with Fink and tried it with a
> few (French) paragraphs or my document, but the resulting PDF did
> not display any French accent.
Because you did not adapt your document to XeTeX, did not, for
example, use fontspec in case it's LaTeX based. And it's also good to
use an UTF encoding for the document's contents.
I sent a few times a preamble that allows to typeset a UTF-8 encoded
LaTeX document with (some) LaTeX (either producing DVI or PDF) and
XeLaTeX. Could be it happened on the XeTeX list, so here it is on the
more general list (since it's not allowed to attach files I have to
paste the sometimes a bit long lines ...):
%% -*- mode: LaTeX; coding: utf-8; -*-
%
% Time-stamp: <2009-01-02 16:29:52 pete>
%
\documentclass[a4paper,11pt]{article}
\usepackage{ifpdf,ifxetex,graphicx}
%\usepackage[ngerman]{babel}
\usepackage[landscape,nohead,ignoreheadfoot,nomarginpar]{geometry}
\usepackage[svgnames]{xcolor}
\ifxetex
\immediate\write16{==We're with XeTeX==}
\usepackage[no-math]{fontspec}
\usepackage{xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text}
% \setmainfont{Lucida Bright}
\setromanfont{Lucida Bright}
\setsansfont{Lucida Sans}
\setmonofont{Lucida Sans Typewriter}
\newfontface\textsl[RawFeature={slant=0.194}]{Lucida Bright}
% \DeclareGraphicsExtensions{.pdf,.png,.jpeg,.bmp,.eps} % formats
with xdvipdfmx
% \DeclareGraphicsExtensions{.mac,.pict,.psd,.sgi,.tga,.tif,.gif}
% additionally with xdv2pdf, less eps!
\else
\immediate\write16{==We're without XeTeX==}
\ifpdf
\immediate\write16{==\jobname: Bonjour, PDF!==}
\usepackage{cmap}
% \DeclareGraphicsExtensions{.pdf,.png,.jpeg} % in pdfTeX
allowed graphics formats
\usepackage[activate={true,nocompatibility}]{microtype}
% \usepackage[protrusion=true,expansion=true]{microtype}
\usepackage{lucida}
\usepackage{hyperref}
\makeatletter % following code needs hyperref
\@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
{ % /ModDate (\time)
/Title (An UTF-8 LaTeX Example)
/Author (Peter Dyballa)
/Subject (ISO Latin-1 and ISO Latin-9 characters)
/Keywords (LaTeX, UTF8, ISO, Latin-1, Latin-2, Latin-9, ISO 8859, LICR)
}
\else
\immediate\write16{==¡Hola \jobname: DVI!==}
% \DeclareGraphicsExtensions{.ps,.eps} % in dvips allowed
graphics formats
\usepackage[protrusion=true,expansion=false]{microtype}
\usepackage{times}
\fi
\usepackage[utf8x]{inputenc}
% \usepackage[utf8]{inputenc}
\usepackage[full]{textcomp}
% \usepackage[LUC,T1]{fontenc}
\usepackage[T1]{fontenc} % other font encodings: T2A, T2B,
T2C, X2, LCY, OT2 (LY1, T5)
%%%%\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{% make a bit of XeTeX available
outside ...
\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
\begin{document}
Kanbun (漢文) and French with a good font ...
\end{document}
%%% Local Variables:
%%% mode: latex
%%% fill-column: 99999
%%% TeX-master: t
%%% End:
It's meant to be used in GNU Emacs. In TeXShop this header would be
better:
%%!TEX TS-program = xelatex
%%!TEX encoding = UTF-8 Unicode
and no footer needed.
Don't forget to customise for your system's fonts! Babel or
polyglossia can be used for hyphenation. Since your Japanese texts
are so short you don't other Japanese support then choosing the
proper font. Take care that you use up-to-date TeX Live and XeTeX in
Fink! Maybe you need to switch to unstable packages.
--
Greetings
Pete
Debugging? Klingons do not debug. Our software does not coddle the weak.
More information about the MacOSX-TeX
mailing list