I must admit that I haven't followed this thread much, so take this for what it's worth.

When doing a find/replace on math entries, I simply open the original LyX document in a text editor and then do a search/replace as appropriate. Then re-open in LyX. This works much better than export to LaTeX and re-import to LyX since that often produces many ERT boxes... However, using this approach, one should back up your original LyX document in case you accidentally break it when editing externally.

James


On Dec 6, 2008, at 7:23 AM, Erez Yerushalmi wrote:

Hi Tommaso,

Thanks for your mail, and for the time you spent writing it!

LyX is really a good tool for me, especially because I have
horrible/unorganized writing.
So, I actually work-out all the math directly with LyX.

What I liked about your video was that I could "find and replace" math. Sometimes/many times, I change my mind and decide to call a parameter with a
different name.
But LyX 1.6 doesn't seem to be able (yet) to do it.
I have no problems with actual text, just the math.

Is it true, like others on the forum had said, that this feature will be
incorporated into LyX 2 ver?  I hope so.

This is the main reason why I need to export, then find and replace.

So, thanks for your mail,

Regards,  Erez


On Fri, Dec 5, 2008 at 2:58 PM, Cucinotta Tommaso <[EMAIL PROTECTED]>wrote:

On Wed, 3 Dec 2008 21:57:33 +0000
"Erez Yerushalmi" <[EMAIL PROTECTED]> wrote:

Hi JMarc,

Thanks for your answer!
Is it you in youtube??? :-)


Actually, it's me, hope you could get at least a few words out of what I
say :-)

The easiest option at the moment to find and replace would be to export as
latex into an editor, and find and replace y_{1t}  into x_{1t}. Then
import
it again.


If you really want it, you can write a script that
exports to latex, invokes your favorite text editor,
then imports back to lyx. But LyX is not designed
for such purpose, as pointed out by core developers,
therefore the process is likely to fail because lyx cannot manage to parse all of the latex stuff that you can ever write, the tex2lyx process is lossy and non-perfectly-reversable, and you can make a mistake (most common is
unmatched parenthesis or $ in maths) and then all blows up.

This is the same rationale for which I like LyX how it is now, it
(theoretically / ideally) does not allow you to make LaTeX mistakes, because everything you enter into LyX is "syntactically correct", except if you use
(at your own risk) ERT blocks.

If LyX is an editor for Latex, why don't we have a special button that
enables us to switch from "regular" LyX view to a "programing" editor
view?


Use View->Source, I use it for "didactic" purposes, while writing pure LaTeX with Emacs, when I can't remember how you can do certain constructs.

Then, I would find and replace like I will do now in a programming editor.


... and you would end up into the usual compilation errors that you are so accustomed to (see above) ... I don't think that editing a text file should imply being an expert of any syntax but it's just a view of the world ...

Another side benefit would be that it actually helps us to understand what
underlying latex commands were actually used in LyX, which would bring me
back to the basics, closer to the LyX/Latex idea.


View->Source again, here

What do you say??


As of the current code status, it would not be too difficult to incorporate a "replace" option, where you could be able to enter the text to replace in yet another LyX-enabled WorkArea: the matching text is already selected, so it is just a matter of cutting it from the document (I'm sure there is some LFUN for that), plus pasting the replacement text like if we were pasting from the clipboard (I'm sure there should be some LFUN for doing almost this as well). As a quick hack, one could temporarily copy the replacement text
into the clipboard, just to get fast to a "proof of concept".

Actually, some people would love to redesign the entire feature (including myself), but nobody has time, so maybe I'll work to the quick hack for the
replace, one of these days, maybe while flying ...
... replacing with regexp-enabled for back-references may be more complex
to realise ...

My 2 cents,

T.




--
Erez Yerushalmi
PhD Student
Warwick University, UK
http://www2.warwick.ac.uk/fac/soc/economics/research/phds/3rd_year/yerushalmi

Reply via email to