On Sat, Jun 29, 2013 at 9:07 PM, Andrew Parsloe <apars...@clear.net.nz>wrote:

> On 30/06/2013 4:29 a.m., stefano franchi wrote:
>
>>
>> Andrew, Liviu,
>>
>> I may a bit thick, but I can't see how to reduce the size of a Label
>> inset. 2 problems:
>>
>> 1. I cannot find an InsetLayout for labels.
>>
>> 2. Even if I could find it  what would I change the LabelString to?
>> Currently I see the full label name on screen . Say I have a long label:
>> "chap:This is the first chapter" And I want the inset to show only 2-3
>> chars max. What would LabelString be set to? The description in the
>> Customization manual is "terse" to say the least:
>>
>> "LabelString What will be displayed on the button or elsewhere as the
>> inset label. Some inset types (TeX code and Branch) modify this label on
>> the fly."
>> Good. And is it possible to somehow influence that modification "on the
>> fly"?
>>
>> Cheers,
>>
>> Stefano
>>
>>
> OK, I misunderstood the initial question. I too can't see cross-ref labels
> in stdinsets.inc, presumably because, as Scott indicated, they are
> hardcoded (there is a dialog associated with the inset). However, the
> tinkerer in me started thinking: why not put the label & cross-reference
> insets inside a custom inset with a short name ("lab" and "ref" for
> instance), using a command-sequence with shortcut keys to do this?
>
> Below, I've included a module (save in your personal LyX2.0/layouts
> folder, perhaps as short-inset-names.module) which provides custom insets
> showing the labels "lab" and "ref" when closed. For shortcut keys I've
> assigned
>
> Ctrl+Shift+L (L for Label) to: command-sequence label-insert; flex-insert
> Flex:ShortLabel
>
> Ctrl+Shift+K (K for Kross reference) to: command-sequence
> dialog-show-new-inset ref; flex-insert Flex:ShortXRef
>
> I also find it convenient to have a shortcut to jump out of these (and
> other) insets and close them:
>
> Ctrl+Shift+J (J for Jump) to: command-sequence line-end; char-right;
> toggle-inset
>
> On my keyboard these are conveniently adjacent keys, and the pinkie of my
> left hand easily slides onto and holds down Ctrl+Shift together. With these
> assignments, to insert the label LyX suggests do: Ctrl+Shift+L, Enter,
> Ctrl+Shift+J. (Inserting a reference to a label will generally also involve
> the arrow keys to select the right label, before the Enter.)
>
> If at some point you want to know what is hiding behind all those "lab"s
> and "ref"s, just go to View > Open All Insets or click on an individual one.
>
> Andrew
>
> #\DeclareLyXModule{**ShortInsetNames}
> #DescriptionBegin
> # Provides short-name wrappers to
> # put around verbose insets.
> #DescriptionEnd
> #
>
> Format 35
>
> AddToPreamble
>         \newcommand{\shortLyXname}[1]{**#1}
> EndPreamble
>
> InsetLayout Flex:ShortLabel
>   LyXType                       custom
>   LatexType                     command
>   LatexName                     shortLyXname
>   Decoration                    Classic
>   LabelFont
>         Color                   phantomtext
>   End
>   LabelString                   lab
>   Multipar                      0
>   PassThru                      0
> End
>
> InsetLayout Flex:ShortXRef
>   LyXType                       custom
>   LatexType                     command
>   LatexName                     shortLyXname
>   Decoration                    Classic
>   LabelFont
>         Color                   phantomtext
>   End
>   LabelString                   ref
>   Multipar                      0
>   PassThru                      0
> End
>
>
>
Very clever solution, Andrew.
I'm sorry to report, however, that I get exactly the same behavior as
before. For a label called, say, "chap:Foobar" I get a flex inset with
"chap:Foobar" as its label. The only difference with a regular label inset
is the inset's background color. I was expecting an inset with the "lab"
label, as per your code.

Cheers,

Stefano (who's got to learn this magic stuff about flex-insets one of these
days)

-- 
__________________________________________________
Stefano Franchi
Associate Research Professor
Department of Hispanic Studies            Ph:   +1 (979) 845-2125
Texas A&M University                          Fax:  +1 (979) 845-6421
College Station, Texas, USA

stef...@tamu.edu
http://stefano.cleinias.org

Reply via email to