[XeTeX] Defining fonts for table columns in XeLaTeX

Pavel Straňák stranak at ufal.ms.mff.cuni.cz
Mon Jun 20 15:17:01 CEST 2005


Ross, thank you for the solution, it works well.
It also speeds up typesetting of the document greatly.
It is a valuable piece of information on how LaTeX works for me.

I haven't tried Will's sugestion, because this one does all I need.
Yet I wonder, what is the diference.

Thank you both,
Pavel

On Jun 20, 2005, at 1:37 AM, Ross Moore wrote:
>
> That code seems to be making all (except one) of its calls to  
> \fontspec
> from within the table-cells.
>
> This means that the macro-name, used to check whether a specific  
> \font command
> has been processed before, only has local scope, limited to that cell,
> or to within the particular {tabular}.
>
> Thus the \font command needs to be done again, every time, and you  
> exhaust
> the available \font registers.
>
> Try the following ...
>
> Just issue a command for each of your fonts, *outside* of the tables.
> This effectively loads all the fonts with global scope, so that
> they no longer need to be redefined for each usage.
> (See below, after the \begin{document} command.)
>
>
>>
>>
>>
>>> %!TEX TS-program = xelatex
>>> %!TEX encoding = UTF-8 Unicode
>>> \documentclass[11pt, a4paper]{article}
>>> \usepackage{fontspec, xunicode}
>>> \defaultfontfeatures{Mapping=tex-text}
>>> \usepackage[parfill]{parskip}
>>> \usepackage{array}
>>> \widowpenalty=10000
>>> \clubpenalty=10000
>>>
>>> \title{我的漢語詞典}
>>> \author{\textsc{Pavel Straňák}}
>>> \date{}
>>>
>>> %%%%%%%%%%%%
>>> \newcommand{\he}{\fontspec{STHeiti}}
>>> \newcommand{\himaru}{\fontspec{Hiragino Maru Gothic Pro W4}}
>>> \newcommand{\ka}{\fontspec{STKaiti}}
>>> \newcommand{\so}{\fontspec{STSong}}
>>> \newcommand{\fs}{\fontspec[Bold=STHeiti]{STFangsong}}
>>> \newcommand{\mi}{\fontspec{Minion Pro}}
>>> \newcommand{\gentium}{\fontspec{Gentium}}
>>> \newcommand{\gentiumIt}{\fontspec{Gentium Italic}}
>>> \newcommand{\lekce}[1]{\bigskip\section*{\he{#1}}}
>>> \newcommand{\slov}{\subsection*{\he{生詞:}}}
>>> \newcommand{\neuz}{\ensuremath{\sim}}
>>>
>>> \newcolumntype{H}{>{\fs}l}
>>> \newcolumntype{P}{>{\gentiumIt}l}
>>> %\newcolumntype{P}{>{\textit}l}
>>> %\newcolumntype{C}{>{\textbf}p{10cm}}
>>> \newcolumntype{C}{>{\gentium}p{10cm}}
>>>
>>>
>>> %%%%%%%%%%%%
>>>
>>> \begin{document}
>>>
>    \he \himaru \so \fs \mi \gentium \gentiumIt
>
>>> \ka
>>> \maketitle
>>>
>>> \lekce{第一課}
>>> \slov
>>> \begin{tabular}{HPC}
>>> 你 & n\u{i} & ty\\
>>> 好 & ha\u{o} & dobrý\\
>>> 你好 & n\u{i} ha\u{o} & Dobrý den.\\
>>> 再 & za\`{i} & brzy\\
>>> 見(见) & jia\`{n} & (vidět)\\
>>> 再見 & za\`{i} jia\`{n} & Na shledanou.\\
>>> \end{tabular}
>>> ...
>>>



More information about the XeTeX mailing list