From mboxrd@z Thu Jan 1 00:00:00 1970 From: tsd@tsdye.com (Thomas S. Dye) Subject: Re: Exporting via babel to LaTeX Date: Mon, 28 May 2012 13:30:33 -1000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:59581) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SZ9Oh-0005gJ-Oj for emacs-orgmode@gnu.org; Mon, 28 May 2012 19:30:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SZ9Of-0003Cf-C8 for emacs-orgmode@gnu.org; Mon, 28 May 2012 19:30:47 -0400 Received: from oproxy5-pub.bluehost.com ([67.222.38.55]:56587) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1SZ9Of-0003CS-2i for emacs-orgmode@gnu.org; Mon, 28 May 2012 19:30:45 -0400 In-Reply-To: (John Hendy's message of "Mon, 28 May 2012 18:10:06 -0500") 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: John Hendy Cc: emacs-orgmode John Hendy writes: > On Mon, May 28, 2012 at 4:32 PM, Thomas S. Dye wrote: >> John Hendy writes: >> >>> I've only ever used src blocks to make plots or create files to >>> include. I have my first opportunity to actually try and include both >>> code and results and have a question about spacing. You won't have my >>> data, but this is pretty simple stuff.: >>> >>> #+begin_src R :session basic :results output :exports both >>> nrow(data) >>> #+end_src >>> #+begin_src R :session basic :results output :exports both >>> nrow(nonzero.data) >>> #+end_src >>> >>> I split them up because I wanted the results like so: >>> >>> Code-A >>> Results-A >>> Code-B >>> Results-B >>> >>> If I kept them together, it came out Code-A, Code-B, then Results-A, Re= sults-B. >>> >>> Anyway, the LaTeX output is creating the following: >>> >>> \begin{verbatim} >>> nrow(data) >>> \end{verbatim} >>> >>> \begin{verbatim} >>> =C2=A0[1] 681 >>> \end{verbatim} >>> >>> \begin{verbatim} >>> nrow(nonzero.data) >>> \end{verbatim} >>> >>> \begin{verbatim} >>> =C2=A0[1] 455 >>> \end{verbatim} >>> >>> This gives really, really spaced out results. I'd prefer output that >>> looks more like an R terminal output, which can be done by not putting >>> code and results in separate verbatim blocks. Is this standard >>> spacing/behavior or is there an option/exporter tweak I can use on >>> this? It just ends up taking so much space. >>> >>> I'm super new to this and barely know anything about the header >>> arguments at all. I will say I was thrilled to find out about the >>> :session option. I was worried about "walking through code" because I >>> rely on initial block results to carry through to the others. What do >>> you know? There's a way to do that :) Thanks for this wonderful >>> implementation. I've seen it come up on the list hundreds of time and >>> have to say it's really cool actually getting to work with it! >>> >>> >>> Best regards, >>> John >>> >>> >> Hi John, >> >> One way to do this would be to redefine the verbatim environment in >> LaTeX. =C2=A0There is a fancyvrb package for LaTeX that might help with = this. >> >> I think a better answer to your query has two parts. >> >> 1) Make Org-mode distinguish your code and results, instead of having >> them both be verbatim environments. =C2=A0One way to do this would be to= use >> listings or minted to typeset the source code blocks: see >> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-12. >> >> Then use :wrap foo to wrap the results in a foo environment. >> >> 2) Configure LaTeX to typeset the new environments in a way that pleases >> you. LaTeX specifies for each environment the space to leave before it >> and after it. =C2=A0You should be able to set these so the results please >> you. =C2=A0Here is one example for how to modify the results block: >> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-10-2. >> Note that this was written for an earlier version of Org-mode, before >> results blocks were stored in drawers. =C2=A0Instead of "results" use "f= oo". >> > > To follow up on this because it seemed a bit simper..., I added the > example to my file: > > #+LaTeX_HEADER: \usepackage{framed} > #+LaTeX_HEADER: \usepackage{xcolor} > #+LaTeX_HEADER: \definecolor{shadecolor}{gray}{.95} > #+LaTeX_HEADER: \newenvironment{results}{\begin{shaded}}{\end{shaded}} > > But it doesn't change anything. Since it says this will affect a > "results block," I [intuitively] tried: > > #+begin_results > test > #+end_results > > But don't see anything different. Did I mis-interpret how this works? > Or do I need the above /with/ either minted or listing and it's not > standalone? > > > Thanks, > John > > Hi John, This should be independent of listings and/or minted. Does the .tex file have \begin{results} test \end{results} ? If so, then the new results environment should be printed in a shaded box when LaTeX is done processing it (if your LaTeX distribution has the framed and xcolor packages). If not, then you need to use org-special-blocks. hth, Tom >> You'll need to consult the listings or minted packages to configure one >> of them. >> >> In effect, you will be taking advantage of LaTeX's semantic markup. >> >> hth, >> Tom >> -- >> Thomas S. Dye >> http://www.tsdye.com --=20 T.S. Dye & Colleagues, Archaeologists 735 Bishop St, Suite 315, Honolulu, HI 96813 Tel: 808-529-0866, Fax: 808-529-0884 http://www.tsdye.com