LyxFun questions

Matthew Bandy matthew.bandy at gmail.com
Sat Apr 1 17:32:16 UTC 2023


On Sat, Apr 1, 2023 at 10:47 AM Richard Kimberly Heck <rikiheck at gmail.com>
wrote:

> On 3/31/23 17:30, Matthew Bandy wrote:
>
> Dear fellow Lyx enthusiasts -
>
> I am developing some scripts that automate table creation in Lyx based on
> database queries. I'm using lyxserver, but I am running into some issues.
> Please help!
>
> The following commands will insert a 1x2 table and populate the first cell
> with some text and the second with a graphics inset.
>
> LYXCMD:copilot:tabular-insert:1 2
> LYXCMD:copilot:repeat:2 char-left
> LYXCMD:copilot:self-insert:Here is some text
> LYXCMD:copilot:char-right:
> LYXCMD:copilot:inset-apply:graphics filename photo.png
>
> I need to modify the properties of the graphics inset, let's say to set
> the width at 3 inches. I can't figure out how to either 1) apply more than
> one property (filename, width, lyxscale, etc) when the inset is created
>
> The way to find this out is the open the Messages pane and activate the
> "action" messages. Then you can see the actual dispatch messages being
> produced on the fly. In this case, you just enter the extra arguments as
> well, e.g.:
>
> graphics filename graphics/HeadShot-200.jpg scale 80 clip
>
> The pane shows these as on new lines, but I don't think that's required.
> (I hope not.)
>
> 2) change the properties after the inset is already in place.
>
> inset-apply will modify an inset. It's just an alias to inset-modify or
> inset-insert, depending. So you could just use inset-modify, too. See Help>
> LyX Functions for the details.
>
> Riki
>

Thanks, Riki -

It turns out that the order of the arguments is important. Specifically,
filename has to come last. So:

 LYXCMD:copilot:inset-apply:graphics width "3in" lyxscale 50 filename
photo.png

.... works, while

LYXCMD:copilot:inset-apply:graphics filename photo.png width "3in" lyxscale
50

... does not. I really wish this stuff were documented somewhere...

Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lyx.org/pipermail/lyx-users/attachments/20230401/af1aca7f/attachment.html>


More information about the lyx-users mailing list