From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Leha Subject: Re: Error with :wrap org in babel and 8.0-pre Date: Mon, 15 Apr 2013 21:48:44 +0200 Message-ID: <87haj78tib.fsf@med.uni-goettingen.de> References: <87li8ncqzq.fsf@gmail.com> <87li8jfysj.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:60697) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1URpOa-0001Wi-9I for emacs-orgmode@gnu.org; Mon, 15 Apr 2013 15:48:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1URpOY-0001xW-Fn for emacs-orgmode@gnu.org; Mon, 15 Apr 2013 15:48:56 -0400 Received: from plane.gmane.org ([80.91.229.3]:44733) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1URpOY-0001xP-6F for emacs-orgmode@gnu.org; Mon, 15 Apr 2013 15:48:54 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1URpOX-0002Il-Ah for emacs-orgmode@gnu.org; Mon, 15 Apr 2013 21:48:53 +0200 Received: from vpn-2053.gwdg.de ([134.76.2.53]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 15 Apr 2013 21:48:53 +0200 Received: from andreas.leha by vpn-2053.gwdg.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 15 Apr 2013 21:48:53 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi John, John Hendy writes: > On Mon, Apr 15, 2013 at 1:12 PM, Eric Schulte wrote: >> John Hendy writes: >> >>> On Fri, Apr 12, 2013 at 5:24 PM, Eric Schulte wrote: >>>> John Hendy writes: >>>> >>>>> I thought this was the proper syntax for printing stuff directly to a >>>>> LaTeX document: >>>>> >>>>> #+begin_src R :session :exports results :results output :wrap org >>>>> >>>> >>>> I think you want either ":results latex" or ":wrap latex". >>>> >>> >>> Trying my best to follow the evolution here.... I've tried to discern >>> from the manual and Worg the best way to do something, generally try >>> it and fail. Then I post to the list and get an answer. A short time >>> later, I try doing what I think is approximately the same thing to >>> find that it seems to have changed since the last time: >>> >>> To print multiple file names and =#+attr_stuff= options, the answer >>> was =:results output org :exports results= >>> - http://lists.gnu.org/archive/html/emacs-orgmode/2012-08/msg01224.html >>> >>> Trying to do the same exact thing a bit later was =:results output >>> wrap=, shortly followed up with the instruction to use =:wrap org= >>> - http://lists.gnu.org/archive/html/emacs-orgmode/2013-03/msg01599.html >>> >>> Now, it's =:wrap latex=, but I'm not sure why. >>> >> >> I may have miss-understood your question. >> >>> >>> Is =:wrap org= appropriate for anything? >> >> Use :wrap latex if your code block produces raw latex. E.g., >> >> #+begin_src sh :results output :wrap latex >> cat <> \begin{tabular}{rr} >> a & b\\ >> \hline >> 1 & 2\\ >> \end{tabular} >> EOF >> #+end_src >> >> #+RESULTS: >> #+BEGIN_latex >> \begin{tabular}{rr} >> a & b\ >> \hline >> 1 & 2\ >> \end{tabular} >> #+END_latex >> > > That makes sense, but it's not what I'm doing or at least not in full. > I may insert LaTeX here or there, but am also using Org-specific > syntax in many places as well (#+attr_blah lines and such). > >> >> Use :wrap org if your code block produces raw org. E.g., >> >> #+begin_src sh :results output :wrap org >> cat <> | a | b | >> |---+---| >> | 1 | 2 | >> EOF >> #+end_src >> >> #+RESULTS: >> #+BEGIN_org >> | a | b | >> |---+---| >> | 1 | 2 | >> #+END_org >> >> Let me know if that leave any mysteries or doesn't address part of your >> question. I apologize for any contribution my often terse and hurried >> responses have made to this confusion. >> > > This is also what I would have thought. In other words, =:wrap latex= > if you will have pure LaTeX in the blocks, and =:wrap org= if it's too > be interpreted just as if you'd typed the exact same thing in your > Org-mode file outside of the given results block. > > But this was the reason for the original post. Here's my document: > > #+begin_org_document > > * Heading > > #+begin_src R :session :exports results :results output :wrap org > > library(ascii) > > var1 <- 100 > var2 <- 200 > > cat("With the assumption of", var1, "lbs. of input material 1 and", > var2, "lbs. of material 2, > we can produce the following number of widgets based on injection mold > wall thicknesses.\n") > > qtys <- data.frame(wall = c("5 mil", "6 mil", "8 mil"), vals = c(.005, > .006, .008)) > qtys$widgets <- trunc(var2 / qtys$vals) > > qty_table <- ascii(qtys, header = T, include.colnames = T, include.rownames = F) > print(qty_table, type = "org") > > #+end_src > > #+RESULTS: > #+BEGIN_org > With the assumption of 100 lbs. of input material 1 and 200 lbs. of material 2, > we can produce the following number of widgets based on injection mold > wall thicknesses. > | wall | vals | widgets | > |-------+------+----------| > | 5 mil | 0.01 | 40000.00 | > | 6 mil | 0.01 | 33333.00 | > | 8 mil | 0.01 | 25000.00 | > #+END_org > > #+end_org_document > > > Everything looks to be correct. I get this LaTeX upon compilation for > the results section: > > #+begin_latex_output > > \begin{org} > With the assumption of 100 lbs. of input material 1 and 200 lbs. of material 2, > we can produce the following number of widgets based on injection mold > wall thicknesses. > \begin{center} > \begin{tabular}{lrr} > \toprule > wall & vals & widgets\\ > \midrule > 5 mil & 0.01 & 40000.00\\ > 6 mil & 0.01 & 33333.00\\ > 8 mil & 0.01 & 25000.00\\ > \bottomrule > \end{tabular} > \end{center} > \end{org} > % Generated by Org mode 8.0-pre in Emacs 24.3.1. > \end{document} > > #+end_latex_output > > This is in the *Org PDF LaTeX Output* buffer: > > ! LaTeX Error: Environment org undefined. > > See the LaTeX manual or LaTeX Companion for explanation. > Type H for immediate help. > ... > > l.33 \begin{org} > > (/home/jwhendy/.texlive/2012/texmf-dist/tex/latex/wasysym/uwasy.fd) > (/home/jwhendy/.texlive/2012/texmf-dist/tex/latex/base/ulasy.fd) > (/home/jwhendy/.texlive/2012/texmf-dist/tex/latex/amsfonts/umsa.fd) > (/home/jwhendy/.texlive/2012/texmf-dist/tex/latex/amsfonts/umsb.fd) > > ! LaTeX Error: \begin{document} ended by \end{org}. > > > > So it seems like something is awry: > - Either the exporter is supposed to convert #+begin/end_org into > something else (I would assume there shouldn't be any \begin/end{org} > around it since it should just be including the LaTeX results as if it > wasn't in a #+RESULTS block at all, right?), OR > - I'm missing some sort of definition for an =org= environment in > LaTeX setup so that it knows what to do with \begin/end{org} > I am not sure, if this is the intended solution, but you can use something like this: #+LATEX_HEADER: \newenvironment{org}{}{} in your org file. HTH, Andreas