Last active
October 22, 2015 13:23
-
-
Save biiont/500d5003db0521fa3c9c to your computer and use it in GitHub Desktop.
This gist allows to programmatically search and replace in latex taking in consideration word form.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{article} | |
\usepackage{xltxtra} | |
\usepackage{xecyr} | |
\usepackage{polyglossia} | |
\setmainlanguage{russian} | |
\setotherlanguage{english} | |
\newfontfamily\cyrillicfont{DejaVu Serif} | |
\usepackage{xesearch} | |
\usepackage{xstring} | |
\newcommand{\korabl}[1]{% | |
\StrChar{#1}{1}[\headchar]\StrGobbleLeft{#1}{1}[\tailstr]% | |
\IfStrEq{\headchar}{К}{С}{с}\IfStrEqCase{\tailstr}{% | |
{орабль}{удно}% | |
{орабля}{удна}% | |
{ораблю}{удну}% | |
{орабли}{удна}% | |
{ораблём}{удном}% | |
{ораблем}{удном}% | |
{ораблями}{удами}% | |
}[\tailstr]% | |
} | |
\SearchList{korabl}{\korabl{#1}}{корабл?} | |
\begin{document} | |
\section{Корабль} | |
Кратенькое описание использования корабля. | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment