If you set an input method (for example via M-x set-input-method RET cyrillic-translit RET) you can type Cyrillic characters using a US keyboard: Emacs will use transliteration rules to convert Roman characters into Cyrillic ones. If you look in cyrillic.el, you see for example ("f" ?ф), i.e., typing f gives ф.
Now imagine you are editing a LaTeX file and LaTeX-mode (AUCTeX) in enabled. You use Cyrillic characters in the body of the text and Roman characters in formulae. In this context you would like f to produce f and not ф in math mode, (i.e. in $...$, \[...\], \(...\), and in math environments).
If I understand the question how to detect if inside a LaTeX math environment? and this answer correctly, the function texmathp can detect if we are in a math environment.
My question is about the possibility of the following conditional transliteration using quail
typing
fgivesfinside a LaTeX math environments andфelsewhere.