Discussion:
Subfigures: \subref support?
Diego Queiroz
2011-05-09 04:24:00 UTC
Permalink
LyX 2.0 supports \subref command without ERT? (I want to cross-reference a
subfigure inside the figure environment)

If so, how do I insert it?


Thanks,
---
Diego Queiroz
Diego Queiroz
2011-05-10 18:06:17 UTC
Permalink
Post by Diego Queiroz
LyX 2.0 supports \subref command without ERT? (I want to cross-reference a
subfigure inside the figure environment)
If so, how do I insert it?
Thanks,
---
Diego Queiroz
No answers? :-(
Currently I am using ERT and it solved my problem.

But can someone confirm if lyX really doesn't support this feature at all?

Regards,
---
Diego Queiroz
BH
2011-05-10 18:31:55 UTC
Permalink
Post by Diego Queiroz
Post by Diego Queiroz
LyX 2.0 supports \subref command without ERT? (I want to cross-reference a
subfigure inside the figure environment)
If so, how do I insert it?
Thanks,
---
Diego Queiroz
No answers? :-(
Currently I am using ERT and it solved my problem.
But can someone confirm if lyX really doesn't support this feature at all?
It's not hard. See attached example (for which you won't, of course,
have access to my images, but that doesn't matter).

BH
Julien Rioux
2011-05-10 18:39:55 UTC
Permalink
Post by Diego Queiroz
Post by Diego Queiroz
LyX 2.0 supports \subref command without ERT? (I want to cross-reference a
subfigure inside the figure environment)
If so, how do I insert it?
Thanks,
---
Diego Queiroz
No answers? :-(
Currently I am using ERT and it solved my problem.
But can someone confirm if lyX really doesn't support this feature at all?
Regards,
---
Diego Queiroz
Maybe because it's not really clear what does not work? I can put labels
in the subfigures and reference them elsewhere and they appear as 1a,
1b, etc.
--
Julien
Diego Queiroz
2011-05-10 19:09:55 UTC
Permalink
Thanks for the answers.

But I think I wasn't clear.
I want to use the \subref command not the \ref one (supported by default on
LyX).
The difference between them is that \ref produces "1a" while \subref
produces only "a".

I need to cite subfigures in the caption of the main float.

Example.:
Fig(a) --- Fig(b)
Figure 1: Here you see some figure (a) and another figure (b).

Got it?

But now I'm almost sure LyX really doesn't really support it.
If so, this is another good (and simple) improvement for LyX 2.1. :-)


Cheers,
---
Diego Queiroz
BH
2011-05-10 19:22:04 UTC
Permalink
Post by Diego Queiroz
Thanks for the answers.
But I think I wasn't clear.
I want to use the \subref command not the \ref one (supported by default on
LyX).
The difference between them is that \ref produces "1a" while \subref
produces only "a".
I need to cite subfigures in the caption of the main float.
Fig(a) --- Fig(b)
Figure 1: Here you see some figure (a) and another figure (b).
Got it?
But now I'm almost sure LyX really doesn't really support it.
If so, this is another good (and simple) improvement for LyX 2.1. :-)
Isn't this precisely what I gave you in the sample file? (I didn't put
the cross-reference in the figure caption, but that's trivial.)

In short, LyX supports it and makes it easy.

BH
Diego Queiroz
2011-05-10 20:39:13 UTC
Permalink
Post by BH
Isn't this precisely what I gave you in the sample file? (I didn't put
the cross-reference in the figure caption, but that's trivial.)
In short, LyX supports it and makes it easy.
BH
Not really.
The file you gave me generate "1a", "1b"... as expected for a output in the
text.
What I want is just "a", "b" (without the number 1).


Cheers,
---
Diego Queiroz
Julien Rioux
2011-05-11 06:08:16 UTC
Permalink
Post by Diego Queiroz
Thanks for the answers.
But I think I wasn't clear.
I want to use the \subref command not the \ref one (supported by default on
LyX).
The difference between them is that \ref produces "1a" while \subref
produces only "a".
I need to cite subfigures in the caption of the main float.
Fig(a) --- Fig(b)
Figure 1: Here you see some figure (a) and another figure (b).
Got it?
But now I'm almost sure LyX really doesn't really support it.
If so, this is another good (and simple) improvement for LyX 2.1. :-)
Cheers,
---
Diego Queiroz
Unfortunately no it is not supported and moreover the macro \subref
conflicts with the use of refstyle which was implemented in 2.0 (in this
case \subref is a reference to a subsection and yields "subsection 1.1").

So you will have to type "a" yourself or use TeX code.

