On 09/13/2018 05:31 AM, Klaus-Dieter Bauer wrote:
> Hello!
>
> Is there any way wiith LyX's current customization/module interface to
> add support for the cleveref package's \cref{LABEL} command?
>
> The easiest form I can come up with would be an inset style, that is
> exported as \cref{...}, and using the "label-only" setting of the
> Insert -> Cross-Reference dialog. This approach is however cumbersome
> in two important ways:
>
>   * It requires adding insert in label in two separate steps.
>   * When using tex2lyx, the \cref inset would be correctly created,
>     but the label would be inserted as plain-text instead of a
>     cross-reference object.
>
> Hence I am looking for a better solution.

Obviously, the best option would be to add native support for cleveref.
This would not be difficult. We already support prettyref and refstyle,
so it would just be one more option for how "formatted" references are
output. Feel free to file an enhancement request (cc'ing me), but it is
a format change so will not happen until 2.4.0.

For now, if all you want is \cref *and do not want to use other types of
formatted references*, then you can do this. In Document Settings:

1. Under Document Class, uncheck "Use refstyle"(so you use prettyref).
2. In the LaTeX preamble:
    \usepakcage{cleveref}
    \let\prettyref\cref
3. In Local Layout:
    Provides prettyref 1

An ugly hack, but it should work. I.e., 'formatted' references are not
se by cleveref. (The last prevents LyX from loading prettyref.)

Riki


Reply via email to