David Soukal wrote:
> Hello,
>
> I was wondering whether it is possible to paste a well-formated fragment
> of LaTeX code from clipboard into an open document in such a way that
> LyX interprets the LaTeX code being inserted? The standard "paste"
> command will, of course, treat the content as a regular piece of text,
> but I'd like to paste the text interpreted.
>
> I realize it's possible to import the whole document and then copy the
> fragments from the LyX, but it would come in handy to have the option to
> paste only pieces of LaTeX code without having to do anything else.
>
> Thanks for any hints.
> David
You can do this for mathed but not for the rest of LyX. Eg, typing as
normal text "$a=b+c$" (without quotes), highlighting the block and
selecting Insert->Math->Display Formula will convert the code into a
mathed inset.
> ps. The reason why I'm asking this is that I'm importing a LaTeX
> document from a co-author of our paper. He defined simple command \fp{}
> which is a synonym for \textcolor{red}{}. The author did that for two
> purposes: 1) to save some keystrokes :), and 2) to mark the portions of
> text that were updated by him.
>
> While LyX imports the document fine, it doesn't interpret the \fp{}
> command but inserts the \fp{} blocks as ERT boxes which makes half of
> the document uninterpreted and very hardly editable.
If LyX interprets \textcolor{red}{} as you'd like, why not add a
pre-processor step to your conversion. Something like (untested):
$ sed 's/\\fp{}/\\textcolor{red}{}/g' input.tex > output.tex
$ diff -u input.tex output.tex
--
Angus