[Tex/LaTex] \renewcommand and \newcommand for accented letters

accentsmacros

I'm using OT1 font encoding, but I would like to use T1 font encoding for glyphs that don't exist in OT1. To do that, I'm redefining the typical T1 commands so that they automatically choose a T1 encoding. With the commands for accented letters, however, like \'e for é, using \newcommand{\'e} won't work because \' is already defined, but I can't use \renewcommand{\'e} either, since the full sequence \'e is not already defined.

Suggestions?

\documentclass{article}
\usepackage[T1, OT1]{fontenc}
%\newcommand{\'e}{\fontencoding{T1}\selectfont{\symbol{233}}} <- gives 'Command \' already defined' error
%\renewcommand{\'e}{\fontencoding{T1}\selectfont{\symbol{233}}} <- gives '\'eundefined' error
\begin{document}
\'e
\end{document}

EDIT:

Given all the comments about the OT1 vs. T1 encoding, here's the contents of the OT1 and T1 fonts for libertine. One can see here that the OT1 font has some ligatures the T1 font doesn't have:

\documentclass{article}
\usepackage{fonttable}
\begin{document}
\fonttable{LinLibertineT-lf-ot1} % OT1 encoding
\fonttable{LinLibertineT-lf-t1} % T1 encoding
\end{document}

enter image description here
enter image description here

Best Answer

You can, but wouldn't it be simpler to switch to the T1 encoding?

\documentclass{article}
\usepackage[T1,OT1]{fontenc}
\usepackage{libertine}

\DeclareTextCompositeCommand{\'}{OT1}{e}{{\fontencoding{T1}\selectfont\'e}}

\begin{document}

a\accent19 ei % the original one

a\'ei

\end{document}

enter image description here

You can easily extend to all desired combinations using the same pattern. Note that you can even use \'e in the definition, since the encoding will already be T1 in the group, so the combination \'e will use the relative definition.