Skip to content

Instantly share code, notes, and snippets.

@eivan
Last active December 3, 2019 10:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eivan/c0d43c838c0988f24c88f8a20c7a142d to your computer and use it in GitHub Desktop.
Save eivan/c0d43c838c0988f24c88f8a20c7a142d to your computer and use it in GitHub Desktop.
Replacing accented characters in LaTeX back and forth using Regular Expressions
% replacing accented characters using regexp-s
% can be used in Notepad++'s replace function for example
% %%%%%%%%%%%%%%%%%%%%%%% %
% accented letters -> tex %
% %%%%%%%%%%%%%%%%%%%%%%% %
% pattern:
(é)|(á)|(ű)|(ő)|(ú)|(ö)|(ü)|(ó)|(í)|(É)|(Á)|(Ű)|(Ő)|(Ú)|(Ö)|(Ü)|(Ó)|(Í)
% replace:
(?1\\'e)(?2\\'a)(?3\\H{u})(?4\\H{o})(?5\\'u)(?6\\"o)(?7\\"u)(?8\\'o)(?9\\'i)(?10\\'E)(?11\\'A)(?12\\H{U})(?13\\H{O})(?14\\'U)(?15\\"O)(?16\\"U)(?17\\'O)(?18\\'I)
% %%%%%%%%%%%%%%%%%%%%%%% %
% tex -> accented letters %
% %%%%%%%%%%%%%%%%%%%%%%% %
% pattern:
(\\'e)|(\\'a)|(\\H\{u\})|(\\H\{o\})|(\\'u)|(\\"o)|(\\"u)|(\\'o)|(\\'i)|(\\'E)|(\\'A)|(\\H\{U\})|(\\H\{O\})|(\\'U)|(\\"O)|(\\"U)|(\\'O)|(\\'I)
% replace:
(?1é)(?2á)(?3ű)(?4ő)(?5ú)(?6ö)(?7ü)(?8ó)(?9í)(?10É)(?11Á)(?12Ű)(?13Ő)(?14Ú)(?15Ö)(?16Ü)(?17Ó)(?18Í)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment