Skip to main content
Participating Frequently
December 21, 2017
Answered

Cross reference figures with short form fig.

  • December 21, 2017
  • 1 reply
  • 1539 views

Hi everybody,

I've been reading how to cross-reference figures in the document. I've been using bullets & numbering in the paragraph style to sequence my figures. I found out how to cross-reference them.

BUT the problem is that my figure in the article appears as "figure 1", but when I want to refer to them within the article I want to use "fig.1" instead of "figure 1". I found the "partial paragraph" function inside the cross-reference function, but what I want is not exactly that, as it has a dot behind the "fig". Can anyone please advise what can be done to archive this?

Thanks a lot!

    This topic has been closed for replies.
    Correct answer vinny38

    Hi

    You could use a Grep style to partially hide some text.

    First set a character style called e.g. "invisible". Set font-size: 0.1pt, tracking: -1000pt and color: none.

    Then, in your cross-reference definition, type Fig. <fullPara>

    At this point, you'd end-up with a cross-reference that shows "Fig. Figure 1 Your text"

    So all you have to do is to hide Figure (and a space)

    Use Grep style to apply "invisible" character style to (?<=Fig.)\sFigure.

    You should be done.

    Vinny

    1 reply

    vinny38
    vinny38Correct answer
    Legend
    December 21, 2017

    Hi

    You could use a Grep style to partially hide some text.

    First set a character style called e.g. "invisible". Set font-size: 0.1pt, tracking: -1000pt and color: none.

    Then, in your cross-reference definition, type Fig. <fullPara>

    At this point, you'd end-up with a cross-reference that shows "Fig. Figure 1 Your text"

    So all you have to do is to hide Figure (and a space)

    Use Grep style to apply "invisible" character style to (?<=Fig.)\sFigure.

    You should be done.

    Vinny

    Participating Frequently
    December 21, 2017

    Hi Vinny,

    Thanks a lot! It worked! Just that now there is a strange space in between the "fig." and "the number. I tried deleting the space in the cross-reference setup to this Fig.<fullPara>, but once I delete that space the Grep doesn't work? Would really appreciate if you can shade a light on this one.

    Thanks!

    Participating Frequently
    December 27, 2017

    Hi!

    OK I haven't read carefully your request. I see now that you don't want the space after fig.

    Piece of cake ^^

    So, first, remove the space after fig. in the cross-reference formats panel. Actually it wasn't even necessary in the first place.

    Now you want the Grep style to catch Figure+space.

    Set it this way:

    (?<=fig\.)Figure\s

    For your information (?<=) is the positive lookbehind regex. Meaning that (?<=xxx)yyy means that you want to catch yyy if it's immediately placed after xxx

    fig\. means fig followed by a stop.

    \s means any space.

    Got it right now?

    Vinny


    Hi Vinny!

    It's working now! Great! Thanks a lot for your detailed explanation!!