# Re: Proposal for UI enhancement: ticket #1624

On Tue, Sep 24, 2019 at 04:19:48PM +0200, Andreas Nicolai wrote:
> Hi and hello everyone,
>
> first of all, I'm a great fan of Lyx and I use it for my productive work
> since many years! Thanks for all the work you've put into.

and for volunteering to work on it!

> One feature I am missing for some time already is discussed in ticket
> https://www.lyx.org/trac/ticket/1624
>
> It is about streamlining the "cross-reference" workflow.
>
> When writing a document often you think about referencing a
> section/table/image, but haven't created a label there yet. So the
> workflow right now involves:
>
> - click on "create reference" button
> - in dialog get dissappointed: no desired label yet -> close dialog
> - lookup section/image/table (usually involves a lot of scrolling)
> - click on the right spot
> - click on the "create label" button (or use shortcut)
> - scroll back to insert position
> - re-open dialog for inserting cross reference
> - look-up and select label in dialog and finally create cross-reference
>
>
> I would like to contribute an improvement on this workflow:
>
> Proposed improvement:
>
> - open cross-reference dialog
> - select section/subsection/image/table etc.
> - if label exists already, choose this label -> otherwise create a new label
> - create cross-reference
>
>
> UI design/implementation ideas:
>
> 1. Button and sub-dialog approach:
> - add a button on the dialog "Create label"
> - sub-dialog opens and allows selecting existing
> sections/subections/images/tables in a tree-view or filtered list-view
> (with combo-box filter)
> - if a label exists for this section -> close dialog using button
> "Select label"

It feels like there's an inconsistency here. At this point, the user has
clicked on "Create label". But for this situation (the label already
exists), there is no label that is created. I wonder if "Cancel" would
be the correct choice by the user if they want to use a label that's
already been created. Alternatively, perhaps my concern would be
addressed by renaming "Create label" to something else (I don't
currently have a suggestion).

> - if no such label exist, enter/adjust suggested label name in line edit
> -> close dialog using button "Create and select"-button

Makes sense.

> - in cross-reference dialog update list of labels and select newly
> created/selected label

Why do we need this step? i.e., why not directly insert the label just
created? I'm guessing it is because the user might want to change
something else in the cross-reference dialog, such as the "Reference
Format", but I just wanted to check that that's what you have in mind.

> - create cross-reference as before
>
>
> 2. "switch selection list"-appraoch:
> This facilitates also the approach when users are not 100% sure which
> section to reference right now or when the choosen labels are not 100%
> clear in what they describe. In such cases the document structure and
> section captions can be a better way to select labels.
>
> Idea: the cross-reference dialog has two selection modes:
> a) as before, a groupable, filter-able list of existing labels
> b) a groupable list of all existing sections/subsections/images/tables,
> with highlighting (bold-face) for all list items that have already
> labels defined
>
> User can switch between both views via
>
> When in mode b), user can click on a list view item.
>
> If it has already a label, the user can continue as in the current
> functionality. The label text is shown in a line edit below the list
> view (that is read-only in this case).
>
> If the selected item does not yet have a label associated, the read-only
> line edit becomes enabled, a default label text is composed (as in the
> "create label" dialog) and the button: create-label is enabled.
>
> User can click on the create label button and after a uniqueness check,
> the label is created in the respective section, image, table. The list
> view is then updated and the item with the newly created label (now also
> in bold-face) is selected. Then continue as above.
>
>
> What would be your favourite design? I personally like variant 2)
> better, but the first one is less intrusive (I wouldn't have to change
> as much existing code as for variant 2). But then again, besides a
> little reorganisation in ui/CreateRef.ui, it is probably not much to change.
>
>
>
> Right now I'm still investigating the code and trying to figure out how
> to modify the buffer correctly.

Interesting ideas! Just to be clear, instead of "images" I think you
mean "figure floats". And perhaps instead of "figures/tables" we can
generalize to "floats". I don't understand variant 2 well. I would
suggest waiting until another dev comes along and gives a strong signal
for you to go forward spending more time on this.

An extension that might be worth talking about later: currently, does
LyX know how to add a label for different layouts? It might, I don't
know. In any case, perhaps we would need some layout tag that would tell
LyX how to add the label. For example, if a user creates a new layout
how does LyX know where to put the \label command? Should it put it in
one of the arguments or in the main chunk? I don't know much about
LaTeX. Perhaps this isn't needed at all.

Best,

Scott


signature.asc
Description: PGP signature