emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jambunathan K <kjambunathan@gmail.com>
To: nicholas.dokos@hp.com
Cc: emacs-orgmode@gnu.org, mail@christianmoe.com,
	Eric Schulte <eric.schulte@gmx.com>,
	Charles Turner <chturne@gmail.com>
Subject: Re: Orthogonality of blocks
Date: Wed, 28 Dec 2011 10:18:52 +0530	[thread overview]
Message-ID: <81r4zp713f.fsf@gmail.com> (raw)
In-Reply-To: <7612.1325028604@alphaville.dokosmarshall.org> (Nick Dokos's message of "Tue, 27 Dec 2011 18:30:04 -0500")

[-- Attachment #1: Type: text/plain, Size: 1622 bytes --]

Nick Dokos <nicholas.dokos@hp.com> writes:

> Christian Moe <mail@christianmoe.com> wrote:
>
>> On 12/27/11 9:37 PM, Eric Schulte wrote:
>> > Charles Turner<chturne@gmail.com>  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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: side-by-side.org --]
[-- Type: text/x-org, Size: 367 bytes --]




* 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 #3: side-by-side.odt --]
[-- Type: application/vnd.oasis.opendocument.text, Size: 9810 bytes --]

[-- Attachment #4: Type: text/plain, Size: 484 bytes --]


> 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
>
>

-- 

  parent reply	other threads:[~2011-12-28  4:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-27 19:46 Orthogonality of blocks Charles Turner
2011-12-27 20:37 ` Eric Schulte
2011-12-27 21:12   ` Christian Moe
2011-12-27 21:10     ` Eric Schulte
2011-12-27 23:19       ` Christian Moe
2011-12-27 23:30     ` Nick Dokos
2011-12-28  0:14       ` Torsten Wagner
2011-12-28  4:48       ` Jambunathan K [this message]
2011-12-28  5:30         ` Jambunathan K
2011-12-28  7:10       ` Sebastien Vauban
2011-12-28 14:51     ` Charles Turner
2011-12-29  5:18       ` Jambunathan K
2011-12-29  5:49         ` Enhancing table cell alignments and commenting columns (was Re: Orthogonality of blocks) Jambunathan K
2011-12-29  6:06           ` Jambunathan K
2011-12-29 16:22           ` Jambunathan K
2011-12-29  6:14       ` Orthogonality of blocks Jambunathan K
2011-12-30 14:17 ` Eric S Fraga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=81r4zp713f.fsf@gmail.com \
    --to=kjambunathan@gmail.com \
    --cc=chturne@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=eric.schulte@gmx.com \
    --cc=mail@christianmoe.com \
    --cc=nicholas.dokos@hp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).