I'm creating some tables with conjugations for nouns, adjectives, etc., for certain languages. I wanted to colour certain endings of these instances but doing it manually is very tedious, so I tried to look for a way to automatise it. I have searched on high and low and asked in chat, but I could not find anything.
I could have used the listing
packages, but the strings are regular text, not code. Furthermore, there are some obstacles that make this a bit harder to achieve:
The alphabet in this case is not the Latin one, but Russian.
Although it's only the endings of words, not the whole word, some endings match with single words. For example, моего is the genitive for мой (mine), but there is also его (his). I don't want this last one to be coloured.
As an example, if colour = bold, then they should appear as "моего" and "его" respectively. Below I'll provide a very minimal example of what I want. If possible, I'd like to do this without using the command in the table (although I seriously doubt it).
Is this doable? Here's my desired result and a very minimal example. In this case there is one ending and one colour, but I'd like to use this with multiple colours and also multiple endings.
\documentclass[margin=10pt]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}
\usepackage{xcolor}
\begin{document}
\begin{tabular}{|c|c|}\hline
мой & мо\textcolor{blue}{его} \\
твой & тво\textcolor{blue}{его} \\
его/её & его/её \\
наш & наш\textcolor{blue}{его} \\
ваш & ваш\textcolor{blue}{его} \\
их & их \\ \hline
\end{tabular}
\end{document}
\def\ego{\textcolor{blue}{его}}
so that your entries would beмо\ego
,тво\ego
,наш\ego
, etc.??