From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: Re: [babel] configuring LaTeX exports verbatim environment for exported code and results Date: Tue, 31 Aug 2010 08:40:58 -0600 Message-ID: <87pqwy975x.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=46149 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OqS1L-0007PZ-V3 for emacs-orgmode@gnu.org; Tue, 31 Aug 2010 10:41:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OqS1K-0004Og-B8 for emacs-orgmode@gnu.org; Tue, 31 Aug 2010 10:41:07 -0400 Received: from mail-px0-f169.google.com ([209.85.212.169]:51994) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OqS1J-0004OW-VT for emacs-orgmode@gnu.org; Tue, 31 Aug 2010 10:41:06 -0400 Received: by pxi5 with SMTP id 5so5040719pxi.0 for ; Tue, 31 Aug 2010 07:41:04 -0700 (PDT) In-Reply-To: (Douglas Bates's message of "Tue, 31 Aug 2010 08:28:19 -0500") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Douglas Bates Cc: emacs-orgmode@gnu.org Hi Douglas, Douglas Bates writes: > On Tue, Aug 31, 2010 at 8:08 AM, Douglas Bates wrot= e: >> I have been unable to find in the documentation whether the verbatim >> environment created by LaTeX exports of source code blocks can be >> configured. >> It is possible to export code using the LaTeX listings package. See `org-export-latex-listings' ,---- | org-export-latex-listings is a variable defined in `org-latex.el'. | Its value is t |=20 | Documentation: | Non-nil means export source code using the listings package. | This package will fontify source code, possibly even with color. | If you want to use this, you also need to make LaTeX use the | listings package, and if you want to have color, the color | package. Just add these to `org-export-latex-packages-alist', | for example using customize, or with something like |=20 | (require 'org-latex) | (add-to-list 'org-export-latex-packages-alist '("" "listings")) | (add-to-list 'org-export-latex-packages-alist '("" "color")) |=20 | You can customize this variable. |=20 | [back] `---- >> >> Exporting to LaTeX a section like [...] >> >> Because both the source and the results are presented in verbatim, I >> don't have much control over the appearance of the code on the slide. >> If I could, for example, configure the names of the exported >> environment for the source code and for the results separately, I >> could use LaTeX's fancyvrb.sty to adjust font sizes, colors, boxes, >> etc. > Listings gives good control over the look of code on a slide, I generally use the following as my jumping off point for listings style in Beamer presentations --8<---------------cut here---------------start------------->8--- #+begin_LaTeX \definecolor{dkgreen}{rgb}{0,0.5,0} \definecolor{dkred}{rgb}{0.5,0,0} \definecolor{gray}{rgb}{0.5,0.5,0.5} \lstset{basicstyle=3D\ttfamily\bfseries\footnotesize, morekeywords=3D{virtualinvoke}, keywordstyle=3D\color{blue}, ndkeywordstyle=3D\color{red}, commentstyle=3D\color{dkred}, stringstyle=3D\color{dkgreen}, numbers=3Dleft, numberstyle=3D\ttfamily\tiny\color{gray}, stepnumber=3D1, numbersep=3D10pt, backgroundcolor=3D\color{white}, tabsize=3D4, showspaces=3Dfalse, showstringspaces=3Dfalse, xleftmargin=3D.23in } #+end_LaTeX --8<---------------cut here---------------end--------------->8--- > > I just realized that if the code and results are wrapped in other than > the verbatim environment the org-beamer-fragile-re variable will need > to be customized. No, I believe this works with listings blocks out of the box. > (By the way, automatically detecting the need for the fragile option > is a great idea.) > >> Also, the blank lines before and after the verbatim environment are >> problematic. =C2=A0In plain text it makes sense to delimit code chunks w= ith >> blank lines but in LaTeX a blank line starts a new paragraph and you >> don't always want that. >> You can manually place the #+results line anywhere in the org-mode file (even immediately after the code block), however it seems the blank lines still appear in the exported tex file. This appears to be an issue with the LaTeX exporter in general rather than Code blocks in particular. >> >> As this is my first posting please let me know if I have >>inadvertently violated conventions of the list. > Looks good to me. Cheers -- Eric > > Well, other than my cut-and-paste glich below :-/ >> >> Also, the exports append blank lines >> > > _______________________________________________ > 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