Thursday, October 9, 2014

Converting M/S Word to LaTeX source. Hex codes

I know there is some tool out there that does this, but if  it's just a matter of fixing a few
characters that seem to vanish when you export the word doc to plain text,
then it's useful to know that the unicode hex for

... (ellipsis) is 2026
long dash is 2013
hyphen is 2d
left double quote is 201C
right double quote is 201D
left single quote is 2018
right single quote is 2019

To find the code for a character (visible or not) in a file
open with vi, move the curso to it and type ga

Examples:

To convert all double left quotes to the LaTeX equivalent in vi:
:1,$s/\%u201C/\\lq\\lq/g


e with an acute accent is unicode hex 00e9, so to convert them all to LaTeX:
:1,$s/\%u00e9/\\'e/

No comments:

Post a Comment