Cheers,
Julien
Diego Queiroz
2011-05-11 07:16:05 UTC
Permalink
Post by Julien Rioux
Unfortunately no it is not supported and moreover the macro \subref
conflicts with the use of refstyle which was implemented in 2.0 (in this
case \subref is a reference to a subsection and yields "subsection 1.1").
So you will have to type "a" yourself or use TeX code.
Are you sure? As stated before, I already solved the problem using ERT.
No conflicts a all.
Julien Rioux
2011-05-11 13:14:57 UTC
Permalink
Post by Diego Queiroz
Post by Julien Rioux
Unfortunately no it is not supported and moreover the macro \subref
conflicts with the use of refstyle which was implemented in 2.0 (in this
case \subref is a reference to a subsection and yields "subsection 1.1").
So you will have to type "a" yourself or use TeX code.
Are you sure? As stated before, I already solved the problem using ERT.
No conflicts a all.
Yes I'm sure.

- Have a label "sub:mysection" in a subsection.
- Insert a reference to it using <Formatted reference> format.
- Make sure refstyle is used instead of prettyref (this is changed in
document settings> Document class ; refstyle is the default for new docs)

So far all this works. LyX generates \subref{mysection}, which is the
refstyle syntax for that.

Now if you also use a subfloat within a float you get a conflict.
Because subfloat also defines a \subref macro. The conflict is silent...
but you get [??] in output.

Avoid this combination and you're safe.

Cheers,
Julien
Diego Queiroz
2011-05-11 13:35:00 UTC
Permalink
Post by Julien Rioux
Yes I'm sure.
Yeah, you are right. But this is a LyX bug. It should use a not-so-obvious
name for the command to prevent a conflict like this.
However, the command \subref is defined by LyX only when you use the
<Formatted reference>. Since I don't use this type of cross-reference, there
is no problem with my ERT.

I'll create a ticket for this.

Cheers,
---
Diego Queiroz
Diego Queiroz
2011-05-11 16:39:47 UTC
Permalink
Here is the ticket for this problem.

http://www.lyx.org/trac/ticket/7550

<http://www.lyx.org/trac/ticket/7550>
---
Diego Queiroz
Post by Julien Rioux
Yes I'm sure.
Yeah, you are right. But this is a LyX bug. It should use a not-so-obvious
name for the command to prevent a conflict like this.
However, the command \subref is defined by LyX only when you use the
<Formatted reference>. Since I don't use this type of cross-reference, there
is no problem with my ERT.
I'll create a ticket for this.
Cheers,
---
Diego Queiroz
Julien Rioux
2011-05-16 16:01:01 UTC
Permalink
Post by Diego Queiroz
Here is the ticket for this problem.
http://www.lyx.org/trac/ticket/7550
<http://www.lyx.org/trac/ticket/7550>
---
Diego Queiroz
Post by Julien Rioux
Yes I'm sure.
Yeah, you are right. But this is a LyX bug. It should use a not-so-obvious
name for the command to prevent a conflict like this.
However, the command \subref is defined by LyX only when you use the
<Formatted reference>. Since I don't use this type of cross-reference, there
is no problem with my ERT.
I'll create a ticket for this.
Cheers,
---
Diego Queiroz
Thanks
--
Julien
Aidin
2012-07-02 19:01:57 UTC
Permalink
Post by Diego Queiroz
Post by Diego Queiroz
Here is the ticket for this problem.
http://www.lyx.org/trac/ticket/7550
<http://www.lyx.org/trac/ticket/7550>
---
Diego Queiroz
On Wed, May 11, 2011 at 10:35 AM, Diego Queiroz<queiroz.diego <at>
Post by Julien Rioux
Yes I'm sure.
Yeah, you are right. But this is a LyX bug. It should use a not-so-obvious
name for the command to prevent a conflict like this.
However, the command \subref is defined by LyX only when you use the
<Formatted reference>. Since I don't use this type of cross-reference, there
is no problem with my ERT.
I'll create a ticket for this.
Cheers,
---
Diego Queiroz
Thanks
Hello all,

The info above is quite useful. However, for some reason I can't even get it to
work with an ERT. (I'm new to LyX, so sorry if I'm making an obvious mistake)



The part of the latex code related to the caption with the ERT code inside is:

\caption{Some text.\subref{fig:Single Point 2D Trajectory with Uncertainty
Ellipsoid}
This is a subfig}
\end{figure}


Basically I get bracket mismatch errors.
----------------------------------------------
This is a subfig}

I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
-------------------------
This is a subfig}

I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.

----------------------------------------------

Thanks,
Aidin
Uwe Stöhr
2012-07-08 18:34:25 UTC
Permalink
Post by Aidin
The info above is quite useful. However, for some reason I can't even get it to
work with an ERT. (I'm new to LyX, so sorry if I'm making an obvious mistake)
I think you cannot do much because of the bug in LyX. (I just posted a patch to fix this for the
next LyX version.)

The only clean solution is to go to the document settings and uncheck there the option to use
refstyle. LyX will then use prettyref as package for formatted references. This package has some
limitations compared to refstyle but might work for you.

regards Uwe

Loading...