emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [babel] captions and figure size on export
@ 2010-03-07 22:53 Graham Smith
  2010-03-08  7:28 ` Graham Smith
  0 siblings, 1 reply; 6+ messages in thread
From: Graham Smith @ 2010-03-07 22:53 UTC (permalink / raw)
  To: emacs-orgmode

I have the following code beside each other in an orgmode/babel file
creating two boxplots.

When exported the first boxplot remains the default size and has no
caption or figure number, while the second is 10cm across, and has a
caption and figuer number(Fig1).

Could someone have a look at my code and see where my error is. They
look identical to me.

Thanks,

Graham

#+srcname:BoxplotFlowering
#+begin_src R :session daf :file FloweringBoxplot.pdf :exports both
boxplot(daf$Flower~daf$YEAR)
#+end_src

#+CAPTION:    Boxplot comparing number of flowering daffodils between
2005 and 2006
#+LABEL:      fig:BoxplotFlowering
#+ATTR_LaTeX: width=10cm
#+results: BoxplotFlowering
[[file:FloweringBoxplot.pdf]]

#+srcname:BoxplotNonFlowering
#+begin_src R :session daf :file NonFloweringBoxplot.pdf :exports both
boxplot(daf$No.Flower~daf$YEAR)
#+end_src

#+CAPTION:    Boxplot comparing number of non flowering daffodils
between 2005 and 2006
#+LABEL:      fig:BoxplotNonFlowering
#+ATTR_LaTeX: width=10cm
#+results: BoxplotNonFlowering
[[file:NonFloweringBoxplot.pdf]]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [babel] captions and figure size on export
  2010-03-07 22:53 [babel] captions and figure size on export Graham Smith
@ 2010-03-08  7:28 ` Graham Smith
  2010-03-08  9:10   ` Graham Smith
  0 siblings, 1 reply; 6+ messages in thread
From: Graham Smith @ 2010-03-08  7:28 UTC (permalink / raw)
  To: emacs-orgmode

Graham Smith <myotisone <at> gmail.com> writes:

To follow this up, it seems that looking at the tex file that none of the latex
code is being exported


\subsection{Boxplots}
\label{sec-2.1}


\begin{verbatim}
boxplot(daf$Flower~daf$YEAR)
\end{verbatim}

\includegraphics[width=10em]{FloweringBoxplot.pdf}

\begin{verbatim}
boxplot(daf$No.Flower~daf$YEAR)
\end{verbatim}


\begin{figure}[htb]
\centering
\includegraphics[width=10cm]{NonFloweringBoxplot.pdf}
\caption{\label{fig:BoxplotFlowering}Boxplot comparing number of flowering
daffodils between 2005 and 2006}
\end{figure}

Graham

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Re: [babel] captions and figure size on export
  2010-03-08  7:28 ` Graham Smith
@ 2010-03-08  9:10   ` Graham Smith
  2010-03-08 10:14     ` Graham Smith
  0 siblings, 1 reply; 6+ messages in thread
From: Graham Smith @ 2010-03-08  9:10 UTC (permalink / raw)
  To: emacs-orgmode

Mmmm, this seems to be something to do with the placement of the code
in orgmode as I now realise that although fig 1 isn't resized or
captioned, the fig 1 caption iand size commands are attached to fig 2.
 and the fig2 commands attached to fig 3 etc.

I will try and re-arrange these until they work, but hopefully someone
will still be able to instantly see what I am doing wrong from the
sample I gave in the original post

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Re: [babel] captions and figure size on export
  2010-03-08  9:10   ` Graham Smith
@ 2010-03-08 10:14     ` Graham Smith
  2010-03-09 14:32       ` Dan Davison
  0 siblings, 1 reply; 6+ messages in thread
From: Graham Smith @ 2010-03-08 10:14 UTC (permalink / raw)
  To: emacs-orgmode

This is driving me mad here:  I have removed all the fig and size code
and replaced it with onky one line that should be resizing the first
graph(FloweringBoxplot.pdf).  However, its resizing the second graph
(NonFloweringBoxplot/pdf) and not affecting the first graph. This
works on other files, so I am really at a loss here.


#+srcname:BoxplotFlowering
#+begin_src R :session daf :file FloweringBoxplot.pdf :exports both
boxplot(daf$Flower~daf
$YEAR)
#+end_src

#+ATTR_LaTeX: width=10cm
#+results: BoxplotFlowering
[[file:FloweringBoxplot.pdf]]


#+srcname:BoxplotNonFlowering
#+begin_src R :session daf :file NonFloweringBoxplot.pdf :exports both
boxplot(daf$No.Flower~daf$YEAR)
#+end_src

#+results: BoxplotNonFlowering
[[file:NonFloweringBoxplot.pdf]]

Graham

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Re: [babel] captions and figure size on export
  2010-03-08 10:14     ` Graham Smith
