Hello, How do I refer to labels created for tables and figures in Org mode so it appears in LaTeX export? Currently I am using a BEGIN_LaTeX and END_LaTeX to enclose \ref like so. I am sure this is not how it was intended to be used but I couldn't locate anything in documentation. ,---- | Please see figure | #+BEGIN_LaTeX | \ref{fig:results} | #+END_LaTeX | | #+CAPTION: Business Transaction over Business Units | #+LABEL: fig:results | [[./xxxxx.png]] | #+ATTR_LaTeX: scale=0.7 `---- Thanks, -- Manish
On Jan 19, 2009, at 8:26 PM, Manish wrote:
> Hello,
>
> How do I refer to labels created for tables and figures in Org mode so
> it appears in LaTeX export?
>
> Currently I am using a BEGIN_LaTeX and END_LaTeX to enclose \ref like
> so. I am sure this is not how it was intended to be used but I
> couldn't
> locate anything in documentation.
>
> ,----
> | Please see figure
> | #+BEGIN_LaTeX
> | \ref{fig:results}
> | #+END_LaTeX
> |
> | #+CAPTION: Business Transaction over Business Units
> | #+LABEL: fig:results
> | [[./xxxxx.png]]
> | #+ATTR_LaTeX: scale=0.7
> `----
Just write \ref{fig:results} anywhere in the text and you should be
fine.
And the ATTR_LaTeX: has to be *before* the link to the figure.
- Carsten
On Tue, Jan 20, 2009 at 2:17 AM, Carsten Dominik wrote: > > On Jan 19, 2009, at 8:26 PM, Manish wrote: > >> Hello, >> >> How do I refer to labels created for tables and figures in Org mode so >> it appears in LaTeX export? >> >> Currently I am using a BEGIN_LaTeX and END_LaTeX to enclose \ref like >> so. I am sure this is not how it was intended to be used but I couldn't >> locate anything in documentation. >> >> ,---- >> | Please see figure >> | #+BEGIN_LaTeX >> | \ref{fig:results} >> | #+END_LaTeX >> | >> | #+CAPTION: Business Transaction over Business Units >> | #+LABEL: fig:results >> | [[./xxxxx.png]] >> | #+ATTR_LaTeX: scale=0.7 >> `---- > > > Just write \ref{fig:results} anywhere in the text and you should be fine. I did not realize that I could put that literal LaTeX in text which can then be processed by PDFLaTeX. > > > And the ATTR_LaTeX: has to be *before* the link to the figure. Yes, I switched it by mistake while creating the example. Thank you. -- Manish
The following has been taken from my org file. ------------- #+CAPTION: Average output, cost and net income per acre, by area, (2005-06 prices) #+LABEL: tab:avprofit #+ATTR_LATEX: table * tabulary width=\textwidth align=l|RRRR #+BEGIN_SRC R :results value raw :colnames yes :hline yes subset(a,Crop_group=="Paddy")->a a[,c(8:10)]*a[,6]/a[,7]->a[,c(8:10)] vtab1(a,8,10,1,wtd.mean)->a1 round(as.numeric(as.character(a1[,2])))->a1[,2] round(as.numeric(as.character(a1[,3])))->a1[,3] round(as.numeric(as.character(a1[,4])))->a1[,4] names(a1)<-c("Area","output","Cost","Net income") #+END_SRC \ref{tab:avprofit} shows that the average levels of are highest in Area 7. ------------------ When I export it to latex/pdf, \ref{tab:avprofit} is just shown as ??. What am I not doing correctly? Also, is it okay if the text where the table is referenced comes before the table (and therefore its label) itself? Vikas
Aloha Vikas, Perhaps "table *" -> "table*"? All the best, Tom Vikas Rawal <vikaslists@agrarianresearch.org> writes: > The following has been taken from my org file. > > ------------- > > #+CAPTION: Average output, cost and net income per acre, by area, (2005-06 prices) > #+LABEL: tab:avprofit > #+ATTR_LATEX: table * tabulary width=\textwidth align=l|RRRR > #+BEGIN_SRC R :results value raw :colnames yes :hline yes > subset(a,Crop_group=="Paddy")->a > a[,c(8:10)]*a[,6]/a[,7]->a[,c(8:10)] > vtab1(a,8,10,1,wtd.mean)->a1 > round(as.numeric(as.character(a1[,2])))->a1[,2] > round(as.numeric(as.character(a1[,3])))->a1[,3] > round(as.numeric(as.character(a1[,4])))->a1[,4] > names(a1)<-c("Area","output","Cost","Net income") > #+END_SRC > > \ref{tab:avprofit} shows that the average levels of are highest in > Area 7. > > ------------------ > > When I export it to latex/pdf, \ref{tab:avprofit} is just shown as ??. > What am I not doing correctly? > > Also, is it okay if the text where the table is referenced comes > before the table (and therefore its label) itself? > > Vikas > > -- Thomas S. Dye http://www.tsdye.com
> Aloha Vikas,
>
> Perhaps "table *" -> "table*"?
>
I have corrected that. But it still says "Exporting to PDF...done, with some
errors: [undefined reference]"
The warning [undefined reference] seems to be on account of not
finding the label reference.
Vikas
You might want to check the .tex file to see if the label is there. Also, compiling with LaTeX yields a detailed log, which will tell you the line number of errors and warnings. You could look there to pinpoint the error(s). Tom Vikas Rawal <vikaslists@agrarianresearch.org> writes: >> Aloha Vikas, >> >> Perhaps "table *" -> "table*"? >> > > I have corrected that. But it still says "Exporting to PDF...done, with some > errors: [undefined reference]" > > The warning [undefined reference] seems to be on account of not > finding the label reference. > > Vikas > > -- Thomas S. Dye http://www.tsdye.com
On Wed, Oct 10, 2012 at 09:15:52PM -1000, Thomas S. Dye wrote:
> You might want to check the .tex file to see if the label is there.
> Also, compiling with LaTeX yields a detailed log, which will tell you
> the line number of errors and warnings. You could look there to pinpoint
> the error(s).
I was using this in the preamble:
#+LaTeX_HEADER: \usepackage[hmargin=3cm,vmargin=3.5cm]{geometry}
This was conflicting with my use of tabulary. I remove this line and
the errors disappeared.
Thanks very much for pointers.
Vikas