西里尔字母公式 (https://www.ctan.org/pkg/formular) 不适用于 (Xe/Lua)LaTeX,但适用于 pdfLaTeX:
\documentclass{article}
\usepackage{ifxetex}
\ifxetex
\usepackage{fontspec}
\usepackage{xparse}
\usepackage{polyglossia}
\setdefaultlanguage{russian}
\setotherlanguage{english}
\setmainfont[Ligatures=TeX, Extension=.otf]{cmunrm}
\setsansfont{Liberation Serif}
\setmonofont{Liberation Mono}
\else
\usepackage[english,main=russian]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T2A]{fontenc}
\fi
\usepackage{formular}
\ifxetex\else
\setFRMfontencoding{T2A}
\setFRMdfontencoding{T2A}
\fi
\newFRMfield{namef}{15mm}[QwЙц]
\begin{document}
Тест: \useFRMfield{namef}[Джон]
\end{document}
有人可以帮忙吗?
答案1
该formular
包硬连线了一些字体选择。
\documentclass{article}
\usepackage{ifxetex}
\ifxetex
\usepackage{fontspec}
\usepackage{xparse}
\usepackage{polyglossia}
\setdefaultlanguage{russian}
\setotherlanguage{english}
\setmainfont[Ligatures=TeX, Extension=.otf]{cmunrm}
\setsansfont{Liberation Serif}
\setmonofont{Liberation Mono}
\else
\usepackage[english,main=russian]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T2A]{fontenc}
\fi
\usepackage{formular}
\ifxetex
\setFRMfontencoding{\encodingdefault}
\setFRMdfontencoding{\encodingdefault}
\setFRMfontfamily{\ttdefault}
\setFRMdfontfamily{\sfdefault}
\else
\setFRMfontencoding{T2A}
\setFRMdfontencoding{T2A}
\fi
\newFRMfield{namef}{15mm}[QwЙц]
\begin{document}
Тест: \useFRMfield{namef}[Джон]
\end{document}