LYX 2.4.2.1 — Problem with \label and \ref mechanism

didiergabory at free.fr didiergabory at free.fr
Sun Oct 20 14:24:29 UTC 2024


I'd like to give you this example of a module that I'm having trouble finalizing... Because I have to admit, I'm having a really hard time understanding the documentation... 

I've created a new environment in which I'm placing python code using the listings package... 


I'd like to use the cross-reference mechanism... I've created a new counter, used the \refstepcounter command, placed the \label and \ref commands in the document... It works on the pdf output... But the indication (see attached screenshot) in the LYX window is incorrect - the designated counter refers to the section counter... And not to the ‘code’ counter I created... What's wrong with the way I'm doing things? 

I have a second request: Is it possible to display the counter number in the label above the frame of each occurrence in the LyX document ? In other words, ‘Python Code i’ rather than the simple ‘Python Code’ label. 

In the body module: 
InsetLayout Flex:Python 
LabelString ‘Python Code \thecode’ Doesn't work... 

Thanks to anyone willing to give me some of their time. 

All the best. 


LXY 2.4.2.1 on windows10-64 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lyx.org/pipermail/lyx-users/attachments/20241020/1cca759d/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: logoPython2.png
Type: image/png
Size: 114093 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-users/attachments/20241020/1cca759d/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MWE.module
Type: application/octet-stream
Size: 2042 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-users/attachments/20241020/1cca759d/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MWE.lyx
Type: application/x-lyx
Size: 9298 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-users/attachments/20241020/1cca759d/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MWE.pdf
Type: application/pdf
Size: 153821 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-users/attachments/20241020/1cca759d/attachment-0001.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: label&ref problem.PNG
Type: image/png
Size: 29378 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-users/attachments/20241020/1cca759d/attachment-0003.png>


More information about the lyx-users mailing list