@ 2010-03-09 14:32       ` Dan Davison
  2010-03-09 19:29         ` Graham Smith
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Davison @ 2010-03-09 14:32 UTC (permalink / raw)
  To: Graham Smith; +Cc: emacs-orgmode

Graham Smith <myotisone@gmail.com> writes:

> This is driving me mad here:  I have removed all the fig and size code
> and replaced it with onky one line that should be resizing the first
> graph(FloweringBoxplot.pdf).  However, its resizing the second graph
> (NonFloweringBoxplot/pdf) and not affecting the first graph. This
> works on other files, so I am really at a loss here.

Hi Graham,

We can see what's going on here by executing the block manually with C-c
C-c, which transforms your results block from this:

#+ATTR_LaTeX: width=10cm
#+results: BoxplotFlowering
[[file:FloweringBoxplot.pdf]]

into this:

#+results: BoxplotFlowering
[[file:FloweringBoxplot.pdf]]
#+ATTR_LaTeX: width=10cm

(The reason is that the results block corresponding to the code block is
first deleted and then re-inserted immediately below the code block).

You are using ':exports both' which means that the above transformation
actually occurs during export, but in a special pre-export org buffer
which the user never sees. The fact that the ATTR_LaTeX line ends up
last explains why it modifies the *second* block.

Thanks for pointing this out -- we will revisit this behaviour as it
does seem surprising and on the face of it undesirable.

As a workaround, is it necessary for you to execute the block on export?
Or could you instead use :exports code? I.e. before export, execute the
block manually and ensure that the #+ATTR_LaTeX and #+results lines are
arranged in the correct way.

Dan



>
>
> #+srcname:BoxplotFlowering
> #+begin_src R :session daf :file FloweringBoxplot.pdf :exports both
> boxplot(daf$Flower~daf
> $YEAR)
> #+end_src
>
> #+ATTR_LaTeX: width=10cm
> #+results: BoxplotFlowering
> [[file:FloweringBoxplot.pdf]]
>
>
> #+srcname:BoxplotNonFlowering
> #+begin_src R :session daf :file NonFloweringBoxplot.pdf :exports both
> boxplot(daf$No.Flower~daf$YEAR)
> #+end_src
>
> #+results: BoxplotNonFlowering
> [[file:NonFloweringBoxplot.pdf]]
>
> Graham
>
>
> _______________________________________________
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Re: [babel] captions and figure size on export
  2010-03-09 14:32       ` Dan Davison
@ 2010-03-09 19:29         ` Graham Smith
  0 siblings, 0 replies; 6+ messages in thread
From: Graham Smith @ 2010-03-09 19:29 UTC (permalink / raw)
  To: Dan Davison; +Cc: emacs-orgmode

Dan

> As a workaround, is it necessary for you to execute the block on export?
> Or could you instead use :exports code? I.e. before export, execute the
> block manually and ensure that the #+ATTR_LaTeX and #+results lines are
> arranged in the correct way.

Many thanks for this, I'm glad it can be explained and the ":exports
code"  option works perfectly.  I have executed the code manually
anyway and I can't remember why I ended up withe the :exports both
option.

Graham

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-03-09 19:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-07 22:53 [babel] captions and figure size on export Graham Smith
2010-03-08  7:28 ` Graham Smith
2010-03-08  9:10   ` Graham Smith
2010-03-08 10:14     ` Graham Smith
2010-03-09 14:32       ` Dan Davison
2010-03-09 19:29         ` Graham Smith

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).