Flexible text fields

Daniel xracoonx at gmx.de
Fri Jun 26 19:20:37 UTC 2020


On 2020-06-26 17:49, Richard Kimberly Heck wrote:
> On 6/26/20 3:35 AM, Jürgen Spitzmüller wrote:
>> Am Freitag, den 26.06.2020, 09:25 +0200 schrieb Jürgen Spitzmüller:
>>> Am Freitag, den 26.06.2020, 07:40 +0200 schrieb Daniel:
>>>> The upcoming flexible text fields sound very interesting to me
>>>>
>>>> (https://wiki.lyx.org/LyX/NewInLyX24#textfields). Is it possible
>>>> to
>>>>
>>>> create an arbitrary custom text with it that can be re-used in
>>>> sentences all over the document?
>>> No.
>> What you are referring to is a long-standing feature request (and I
>> would love to use it myself). I am not sure it fits into the text field
>> infrastructure (which is more like context-dependent information such
>> as date, file name, author name etc.), but probably more into something
>> you could call "text macros" in analogy to "math macros":
>> https://www.lyx.org/trac/ticket/1704
> 
> I dream about this one every once in a while but am not sure I am up to
> the challenge. I keep thinking there must be some way to adapt the math
> macro infrastructure to do it, though.
> 
> Riki

I guess a problem with the macro infrastructure is that it relies on 
defining a LaTeX command. But in contrast to LyX's math mode, its text 
mode does not understand LaTeX commands. So, I think a better approach 
would be along the bookmarks & cross-references feature in Writer and Word.

1. In order to create the bookmark, you select a text piece, click on 
Bookmark..., and give it a label.

2. In order to insert the cross-reference to the bookmark, you just 
click on Cross-reference... and select the bookmark-label.

Writer and Word show the actual text from the bookmark with a gray 
background which is very handy for reading too. Word inserts the 
bookmark as it is formatted (font, color, etc.) while Writer just 
inserts the plain text (which can be formatted as a whole). But it seems 
LyX style would be to show the label-name. Might be a performance issue 
(at least for now). In that regard, Writer updates the cross-references 
automatically as one changes the bookmark, while Word only on the 
"update fields" command. (I guess that "fields" are at play here might 
have been what triggered my association with LyX's new fields.)

Daniel



More information about the lyx-users mailing list