emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Orthogonality of blocks
@ 2011-12-27 19:46 Charles Turner
  2011-12-27 20:37 ` Eric Schulte
  2011-12-30 14:17 ` Eric S Fraga
  0 siblings, 2 replies; 17+ messages in thread
From: Charles Turner @ 2011-12-27 19:46 UTC (permalink / raw)
  To: emacs-orgmode

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.

Is this possible? It doesn't seem to be. I think it would be nice to 
shove collapsed blocks into org table cells and have them rendered in 
the usual fashion with the different exporters. "First-class blocks" :-)

Thanks,
	Charles.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Orthogonality of blocks
  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-30 14:17 ` Eric S Fraga
  1 sibling, 1 reply; 17+ messages in thread
From: Eric Schulte @ 2011-12-27 20:37 UTC (permalink / raw)
  To: Charles Turner; +Cc: emacs-orgmode

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.
>
> Is this possible? It doesn't seem to be. I think it would be nice to
> shove collapsed blocks into org table cells and have them rendered in
> the usual fashion with the different exporters. "First-class blocks"
> :-)
>
> Thanks,
> 	Charles.
>

Hi Charles,

Currently this is not possible, I do see the appeal of being able to
display many elements of Org-mode documents side-by-side be they
paragraphs, tables or code blocks.  To the best of my knowledge the
current Org-mode -> html exporter is vertically serial and has no
facilities for side-by-side display.

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.

Hope this helps,

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Orthogonality of blocks
  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 14:51     ` Charles Turner
  2 siblings, 1 reply; 17+ messages in thread
From: Eric Schulte @ 2011-12-27 21:10 UTC (permalink / raw)
  To: mail; +Cc: emacs-orgmode, Charles Turner

Christian Moe <mail@christianmoe.com> writes:

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

Wow, Thanks for sharing this example.  I had no idea side-by-side block
export could be so easily done.

Best,

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

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Orthogonality of blocks
  2011-12-27 20:37 ` Eric Schulte
@ 2011-12-27 21:12   ` Christian Moe
  2011-12-27 21:10     ` Eric Schulte
                       ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Christian Moe @ 2011-12-27 21:12 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode, Charles Turner

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

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Orthogonality of blocks
  2011-12-27 21:10     ` Eric Schulte
@ 2011-12-27 23:19       ` Christian Moe
  0 siblings, 0 replies; 17+ messages in thread
From: Christian Moe @ 2011-12-27 23:19 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode, Charles Turner

Oh, right, it gets a bit more complicated if you want better control 
of the tabulated blocks, i.e. border separation and spacing between 
the table cells. Then you first need to wrap them in a <div>. You 
could do that with literal HTML, or (my preference) with 
org-special-blocks. Use CSS to display the div as a table, and set 
border separation and spacing on it. Reworked example:

#+title: Side by side code blocks
#+style: <style>.parallel {display: table; border-collapse: separate; 
border-spacing: 2px 2px;}
#+style: pre.src {display: table-cell}</style>

How to say hello in two languages:

#+begin_parallel

#+name: Perl_hello
#+begin_src perl :results output
   # Perl
   sub say_hello {
       print "Hello, world";
   }

   say_hello;
#+end_src

#+name: Python_hello
#+begin_src python :results output
   # Python
   def say_hello():
       print("Hello, world")

   say_hello()
#+end_src

#+end_parallel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Orthogonality of blocks
  2011-12-27 21:12   ` Christian Moe
  2011-12-27 21:10     ` Eric Schulte
@ 2011-12-27 23:30     ` Nick Dokos
  2011-12-28  0:14       ` Torsten Wagner
                         ` (2 more replies)
  2011-12-28 14:51     ` Charles Turner
  2 siblings, 3 replies; 17+ messages in thread
From: Nick Dokos @ 2011-12-27 23:30 UTC (permalink / raw)
  To: mail; +Cc: nicholas.dokos, emacs-orgmode, Eric Schulte, Charles Turner

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:

--8<---------------cut here---------------start------------->8---
#+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}
--8<---------------cut here---------------end--------------->8---

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.

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Orthogonality of blocks
  2011-12-27 23:30     ` Nick Dokos
