[OS X TeX] Re: Preparing large non-tex text for use in latex

Joachim Kock jkock at gmx.com
Sat Jul 2 10:03:23 CEST 2011


Hi Bobby,

Alpha has a nice functionality called "filters" for this sort of
purpose.

[In case you wonder whether Alpha still exists, the answer is yes,
and the release of AlphaX 8.2 is imminent, as far as I understand.
The current version, 8.2rc2, can be downloaded from
http://bdesgraupes.pagesperso-orange.fr/alphabinaries.html]

A filter is just a list of search-and-replace patterns, possibly
regexp, case insensitive, etc.  The predefined filters are found in
the Filters Menu (which has to be turned on in the preferences),
and can be applied to any selection, window, file, folder or fileset.
There is also a menu item called "New Filter", and it is very easy
to define a new one (which will then turn up in the menu):

It is just a plain text file in which each line holds a search-
and-replace pattern, represented as a tab-separated list of three
items: a search string, a replace string, and a type specifier, for
example 1 for regexp.  If the last field is omitted it means literal
search.  (Leading "!!" means comment.)

Here is an example meant to implement what you ask for:


!! Filter for fixing tex quotes
'\m	`	1
"\m	``	1
''\m	``	1
"	''
‘	`
’	'
“	``
”	''
```	``\,`
'''	'\,''

§	\S\
\\?&	\\\&	1
\\?\$	\\$	1


(The last two lines are such that the backslash will be added only if
there is not already one.  This ensures that the filter is stable in
the sense that applying it twice is the same as applying it once.)

(Alpha's predefined filters are mostly concerned with transformation
of accents, to and from tex, HTML, RTF, etc.)

Cheers,
Joachim.




More information about the macostex-archives mailing list