2

I was hoping that, except for inputenc/fontenc versus fontspec, old .tex files encoded in UTF-8 could be used without changing anything with either pdftex, xetex or luatex engines.

But the following MWE points out that's not the case because of some xunicode's public macros, among others \m, \B, \G, \M, \T and \U: too bad that such short, hence popular, macros names were chosen by this package!

\documentclass{article}
\usepackage{expl3}
\ExplSyntaxOn
\pdftex_if_engine:TF
{
  \show\m
  \show\B
  \show\G
  \show\M
  \show\T
  \show\U
}
{
  \usepackage{fontspec}
  \show\m
  \show\B
  \show\G
  \show\M
  \show\T
  \show\U
}
\ExplSyntaxOff
\begin{document}
% \newcommand{\m}{}
% \newcommand{\B}{}
% \newcommand{\G}{}
% \newcommand{\M}{}
% \newcommand{\T}{}
% \newcommand{\U}{}
\end{document}

AFAIU, all these macros except \T concern OT1 font encoding and \T is defined as \DeclareRobustCommand{\T}[1]{\~{\m{#1}}}.

Hence my question: is it possible, in case of T1 font encoding, to safely patch these macros to disable them (just after fontspec load)?

Denis Bitouzé
  • 9,652
  • 4
  • 27
  • 85
  • Note that in the current texlive (and I think miktex) default configuration xelatex does not load hyphenation patterns for T1 encoding. – David Carlisle Apr 26 '15 at 17:17
  • @DavidCarlisle I should have mentioned that, because of what is mentioned in http://tex.stackexchange.com/q/115627/18401, I need T1 font encoding, even in case of xetex or luatex engines – Denis Bitouzé Apr 26 '15 at 17:25
  • 1
    OK but you will need to build a custom format or accept bad hyphenation in T1 encoded regions. – David Carlisle Apr 26 '15 at 17:28
  • Sigh... Is there another way to use kpfonts with fontspec? – Denis Bitouzé Apr 26 '15 at 17:30
  • 1
    the ideal way would be to use font tools to re-encode the font into Unicode encoding just as some other fonts are available in multiple encodings and formats, but that's not really my area.... – David Carlisle Apr 26 '15 at 17:33
  • 1
    kpfonts use URW Palladio, right? So TeX Gyre Pagella should be a very close Opentype Replacement for lua- and xelatex. From the Tex Gyre webpage: TeX Gyre Pagella is based on the URW Palladio L – MaxNoe Apr 26 '15 at 19:02
  • Note that languages with the alphabet as subset of iso-8859-1 (West Europe latin; French, for example) have no problems when using T1 or Unicoded fonts, because iso-8859-1 is common subset of both mentioned encodings. So, there is no difference between unicoded and T1 encoded French hyphen patterns, you needn't re-encode your favorite T1 encoded font to Unicode, etc. – wipet Apr 27 '15 at 09:26

1 Answers1

2

xunicode sets up for these commands also some OT1 defaults, but the main point are accents commands. E.g.

\DeclareEncodedCompositeCharacter{\UTFencname}{\M}{0322}{0322}  % (Combining retroflex hook below)

You can naturally redefine the command if you don't use it, but there is a tradition to use "one-char-commands" for accent commands and so I would never use such a name for a command.

Ulrike Fischer
  • 327,261