@ 2011-12-28  0:14       ` Torsten Wagner
  2011-12-28  4:48       ` Jambunathan K
  2011-12-28  7:10       ` Sebastien Vauban
  2 siblings, 0 replies; 17+ messages in thread
From: Torsten Wagner @ 2011-12-28  0:14 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode, mail, Eric Schulte, Charles Turner

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

Hi,
just want to point out, there is orgs beamer support which can easily place
blocks side by side.
Worg has a tutorial about this.
Torsten
On Dec 28, 2011 8:30 AM, "Nick Dokos" <nicholas.dokos@hp.com> wrote:

> 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:
>
> --8<---------------cut here---------------start------------->8---
> #+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}
> --8<---------------cut here---------------end--------------->8---
>
> 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.
>
> 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
>
>

[-- Attachment #2: Type: text/html, Size: 3212 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Orthogonality of blocks
  2011-12-27 23:30     ` Nick Dokos
  2011-12-28  0:14       ` Torsten Wagner
@ 2011-12-28  4:48       ` Jambunathan K
  2011-12-28  5:30         ` Jambunathan K
  2011-12-28  7:10       ` Sebastien Vauban
  2 siblings, 1 reply; 17+ messages in thread
From: Jambunathan K @ 2011-12-28  4:48 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode, mail, Eric Schulte, Charles Turner

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

-- 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Orthogonality of blocks
  2011-12-28  4:48       ` Jambunathan K
@ 2011-12-28  5:30         ` Jambunathan K
  0 siblings, 0 replies; 17+ messages in thread
From: Jambunathan K @ 2011-12-28  5:30 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode, mail, Eric Schulte, Charles Turner

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


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

Additional note: List tables are also a feature of the XHTML backend.

(add-to-list 'load-path "~/src/org-mode/contrib/lisp")
M-x load-library RET org-xhtml RET
M-x org-export-as-xhtml-and-open RET

See the attached HTML output for what you get.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: side-by-side.org --]
[-- Type: text/x-org, Size: 380 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.html --]
[-- Type: text/html, Size: 4309 bytes --]

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


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

-- 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Orthogonality of blocks
  2011-12-27 23:30     ` Nick Dokos
  2011-12-28  0:14       ` Torsten Wagner
  2011-12-28  4:48       ` Jambunathan K
@ 2011-12-28  7:10       ` Sebastien Vauban
  2 siblings, 0 replies; 17+ messages in thread
From: Sebastien Vauban @ 2011-12-28  7:10 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Nick,

Nick Dokos wrote:
> 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.

The above, using my default settings for Listings:

    http://i.imgur.com/xooS3.png

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Orthogonality of blocks
  2011-12-27 21:12   ` Christian Moe
  2011-12-27 21:10     ` Eric Schulte
  2011-12-27 23:30     ` Nick Dokos
@ 2011-12-28 14:51     ` Charles Turner
  2011-12-29  5:18       ` Jambunathan K
  2011-12-29  6:14       ` Orthogonality of blocks Jambunathan K
  2 siblings, 2 replies; 17+ messages in thread
From: Charles Turner @ 2011-12-28 14:51 UTC (permalink / raw)
  To: mail; +Cc: emacs-orgmode, kjambunathan, Eric Schulte

On 27/12/11 21:12, Christian Moe wrote:
> will do it in HTML. Full example follows below. I'll leave LaTeX to
> those in the know...

