emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Orthogonality of blocks


From: Jambunathan K
Subject: Re: [O] Orthogonality of blocks
Date: Wed, 28 Dec 2011 10:18:52 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (windows-nt)

Nick Dokos <address@hidden> writes:

> Christian Moe <address@hidden> wrote:
>
>> On 12/27/11 9:37 PM, Eric Schulte wrote:
>> > Charles Turner<address@hidden>  writes:
>> >
>> >> Problem: I have two code blocks (#+BEGIN_SRC .. #+END) and I want to
>> >> display them side by side on the page, perhaps within an org table.
>> (...)
>> > Note that what you describe is likely possible using the existing
>> > exporter and writing some custom CSS to control how the serial content
>> > is displayed on the page.  The "display" css style would be relevant
>> > here.
>> 
>> Yes,
>> 
>>    pre.src {display: table-cell;}
>> 
>> will do it in HTML. Full example follows below. I'll leave LaTeX to 
>> those in the know...
>> 
>
> Here's one (rather less elegant than Christian's CSS magic) way
> that preserves the HTML behavior:
>
> #+author: Christian Moe
> #+title: Side by side code blocks
> #+style: <style>pre.src {display: table-cell;}</style>
>
> How to say hello in two languages:
>
> #+LaTeX: \begin{minipage}[t]{2.5in}
> #+begin_src perl :results output
>    # Perl
>    sub say_hello {
>        print "Hello, world";
>    }
>
>    say_hello;
> #+end_src
> #+LaTeX: \end{minipage}\begin{minipage}[t]{2.5in}
> #+begin_src python :results output
>    # Python
>    def say_hello():
>        print("Hello, world")
>
>    say_hello()
> #+end_src
> #+LaTeX: \end{minipage}
>
> Anybody for ODT? while preserving the HTML and LaTeX behavior? :-) BTW,
> I use minted - I hope it works with listings but I have not tried it.

Use list-tables which is a Experimental-cum-ODT-only feature. See the
attachment.



* Testing

#+begin_list-table
- Say Hello in Perl
  #+begin_src perl :results output
     # Perl
     sub say_hello {
           print "Hello, world";
     }

     say_hello;
  #+end_src
  - Say Hello in Python
    #+begin_src python :results output
       # Python
       def say_hello():
             print("Hello, world")

       say_hello()
    #+end_src
#+end_list-table

Attachment: side-by-side.odt
Description: side-by-side.odt

> Nick
>
>> hth,
>> Christian
>> 
>> ---
>> 
>> #+title: Side by side code blocks
>> #+style: <style>pre.src {display: table-cell;}</style>
>> 
>> How to say hello in two languages:
>> 
>> #+begin_src perl :results output
>>    # Perl
>>    sub say_hello {
>>        print "Hello, world";
>>    }
>> 
>>    say_hello;
>> #+end_src
>> #+begin_src python :results output
>>    # Python
>>    def say_hello():
>>        print("Hello, world")
>> 
>>    say_hello()
>> #+end_src
>
>

-- 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]