Jim Osborn wrote:

> Is there any way to mangle an ascii file to tell LyX that the three
> periods it finds in the imported text should be treated as ldots?

No. No interpretation of the ascii text is performed at all.

> The best I've come up with is a post-importation treatment, binding
> the following to a key:
> 
>   "command-sequence word-find-forward ...; cut; dots-insert"
> 
> and then repeatedly hitting that key on the imported text.
> 
> If I could hack the ascii beforehand with sed, it'd be a lot easier.

Would be nice, but it just ends up as:

Here is some text \SpecialChar \ldots{}
Foo bar.

which isn't very useful ;-)

> I haven't found a way to enter the ldots (bound to M-period on my
> keyboard) into the Search/Find/Replace popup.  If I could, then at
> least I could use its Replace-All button to do the job simply.

Something for the future.
> 
> Is there a way to do a "Replace-All" equivalent in a command
> sequence? Any other suggestions to simplify the process?

Why not treat the ascii file as a latex file:
$ cat test.txt
Here is some text ... Foo bar.

$ sed 's/\.\.\./ \\ldots{} /g' test.txt > test.tex
$ cat test.tex
Here is some text  \ldots{}  Foo bar.

$ reLyX -c article -p -f test.tex
$ cat test.lyx

\layout Standard

Here is some text
\SpecialChar \ldots{}
 Foo bar.
\the_end


>From the reLyX man page:
       -p  Partial file. The input files are LaTeX fragments, 
           with no preamblematter or \begin{document} commands.
           This option requires the -c option, since there are
           no \documentclass commands in the files reLyX is
           translating. When using this option, you can translate
           more than one file, as long as all files are the same
           class. The LyX file created by reLyX can be included
           in an existing LyX file using the "Include LyX File"
           command from LyX's Insert menu.

However, to do so properly, (ie, to load the file rather than just a 
grey button pointing to it.), you'll have to turn this snippet into a 
proper lyx file by prepending something like 'preamble.lyx', 
attached.

$ cp preamble.lyx snippet.lyx
$ cat test.lyx >> snippet.lyx

You definitely *can* insert snippet.lyx into your document (using the 
"load" button on the include file dialog.

The above does seem rather convoluted, but you could wrap it all up in 
a script and then forget about it.

Regards,
-- 
Angus

Attachment: preamble.lyx
Description: application/lyx

Reply via email to