Flexible text fields

Daniel xracoonx at gmx.de
Sat Jun 27 04:35:14 UTC 2020

On 2020-06-26 21:20, Daniel wrote:
> 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.)

I just noticed that Word (but not Writer) supports even creating a 
bookmark from a table and other complex elements. So, one needs to 
create a table only at one place and can easily repeat it later. That's 
very nice!

I guess having the format inserted might not always be the best. For 
example, if a term that is emphasized where it is defined and then 
re-used later where it should not be emphasized. So, it would be nice to 
have the option to re-use with or without formatting.

Maybe I was too quick to dismiss the idea that the macro (similar) 
infrastructure could be used. I guess one could have two fields, one for 
the plain name of the definition (which replaces the LaTeX command) and 
one for some LyX snippet (like the Advanced Find and Search snippet 
which replaces the math inset). I guess that was Riki's idea.

But then the plain name will go to the list of cross-references from 
where it could be inserted. I kind of like the way the bookmarks are 
just part of the text in Word (and Writer) but that might fit well into 
LyX's (current) infrastructure.


More information about the lyx-users mailing list