3

I am using to write an rnwfile. In my lyx text, I would like to reference a figure generated by a code chunk that has label "chunk1".

If I write the rnw in Rstudio, I would reference the figure by \ref{fig:chunk1} in my text. However in lyx, the label "chunk1" or "fig:chunk1" does not appear in the cross-Reference window.

Can anyone help me with this? Thanks a lot!

J. Chomel
  • 8,193
  • 15
  • 41
  • 69
Jing
  • 31
  • 2
  • Hi Jing, welcome to SO. You should consider posting the code you used, it will be easier to understand what you did and where the mistakes are. – J. Chomel May 19 '16 at 08:14
  • You can put `\ref{fig:chunk1}` in ERT in LyX – scottkosty May 19 '16 at 16:52
  • @scottkosty: Thank you very much for answering my question. The cross-reference works now. I needed to include \ref{fig:chunk1} in a TeX code box. – Jing May 23 '16 at 17:04
  • @J.Chomel Thank you. I'll learn to add code in my question. I love SO. – Jing May 23 '16 at 17:07
  • Does this answer your question? [Opinion about generating and cross-referencing knitr plots in LyX](https://stackoverflow.com/questions/68940336/opinion-about-generating-and-cross-referencing-knitr-plots-in-lyx) – Diego Sep 07 '21 at 23:13

0 Answers0