# Disable some xunicode macros in case of T1 font encoding?

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)?

• 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 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
• 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
• 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
• 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

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