[OS X TeX] character conversion scripts

Eric van der Oord eric.van-der-oord at wanadoo.fr
Wed Jul 28 09:42:21 EDT 2004


Below are two scripts I use, to be put in ~/library/application 
support/iTeXmac/Scripts.

HTH

Eric

%%% MactoTeX.applescript

on run
	tell application "iTeXMac"
		tell its front TeX document
			tell its text
				replace "€" by "{\\\"A}" in it with change all and cycle search
				replace "" by "{\\AA{}}" in it with change all and cycle search
				replace "‚" by "{\\c C}" in it with change all and cycle search
				replace "ƒ" by "{\\'E}" in it with change all and cycle search
				replace "„" by "{\\~N}" in it with change all and cycle search
				replace "…" by "{\\\"O}" in it with change all and cycle search
				replace "†" by "{\\\"U}" in it with change all and cycle search
				replace "‡" by "{\\'a}" in it with change all and cycle search
				replace "ˆ" by "{\\`a}" in it with change all and cycle search
				replace "‰" by "{\\^a}" in it with change all and cycle search
				replace "Š" by "{\\\"a}" in it with change all and cycle search
				replace "‹" by "{\\~a}" in it with change all and cycle search
				replace "Œ" by "{\\aa{}}" in it with change all and cycle search
				replace "" by "{\\c c}" in it with change all and cycle search
				replace "Ž" by "{\\'e}" in it with change all and cycle search
				replace "" by "{\\`e}" in it with change all and cycle search
				replace "" by "{\\^e}" in it with change all and cycle search
				replace "‘" by "{\\\"e}" in it with change all and cycle search
				replace "’" by "{\\'i}" in it with change all and cycle search
				replace "“" by "{\\`i}" in it with change all and cycle search
				replace "”" by "{\\^\\i}" in it with change all and cycle search
				replace "•" by "{\\\"i}" in it with change all and cycle search
				replace "–" by "{\\~n}" in it with change all and cycle search
				replace "—" by "{\\'o}" in it with change all and cycle search
				replace "˜" by "{\\`o}" in it with change all and cycle search
				replace "™" by "{\\^o}" in it with change all and cycle search
				replace "š" by "{\\\"o}" in it with change all and cycle search
				replace "›" by "{\\~o}" in it with change all and cycle search
				replace "œ" by "{\\'u}" in it with change all and cycle search
				replace "" by "{\\`u}" in it with change all and cycle search
				replace "ž" by "{\\^u}" in it with change all and cycle search
				replace "Ÿ" by "{\\\"u}" in it with change all and cycle search
				replace "§" by "{\\ss{}}" in it with change all and cycle search
				replace "®" by "{\\AE{}}" in it with change all and cycle search
				replace "¯" by "{\\O{}}" in it with change all and cycle search
				replace "º" by "\\int" in it with change all and cycle search
				replace "¾" by "{\\ae{}}" in it with change all and cycle search
				replace "¿" by "{\\o{}}" in it with change all and cycle search
				replace "Ë" by "{\\`A}" in it with change all and cycle search
				replace "Ì" by "{\\~A}" in it with change all and cycle search
				replace "Í" by "{\\~O}" in it with change all and cycle search
				replace "Î" by "{\\OE{}}" in it with change all and cycle search
				replace "Ï" by "{\\oe{}}" in it with change all and cycle search
				replace "Ø" by "{\\\"y}" in it with change all and cycle search
				replace "Ù" by "{\\\"Y}" in it with change all and cycle search
				replace "å" by "{\\^A}" in it with change all and cycle search
				replace "æ" by "{\\^E}" in it with change all and cycle search
				replace "ç" by "{\\'A}" in it with change all and cycle search
				replace "è" by "{\\\"E}" in it with change all and cycle search
				replace "é" by "{\\`E}" in it with change all and cycle search
				replace "ê" by "{\\'I}" in it with change all and cycle search
				replace "ë" by "{\\^I}" in it with change all and cycle search
				replace "ì" by "{\\\"I}" in it with change all and cycle search
				replace "í" by "{\\`I}" in it with change all and cycle search
				replace "î" by "{\\'O}" in it with change all and cycle search
				replace "ï" by "{\\^O}" in it with change all and cycle search
				replace "ñ" by "{\\`O}" in it with change all and cycle search
				replace "ò" by "{\\'U}" in it with change all and cycle search
				replace "ó" by "{\\^U}" in it with change all and cycle search
				replace "ô" by "{\\`U}" in it with change all and cycle search
				
			end tell
		end tell
		activate
	end tell
