On Wed, May 15, 2019 at 2:41 PM Helge Hafting <helge.haft...@ntnu.no> wrote:
> >
> > I have a large document where I have many lines that are only
> >
> > @@
> >
> > Now, I want to insert all lines between two consecutive lines of @@
> > into a minipage. Can one do that automatically and not one by one?
>
> Not to my knowledge, no.
>
> Advanced search & replace lets you search for and/or replace stuff that
> isn't only normal text. So you can replace an image with another. You
> can search for & replace math formulas. You may also replace "@@" with a
> minipage.
>
> But if I understand correctly, you want to search for:
>
> @@
>
> some
>
> lines
>
> @@
>
> and have it replaced with:
>
> ---start minipage--
>
> some
>
> lines
>
> ---end minipage--
>
>
> And you want this to happen several times through your document, where
> the exact contents of "some lines" vary. This is not possible.  You may
> only search for fixed content, not variable. So you can search for
>
> @@
>
> some
>
> lines
>
> @@
>
> But such a search will only match exactly, you can't get it to also match
>
> @@
>
> other
>
> lines
>
> @@
>
> And I guess that is what you wanted?
>
>
> LyX lets you mark "some lines", you can then Insert->Box->Simple Frame
> and get your lines inside a minipage. And then repeat this mark & insert
> operation for all other occurences.
>
> If you want to automate this, consider taking advantage of the fact that
> a LyX file is a kind of text file. Software that deals with text (sed,
> awk, or many others) may be able to do what you want. And if there are
> hundreds of cases, writing a one-off program to do this may pay off.
> (Pay off in that it may be faster than editing it all by hand.)
> Otherwise, or if you aren't into programming, just edit manually.

Thanks, Helge. Indeed, I want to automate the procedure you describe
in your penultimate paragraph. And, as you suggest, I will try to
accomplish that by writing a program, as I have dozens of minipages to
insert.

Paul

Reply via email to