Hi Robert, Thanks for the thoughtful message. I present a couple of solutions below. Robert Cunningham writes: > G'day All, > > I wonder if I've missed something and there is a better way. > > Essentially I'm trying to use org babel with R and LaTeX to create figures > with both long and short captions (for contents) > > I'd started with: > > #+CAPTION: Nice data (filled points indicate less nice data) > #+LABEL: fig:nicedata > #+ATTR_LaTeX: width=0.98\textwidth > #+begin_src R :file ndata.pdf :width 1000 :height 617 :exports results > dotchart(data$ndata) > #+end_src > > which pointed to the need for long/short captions... > > feeling hopeful I tried: > > #+CAPTION: Nice data [Nice data (filled points indicate less nice data)] > #+LABEL: fig:nicedata > #+ATTR_LaTeX: width=0.98\textwidth > #+begin_src R :file ndata.pdf :width 1000 :height 617 :exports results > dotchart(data$ndata) > #+end_src > I'm attaching a patch [1] which adds shortname support for captions. Once applied, the following syntax will result in a caption with a shortname and a longname. --8<---------------cut here---------------start------------->8--- some pre-table text #+source: g-nicedata #+begin_src gnuplot :file graph.png :exports results plot sin(x) #+end_src #+Caption: [nice data]{a longer description of the niceness of the data} #+results: g-nicedata [[file:graph.png]] some post-table text --8<---------------cut here---------------end--------------->8--- however, while this patch is still pending there is an Org-babel solution below which should work immediately. > > > but no luck there. > > Next effort was to try to use R and LaTex more directly with noweb. I tried > this: > > > > #+srcname: r-nicedata > #+begin_src R :session :file ndata.pdf :results output :exports results > dotchart(data$ndata) > #+end_src > > > #+begin_src latex :noweb yes > \begin{figure}[htb!] > \centering > \includegraphics[width=0.98\textwidth]{<>} > \caption[Nice data]{Nice data (filled points indicate less nice data)} > \label{fig:nicedata} > \end{figure} > #+end_src > > > > This does produce the figure and long/short contents BUT ALSO produces this: > > #+results: r-nicedata > [[file:ndata.pdf]] > > which upon export results in a link and consequently the plot appearing both > in the figure and elsewhere. This second plot is unwelcome. > > I've tried assorted :results and :output options but have not found how to > suppress the #+results: but still obtain the figure. I've always used > the :session option. > > I've also tried twigging an org-export option to suppress pdf export but the > link is still exported so that is not a solution. > > The current "working" solution is to use the noweb approach and then use sed > to clean out the links to the second image-ugly to say the least! > You were very close with the noweb approach. The following combination should work -- notice the ":results silent" header argument to the source block. --8<---------------cut here---------------start------------->8--- some pre-table text #+source: g-nicedata #+begin_src gnuplot :file graph.png :results silent :exports none plot sin(x) #+end_src #+begin_src latex :noweb yes \begin{figure}[htb!] \centering \includegraphics[width=0.98\textwidth]{<>} \caption[Nice data]{some nice data -- filled points indicate less nice data} \label{fig:nicedata} \end{figure} #+end_src some post-table text --8<---------------cut here---------------end--------------->8--- is exported to the following latex, --8<---------------cut here---------------start------------->8--- some pre-table text \begin{figure}[htb!] \centering \includegraphics[width=0.98\textwidth]{graph.png} \caption[Nice data]{some nice data -- filled points indicate less nice data} \label{fig:nicedata} \end{figure} some post-table text --8<---------------cut here---------------end--------------->8--- Hope this helps, Best -- Eric > > > > All this with org version 6.36c > > > What have I missed? What is the best way to do this? > > > Cheers, > > Robert Cunningham > > > > > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode Footnotes: [1]