Thanks. This was the "best" solution for me. I quote because the 
abstraction boundary between "how it's rendered" and "what I want to be 
rendered" is getting fuliginous. It would be much better imo to have 
blocks of first-class, and functions of higher-order on those blocks, so 
one could say (side-by-side block1 block2) and the side-by-side 
procedure would deal with the different format nuances. The idea is 
similar to that of the Henderson Escher examples in SICP[1], where you 
have "painters" and functions that combine "painters" in interesting 
ways.  Might be fun to investigate how far that can go with blocks in org.

@Jambunathan: Your examples render the blocks with sizes proportional to 
the contained text, rather than aligning as a table. I find that 
aesthetically displeasing :-(

Thanks all for the help.
	Charles.

[1] http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-15.html#%_sec_2.2.4

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Orthogonality of blocks
  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:14       ` Orthogonality of blocks Jambunathan K
  1 sibling, 1 reply; 17+ messages in thread
From: Jambunathan K @ 2011-12-29  5:18 UTC (permalink / raw)
  To: Charles Turner; +Cc: emacs-orgmode

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

Charles Turner <chturne@gmail.com> writes:

> @Jambunathan: Your examples render the blocks with sizes proportional
> to the contained text, rather than aligning as a table. I find that
> aesthetically displeasing :-(

I am unable to understand what "sizes proportional to the contained
text" means. What viewer are you using?

I am using a fairly recent version of LibreOffice (v3.4.4) and I see
that the positions of the blocks are a bit staggered (See portions
marked red in the attached png)

Furthermore, the srcline where the cursor is - marked with an ellipse -
uses OrgSrcBlockLastLine style. If the style were modified to
OrgSrcBlock style, I see that the above staggering gets less
accentuated. A plausible explanation for this behaviour is that the
"space below paragraph" introduced by "OrgSrcBlockLastLine" spills over
to the next paragraph which is in the second table column.

One of the reasons that the staggering persists is because of the change
in space settings between "Text_20_body" and "OrgSrcBlock" styles (Note
that the "Say Hello in ..." lines and the src block lines use different
 fonts and font sizes and different paragraph styles)

AFAIK, there is nothing amiss with the XML that the ODT exporter dumps
and I am inclined to think that the issue is with LibreOffice rendering
engine.

ps: I am not much concerned xhtml exporter as it is mostly a museum
piece cherished just by me.


[-- Attachment #2: side-by-side.png --]
[-- Type: image/png, Size: 78322 bytes --]

[-- Attachment #3: Type: text/plain, Size: 5 bytes --]


-- 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Enhancing table cell alignments and commenting columns (was Re: Orthogonality of blocks)
  2011-12-29  5:18       ` Jambunathan K
@ 2011-12-29  5:49         ` Jambunathan K
  2011-12-29  6:06           ` Jambunathan K
  2011-12-29 16:22           ` Jambunathan K
  0 siblings, 2 replies; 17+ messages in thread
From: Jambunathan K @ 2011-12-29  5:49 UTC (permalink / raw)
  To: Charles Turner; +Cc: emacs-orgmode

Jambunathan K <kjambunathan@gmail.com> writes:

> Charles Turner <chturne@gmail.com> writes:
>
>> @Jambunathan: Your examples render the blocks with sizes proportional
>> to the contained text, rather than aligning as a table. I find that
>> aesthetically displeasing :-(
>
> I am unable to understand what "sizes proportional to the contained
> text" means. What viewer are you using?
>
> I am using a fairly recent version of LibreOffice (v3.4.4) and I see
> that the positions of the blocks are a bit staggered (See portions
> marked red in the attached png)
>
> Furthermore, the srcline where the cursor is - marked with an ellipse -
> uses OrgSrcBlockLastLine style. If the style were modified to
> OrgSrcBlock style, I see that the above staggering gets less
> accentuated. A plausible explanation for this behaviour is that the
> "space below paragraph" introduced by "OrgSrcBlockLastLine" spills over
> to the next paragraph which is in the second table column.
>
> One of the reasons that the staggering persists is because of the change
> in space settings between "Text_20_body" and "OrgSrcBlock" styles (Note
> that the "Say Hello in ..." lines and the src block lines use different
>  fonts and font sizes and different paragraph styles)
>
> AFAIK, there is nothing amiss with the XML that the ODT exporter dumps
> and I am inclined to think that the issue is with LibreOffice rendering
> engine.

I am wrong, the issue is not with the LibreOffice but with my memory.

The srcblocks are actually aligned "centrally" (along the vertical axis)
within the table cell. Since the two blocks are of different
sizes/lengths the top border gets staggered.

Changing the alignment to "top" will fix the issue.

#+begin_src nxml :see OrgOdtContentTemplate.xml
    <style:style style:name="OrgTblCell" style:family="table-cell">
                                         @@@@@@@@@@@@@@@@@@@@@@@   
      <style:table-cell-properties style:vertical-align="middle" fo:padding="0.159cm" fo:border-top="none" fo:border-bottom="none" fo:border-left="none" fo:border-right="none"/>
    </style:style>
#+end_src

There colcookies that specify how a table column has to be
aligned. Currently there are specifiers only for left and right
alignment.

,---- (info "(org) Column width and alignment")
|    If you would like to overrule the automatic alignment of number-rich
| columns to the right and of string-rich column to the left, you can use
| `<r>', `c'(2) or `<l>' in a similar fashion.  You may also combine
| alignment and field width like this: `<l10>'.
`----

I think it would be useful to specify a "top" alignment specifier. There
is also a recent interest in commenting out certain Org-table columns
[1].

I think the colcookie lines could be enhnaced to also support "t" and
"/" characters. IMNSHO, using #+ATTR_ODT: lines for commenting out
columns will not only be cumbersome but also error-prone.

> ps: I am not much concerned xhtml exporter as it is mostly a museum
> piece cherished just by me.

Footnotes: 
[1]  http://lists.gnu.org/archive/html/emacs-orgmode/2011-12/msg00691.html

-- 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Enhancing table cell alignments and commenting columns (was Re: Orthogonality of blocks)
  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
  1 sibling, 0 replies; 17+ messages in thread
From: Jambunathan K @ 2011-12-29  6:06 UTC (permalink / raw)
  To: emacs-orgmode


> I think the colcookie lines could be enhnaced to also support "t" and
> "/" characters. IMNSHO, using #+ATTR_ODT: lines for commenting out
> columns will not only be cumbersome but also error-prone.

A random thought:

I think there will be more flexibility if the colcookies characters -
"l" and "r" - were actually style strings (of length > 1). The backend
can use their own discretion on how they "apply" these styles.

There was some interest to mark certain columns specially - for example,
mark automatically computed derived columns specially (both in Org and
may be in the different backends). The colcookie could line could be put
to some use here. (Question: Is there a way to fontify a rectangle in
Emacs?)

On a related note:

From ODT perspective and taking a cue from the way LibreOffice does
autoformatting of tables, I was thinking of introducing "template
tables" whose only job is to specify the styles to be associated with
each of the different categories of table cells.

OpenDocument talks of following types of columns and LibreOffice's
autoformatting is much richer and recognizes, I believe, as much as 16
categories of table cells.

,---- C-h v org-export-odt-table-styles
| TABLE-CELL-TYPE       := "FirstRow"   | "LastColumn" |
|                          "FirstRow"   | "LastRow"    |
|                          "EvenRow"    | "OddRow"     |
|                          "EvenColumn" | "OddColumn"  | ""
| 
`----

#+ATTR_ODT: template-table
| red | green | yellow |
|-----+-------+--------|
|     |       |        |

ps: I don't have time to implement the above features. I am just
capturing my thoughts so that it is archived.

-- 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Orthogonality of blocks
  2011-12-28 14:51     ` Charles Turner
  2011-12-29  5:18       ` Jambunathan K
@ 2011-12-29  6:14       ` Jambunathan K
  1 sibling, 0 replies; 17+ messages in thread
From: Jambunathan K @ 2011-12-29  6:14 UTC (permalink / raw)
  To: Charles Turner; +Cc: emacs-orgmode, mail, Eric Schulte


If I look at the figures in the link provided, I am reminded of table.el
tables. 

Put your different src blocks in table.el tables, this way even if you
don't get fontification of src blocks atleast you will have a
side-by-side output with both html and latex backends.

Charles Turner <chturne@gmail.com> writes:

> On 27/12/11 21:12, Christian Moe wrote:
>> will do it in HTML. Full example follows below. I'll leave LaTeX to
>> those in the know...
>
> Thanks. This was the "best" solution for me. I quote because the
> abstraction boundary between "how it's rendered" and "what I want to
> be rendered" is getting fuliginous. It would be much better imo to
> have blocks of first-class, and functions of higher-order on those
> blocks, so one could say (side-by-side block1 block2) and the
> side-by-side procedure would deal with the different format
> nuances. The idea is similar to that of the Henderson Escher examples
> in SICP[1], where you have "painters" and functions that combine
> "painters" in interesting ways.  Might be fun to investigate how far
> that can go with blocks in org.
>
> @Jambunathan: Your examples render the blocks with sizes proportional
> to the contained text, rather than aligning as a table. I find that
> aesthetically displeasing :-(
>
> Thanks all for the help.
> 	Charles.
>
> [1] http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-15.html#%_sec_2.2.4
>
>

-- 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Enhancing table cell alignments and commenting columns (was Re: Orthogonality of blocks)
  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
  1 sibling, 0 replies; 17+ messages in thread
From: Jambunathan K @ 2011-12-29 16:22 UTC (permalink / raw)
  To: emacs-orgmode


> I am wrong, the issue is not with the LibreOffice but with my memory.
>
> The srcblocks are actually aligned "centrally" (along the vertical axis)
> within the table cell. Since the two blocks are of different
> sizes/lengths the top border gets staggered.
>
> Changing the alignment to "top" will fix the issue.

I have pushed a fix to this effect. Table cells will now be
"top"-aligned by default in ODT export.
-- 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Orthogonality of blocks
  2011-12-27 19:46 Orthogonality of blocks Charles Turner
  2011-12-27 20:37 ` Eric Schulte
@ 2011-12-30 14:17 ` Eric S Fraga
  1 sibling, 0 replies; 17+ messages in thread
From: Eric S Fraga @ 2011-12-30 14:17 UTC (permalink / raw)
  To: Charles Turner; +Cc: emacs-orgmode

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.
>
> Is this possible? It doesn't seem to be. I think it would be nice to
> shove collapsed blocks into org table cells and have them rendered in
> the usual fashion with the different exporters. "First-class blocks"
> :-)
>
> Thanks,
> 	Charles.

I know you have received answers for both HTML and ODT.  This is also
possible with latex.  One possible solution is as follows:

#+begin_src org
* Source code blocks arranged horizontally

  #+latex: \newsavebox{\blockone}\begin{lrbox}{\blockone}
#+begin_src octave :exports code :results silent
function f(x)
  y = 2*x;
end
#+end_src
  #+latex: \end{lrbox}

  #+latex: \newsavebox{\blocktwo}\begin{lrbox}{\blocktwo}
#+begin_src octave :exports code :results silent
a = 10;
b = f(a);
disp(b)
#+end_src
  #+latex: \end{lrbox}

  | Function definition | Function use       |
  |---------------------+--------------------|
  | \usebox{\blockone}  | \usebox{\blocktwo} |
  |---------------------+--------------------|

#+end_src

I hope this makes sense but basically you save the output of the
formatting of the blocks into latex boxes which you later place wherever
you want.  The side benefit is you can use these blocks more than one...

HTH,
eric
-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.92.1
: using Org-mode version 7.8.02 (release_7.8.02.55.g1870)

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2011-12-30 14:17 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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