Pomax / ucharclasses

A XeLaTeX package that lets you insert arbitrary code between characters from different unicode blocks
14 stars 4 forks source link

Remove \fontspec from the examples #7

Closed eg9 closed 8 years ago

eg9 commented 10 years ago

With the latest release of fontspec, an example such as

\documentclass[12pt]{article}

\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}

\usepackage[Latin, Thai]{ucharclasses}
\setDefaultTransitions{\fontspec{Hoefler Text}}{}
\setTransitionTo{Thai}{\fontspec[Scale=1]{Thonburi}}

\begin{document}

Test  ไทย

\end{document}  

will make XeTeX into an endless loop (see ucharclasses package does not work with TeX Live 2014's fontspec.

I believe it's advisable to declare fonts beforehand in any case and that the documentation should be accordingly modified; besides making the examples work, this has also the advantage of not inducing users into thinking that \fontspec should be used in the code.

Pomax commented 10 years ago

I've not done anything with XeLaTeX for a while, so I've been out of the loop on fotspec development; would you have any suggestions for the docs to make sense with the new fontspec that you might be able to file a pull request for? (which can be done through github itself these days, without needing to fork and clone first)

ickc commented 8 years ago

I encountered the same problem as well.

One solution is this:

\documentclass{article} 

\usepackage[Latin, Greek, CJK, Hebrew]{ucharclasses}
\usepackage{fontspec}

\newfontfamily\greekfont{CMU Serif}
\newfontfamily\hebrewfont{Tahoma}
\newfontfamily\CJKfont{KaiTi}

\newcommand{\latinfont}{\renewcommand\rmdefault{lmr}\renewcommand\sfdefault{lmss}\renewcommand\ttdefault{lmtt}\defaultfontfeatures[\rmfamily,\sffamily]{Ligatures=TeX}}

\setTransitionsForLatin{\latinfont}{}
\setTransitionsForGreek{\greekfont}{}
\setTransitionsFor{Hebrew}{\hebrewfont\setRTL}{\setLTR}
\setTransitionsForCJK{\CJKfont}{}

\usepackage{bidi}

\begin{document}

but my righteous one shall live by faith

ὁ δὲ δίκαιός μου ἐκ πίστεως ζήσεται

只是義人必因信得生。

בֶּאֱמוּנָת֥וֹ יִחְיֶֽה׃

\end{document}
Pomax commented 8 years ago

I've released 2.1 based on work in #14, and the documented use of fontspec in the updated .pdf doc should work quite well (advocating syntax similar to @ickc's solution)