3

I want to redefine \' for a few characters (e.g., so that \'t maps to t’). I once did this with \DeclareTextComposite (I think), which requires me to specify the encoding (T1, OT1, etc.). What is the encoding if I'm using XeLaTeX with Brill fonts. (I've ruled out T1, OT1, and a few others by trial and error.)

More generally, does XeLaTeX provide better ways to go about this reassignment of accent commands? will this approach be flexible enough to map a two character input (like \'{ky}) to a multicharacter output (like kʸ’).

—————————————————————

MWE shell:

% !TEX encoding = UTF-8 Unicode
\documentclass[12pt]{article}
\DeclareTextComposite{\'}{???}{t}{t'}
\setmainfont{Brill Roman}
\begin{document}
\'t
\end{document}
  • Shouldn't it be \v{t}? – egreg Jun 5 at 13:35
  • \v behaves differently for t and p, c, k (it adds a hacek for the latter). – Daniel Harbour Jun 5 at 14:00
  • (Also, even with \v{t}, I still need other accents to do other work. But let me know if there's something to \v that I'm missing.) – Daniel Harbour Jun 5 at 14:01
  • It would be better if you specify what's precisely your aim. – egreg Jun 5 at 14:18
  • Ulrike's answer below is enough for me to figure the rest out. Thanks for being willing, but I don't want to waste your time! – Daniel Harbour Jun 5 at 15:05
4

The encoding is TU, but the last argument of \DeclareTextComposite is a number (for the glyph/char position), so you can't it to get some combination. For this you can use \DeclareTextCompositeCommand (I don't have your font so I faked something). It only works for single chars as input.

\documentclass[12pt]{article}
%\DeclareTextComposite{\'}{TU}{t}{65} % gives A
\DeclareTextCompositeCommand{\'}{TU}{t}{blub}
\usepackage{fontspec}
\setmainfont{Arial}
\begin{document}
\'t
\end{document}

enter image description here

| improve this answer | |
0

The command accepts Unicode arguments.

Very handy. Another way of mapping.

blub

And the last argument can take arbitrary code.

Note that Brill font contains spacing modifier letters and combining diacritical marks, so kʸʼ can be entered directly.

MWE

\documentclass[12pt]{article}
\usepackage{xcolor}
\usepackage{tikz}
\DeclareTextComposite{\'}{TU}{u}{65}
\DeclareTextCompositeCommand{\'}{TU}{t}{b\textit{l}ub}
\DeclareTextCompositeCommand{\'}{TU}{x}{\textbf{bl\textcolor{red}{u}b}}
\DeclareTextCompositeCommand{\'}{TU}{y}{\textbf{bl\textcolor{red}{i}b}}
\DeclareTextCompositeCommand{\'}{TU}{z}{\fmanat 𔐀𔐳𔑺𔓒}
\DeclareTextCompositeCommand{\'}{TU}{Δ}{\textbf{bl\textcolor{red}{\textit{i}}b}}
\DeclareTextCompositeCommand{\'}{TU}{ѭ}{\textsc{bl\textit{o}b}}
\DeclareTextCompositeCommand{\'}{TU}{अ}{{\fmhiero 𓀀𓋖𓃨\textcolor{red}{𓇨}𓅽}}
\DeclareTextCompositeCommand{\'}{TU}{ꦓ}{\tikz\node[rectangle,draw,fill=yellow!50](b){kʸʼ};}
\DeclareTextComposite{\'}{TU}{v}{30306}


\usepackage{fontspec}
\setmainfont{Brill Roman}
\newfontface\fmcyr{Noto Serif}
\newfontface\fmdev{Noto Sans Devanagari}
\newfontface\fmhiero{Noto Sans Egyptian Hieroglyphs}
\newfontface\fmjav{Noto Sans Javanese}
\newfontface\fmanat{Noto Sans Anatolian Hieroglyphs}
\newfontface\fmzh{Noto Serif SC}

\begin{document}
\begin{tabular}{cccccc}
\verb|\'t| & \verb|\'u| & \verb|\'x| & \verb|\'y| & \verb|\'Δ| & \verb|z| \\
\'t & \'u & \'x & \'y & \'Δ & z \\
    &  &  &  &  &  \\
\verb|\'|{\fmcyr ѭ} & \verb|\'|{\fmdev अ} & \verb|\'|{\fmjav ꦓ} & \tikz\node[circle,draw,fill=green!15,yshift=-1em](a){kʸʼ}; & \verb|\'v| &  \verb|\'z| \\
\'ѭ & \'अ & \'ꦓ & kʸʼ & {\fmzh\large \'v} & \'z \\
\end{tabular}
\end{document}

Not an answer, of course; just a kitten playing with string.

Fortunately, the question was asked. And answered. Much appreciated to both.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.