end run

%%% TexToMac.applescript

on run
	tell application "iTeXMac"
		tell its front TeX document
			tell its text
				replace "{\\\"A}" by "€" in it with change all and cycle search
				replace "{\\AA{}}" by "" in it with change all and cycle search
				replace "{\\c C}" by "‚" in it with change all and cycle search
				replace "{\\'E}" by "ƒ" in it with change all and cycle search
				replace "{\\~N}" by "„" in it with change all and cycle search
				replace "{\\\"O}" by "…" in it with change all and cycle search
				replace "{\\\"U}" by "†" in it with change all and cycle search
				replace "{\\'a}" by "‡" in it with change all and cycle search
				replace "{\\`a}" by "ˆ" in it with change all and cycle search
				replace "{\\^a}" by "‰" in it with change all and cycle search
				replace "{\\\"a}" by "Š" in it with change all and cycle search
				replace "{\\~a}" by "‹" in it with change all and cycle search
				replace "{\\aa{}}" by "Œ" in it with change all and cycle search
				replace "{\\c c}" by "" in it with change all and cycle search
				replace "{\\'e}" by "Ž" in it with change all and cycle search
				replace "{\\`e}" by "" in it with change all and cycle search
				replace "{\\^e}" by "" in it with change all and cycle search
				replace "{\\\"e}" by "‘" in it with change all and cycle search
				replace "{\\'i}" by "’" in it with change all and cycle search
				replace "{\\`i}" by "“" in it with change all and cycle search
				replace "{\\^i}" by "”" in it with change all and cycle search
				replace "{\\\"i}" by "•" in it with change all and cycle search
				replace "{\\~n}" by "–" in it with change all and cycle search
				replace "{\\'o}" by "—" in it with change all and cycle search
				replace "{\\`o}" by "˜" in it with change all and cycle search
				replace "{\\^o}" by "™" in it with change all and cycle search
				replace "{\\\"o}" by "š" in it with change all and cycle search
				replace "{\\~o}" by "›" in it with change all and cycle search
				replace "{\\'u}" by "œ" in it with change all and cycle search
				replace "{\\`u}" by "" in it with change all and cycle search
				replace "{\\^u}" by "ž" in it with change all and cycle search
				replace "{\\\"u}" by "Ÿ" in it with change all and cycle search
				replace "{\\ss{}}" by "§" in it with change all and cycle search
				replace "{\\AE{}}" by "®" in it with change all and cycle search
				replace "{\\ae{}}" by "¾" in it with change all and cycle search
				replace "{\\`A}" by "Ë" in it with change all and cycle search
				replace "{\\~A}" by "Ì" in it with change all and cycle search
				replace "{\\~O}" by "Í" in it with change all and cycle search
				replace "{\\OE{}}" by "Î" in it with change all and cycle search
				replace "{\\oe{}}" by "Ï" in it with change all and cycle search
				replace "{\\\"y}" by "Ø" in it with change all and cycle search
				replace "{\\\"Y}" by "Ù" in it with change all and cycle search
				replace "{\\^A}" by "å" in it with change all and cycle search
				replace "{\\^E}" by "æ" in it with change all and cycle search
				replace "{\\'A}" by "ç" in it with change all and cycle search
				replace "{\\\"E}" by "è" in it with change all and cycle search
				replace "{\\`E}" by "é" in it with change all and cycle search
				replace "{\\'I}" by "ê" in it with change all and cycle search
				replace "{\\^I}" by "ë" in it with change all and cycle search
				replace "{\\\"I}" by "ì" in it with change all and cycle search
				replace "{\\`I}" by "í" in it with change all and cycle search
				replace "{\\'O}" by "î" in it with change all and cycle search
				replace "{\\^O}" by "ï" in it with change all and cycle search
				replace "{\\`O}" by "ñ" in it with change all and cycle search
				replace "{\\'U}" by "ò" in it with change all and cycle search
				replace "{\\^U}" by "ó" in it with change all and cycle search
				replace "{\\`U}" by "ô" in it with change all and cycle search
				replace "\\\"A" by "€" in it with change all and cycle search
				replace "\\AA{}" by "" in it with change all and cycle search
				replace "\\c C" by "‚" in it with change all and cycle search
				replace "\\'E" by "ƒ" in it with change all and cycle search
				replace "\\~N" by "„" in it with change all and cycle search
				replace "\\\"O" by "…" in it with change all and cycle search
				replace "\\\"U" by "†" in it with change all and cycle search
				replace "\\'a" by "‡" in it with change all and cycle search
				replace "\\`a" by "ˆ" in it with change all and cycle search
				replace "\\^a" by "‰" in it with change all and cycle search
				replace "\\\"a" by "Š" in it with change all and cycle search
				replace "\\~a" by "‹" in it with change all and cycle search
				replace "\\aa{}" by "Œ" in it with change all and cycle search
				replace "\\c c" by "" in it with change all and cycle search
				replace "\\'e" by "Ž" in it with change all and cycle search
				replace "\\`e" by "" in it with change all and cycle search
				replace "\\^e" by "" in it with change all and cycle search
				replace "\\\"e" by "‘" in it with change all and cycle search
				replace "\\'i" by "’" in it with change all and cycle search
				replace "\\`i" by "“" in it with change all and cycle search
				replace "\\^i" by "”" in it with change all and cycle search
				replace "\\\"i" by "•" in it with change all and cycle search
				replace "\\~n" by "–" in it with change all and cycle search
				replace "\\'o" by "—" in it with change all and cycle search
				replace "\\`o" by "˜" in it with change all and cycle search
				replace "\\^o" by "™" in it with change all and cycle search
				replace "\\\"o" by "š" in it with change all and cycle search
				replace "\\~o" by "›" in it with change all and cycle search
				replace "\\'u" by "œ" in it with change all and cycle search
				replace "\\`u" by "" in it with change all and cycle search
				replace "\\^u" by "ž" in it with change all and cycle search
				replace "\\\"u" by "Ÿ" in it with change all and cycle search
				replace "\\ss{}" by "§" in it with change all and cycle search
				replace "\\AE{}" by "®" in it with change all and cycle search
				replace "\\ae{}" by "¾" in it with change all and cycle search
				replace "\\`A" by "Ë" in it with change all and cycle search
				replace "\\~A" by "Ì" in it with change all and cycle search
				replace "\\~O" by "Í" in it with change all and cycle search
				replace "\\OE{}" by "Î" in it with change all and cycle search
				replace "\\oe{}" by "Ï" in it with change all and cycle search
				replace "\\\"y" by "Ø" in it with change all and cycle search
				replace "\\\"Y" by "Ù" in it with change all and cycle search
				replace "\\^A" by "å" in it with change all and cycle search
				replace "\\^E" by "æ" in it with change all and cycle search
				replace "\\'A" by "ç" in it with change all and cycle search
				replace "\\\"E" by "è" in it with change all and cycle search
				replace "\\`E" by "é" in it with change all and cycle search
				replace "\\'I" by "ê" in it with change all and cycle search
				replace "\\^I" by "ë" in it with change all and cycle search
				replace "\\\"I" by "ì" in it with change all and cycle search
				replace "\\`I" by "í" in it with change all and cycle search
				replace "\\'O" by "î" in it with change all and cycle search
				replace "\\^O" by "ï" in it with change all and cycle search
				replace "\\`O" by "ñ" in it with change all and cycle search
				replace "\\'U" by "ò" in it with change all and cycle search
				replace "\\^U" by "ó" in it with change all and cycle search
				replace "\\`U" by "ô" in it with change all and cycle search
				replace "\\^{\\i}" by "”" in it with change all and cycle search
				replace "\\¬{\\i}" by "•" in it with change all and cycle search
			end tell
		end tell
		activate
	end tell
end run


Le 28 juil. 04, ˆ 13:23, Berndt Farwer a Žcrit :

> Hi!
>
> Are there any conversion scripts that convert special characters from 
> the Mac character set to LaTeX ASCII for platform independence? 
> Ideally I would like to call such script from within iTeXMac ...
>
> TIA, Berndt
>
> --------------------- Info ---------------------
> Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
>           & FAQ: http://latex.yauh.de/faq/
> TeX FAQ: http://www.tex.ac.uk/faq
> List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>
>
>

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the MacOSX-TeX mailing list