emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* #+CALL get the first row of output table lost when using latex export
@ 2014-11-15 15:34 iemacs
  2014-11-16 18:37 ` Charles Berry
  0 siblings, 1 reply; 5+ messages in thread
From: iemacs @ 2014-11-15 15:34 UTC (permalink / raw)
  To: org-mode mailing list

Hi,

I encounter a problem when I use #+CALL to create a table with latex
export.  The problem is that the first row of the table is missing, if
the table is created with #+CALL.

My Emacs version is GNU Emacs 24.4.3 (x86_64-apple-darwin13.4.0,
Carbon Version 157 AppKit 1265.21) of 2014-11-04 on Atago.local.  The
Org-mode version is: 8.2.10 from orgmode.org homepage.

I start emacs -q -l emacs.minimal, where emacs.minimal is
#+BEGIN_EXAMPLE
(add-to-list 'load-path (expand-file-name "~/myconfig/org-8.2.10/lisp"))
(add-to-list 'auto-mode-alist '("\\.\\(org\\  |org_archive\\|txt\\)$"
. org-mode))

(add-to-list 'load-path (expand-file-name "~/myconfig/org-8.2.10/contrib/lisp"))

(org-babel-do-load-languages
 'org-babel-load-languages
 '((python . t)
   (latex . t)))
#+END_EXAMPLE

The minimal table example is

#+BEGIN_EXAMPLE
#+NAME: t1
#+BEGIN_SRC python :exports results
  return [['A'],None,[2]]
#+END_SRC

#+CAPTION: T1
#+RESULTS: t1

#+NAME: t2
#+CALL: t1() :exports results

#+CAPTION: T2
#+RESULTS: t2
#+END_EXAMPLE

The latex output of Table T1 is:

#+BEGIN_EXAMPLE
\begin{table}[htb]
\caption{T1}
\centering
\begin{tabular}{r}
A\\
\hline
2\\
\end{tabular}
\end{table}
#+END_EXAMPLE

The latex output of Table T2 is:

#+BEGIN_EXAMPLE
\begin{table}[htb]
\caption{T2}
\centering
\begin{tabular}{r}
2\\
\end{tabular}
\end{table}
#+END_EXAMPLE

Compare with the latex output of the two tables, the first row and the
\hline in the first table is missing in the second one.


Kind regards,

Tian Qiu

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

* Re: #+CALL get the first row of output table lost when using latex export
  2014-11-15 15:34 #+CALL get the first row of output table lost when using latex export iemacs
@ 2014-11-16 18:37 ` Charles Berry
  2014-11-17 14:43   ` iemacs
  0 siblings, 1 reply; 5+ messages in thread
From: Charles Berry @ 2014-11-16 18:37 UTC (permalink / raw)
  To: emacs-orgmode

 <iemacs <at> gmail.com> writes:

> 
> Hi,
> 
> I encounter a problem when I use #+CALL to create a table with latex
> export.  The problem is that the first row of the table is missing, if
> the table is created with #+CALL.
> 
[deleted - setup info]

> The minimal table example is
> 
> #+BEGIN_EXAMPLE
> #+NAME: t1
> #+BEGIN_SRC python :exports results
>   return [['A'],None,[2]]
> #+END_SRC
> 
> #+CAPTION: T1
> #+RESULTS: t1
> 
> #+NAME: t2
> #+CALL: t1() :exports results
> 
> #+CAPTION: T2
> #+RESULTS: t2
> #+END_EXAMPLE
> 

This is not a latex issue per se. If you evaluate t2 with  

  `org-babel-execute-maybe'

the same thing will happen.

org-babel-execute:python does its own formatting. #+CALL: OTOH passes 
the results to babel.

The workaround is to use 

  #+CALL: t1() :colnames yes

HTH,

Chuck

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

* Re: #+CALL get the first row of output table lost when using latex export
  2014-11-16 18:37 ` Charles Berry
@ 2014-11-17 14:43   ` iemacs
  2014-11-17 16:08     ` Charles C. Berry
  0 siblings, 1 reply; 5+ messages in thread
From: iemacs @ 2014-11-17 14:43 UTC (permalink / raw)
  To: Charles Berry; +Cc: org-mode mailing list

Thank you, Charles.  And =:colnames yes= does work here.  But the
results are the same when I evaluate t1 and t2 with
`org-babel-execute-maybe'.

When I take another try, new problem seems to occur.

The test file is:
#+BEGIN_EXAMPLE
#+NAME: t1
#+BEGIN_SRC python :exports results
  return [['A'],None,[2],None,[3]]
#+END_SRC

#+CAPTION: T1
#+RESULTS: t1

#+NAME: t2
#+CALL: t1() :exports results

#+CAPTION: T2
#+RESULTS: t2
#+END_EXAMPLE

The results of `org-babel-execute-maybe' on t1 and t2 are identical:
#+BEGIN_SRC org
  | A |
  |---|
  | 2 |
  |---|
  | 3 |
#+END_SRC

The relevant part of the latex output is:
#+BEGIN_SRC latex
  \begin{table}[htb]
  \caption{T1}
  \centering
  \begin{tabular}{r}
  A\\
  \hline
  2\\
  \hline
  3\\
  \end{tabular}
  \end{table}

  \begin{table}[htb]
  \caption{T2}
  \centering
  \begin{tabular}{r}
  A\\
  2\\
  3\\
  \end{tabular}
  \end{table}
#+END_SRC

Both \hlines in Table T2 are missing.



Kind regards,

Tian Qiu


On Sun, Nov 16, 2014 at 1:37 PM, Charles Berry <ccberry@ucsd.edu> wrote:
>  <iemacs <at> gmail.com> writes:
>
>>
>> Hi,
>>
>> I encounter a problem when I use #+CALL to create a table with latex
>> export.  The problem is that the first row of the table is missing, if
>> the table is created with #+CALL.
>>
> [deleted - setup info]
>
>> The minimal table example is
>>
>> #+BEGIN_EXAMPLE
>> #+NAME: t1
>> #+BEGIN_SRC python :exports results
>>   return [['A'],None,[2]]
>> #+END_SRC
>>
>> #+CAPTION: T1
>> #+RESULTS: t1
>>
>> #+NAME: t2
>> #+CALL: t1() :exports results
>>
>> #+CAPTION: T2
>> #+RESULTS: t2
>> #+END_EXAMPLE
>>
>
> This is not a latex issue per se. If you evaluate t2 with
>
>   `org-babel-execute-maybe'
>
> the same thing will happen.
>
> org-babel-execute:python does its own formatting. #+CALL: OTOH passes
> the results to babel.
>
> The workaround is to use
>
>   #+CALL: t1() :colnames yes
>
> HTH,
>
> Chuck
>
>
>

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

* Re: #+CALL get the first row of output table lost when using latex export
  2014-11-17 14:43   ` iemacs
@ 2014-11-17 16:08     ` Charles C. Berry
  2014-11-19 14:48       ` iemacs
  0 siblings, 1 reply; 5+ messages in thread
From: Charles C. Berry @ 2014-11-17 16:08 UTC (permalink / raw)
  To: iemacs; +Cc: org-mode mailing list

On Mon, 17 Nov 2014, iemacs@gmail.com wrote:

> Thank you, Charles.  And =:colnames yes= does work here.  But the
> results are the same when I evaluate t1 and t2 with
> `org-babel-execute-maybe'.
>
> When I take another try, new problem seems to occur.
>
> The test file is:
> #+BEGIN_EXAMPLE
> #+NAME: t1
> #+BEGIN_SRC python :exports results
>  return [['A'],None,[2],None,[3]]
> #+END_SRC
>
> #+CAPTION: T1
> #+RESULTS: t1
>
> #+NAME: t2
> #+CALL: t1() :exports results
>
> #+CAPTION: T2
> #+RESULTS: t2
> #+END_EXAMPLE
>
> The results of `org-babel-execute-maybe' on t1 and t2 are identical:
> #+BEGIN_SRC org
>  | A |
>  |---|
>  | 2 |
>  |---|
>  | 3 |
> #+END_SRC

Not in my world (unless you add `:hlines').

,----
| #+NAME: t1
| #+BEGIN_SRC python :exports results
|   return [['A'],None,[2],None,[3]]
| #+END_SRC
|
| #+CAPTION: T1
| #+RESULTS: t1
| | A |
| |---|
| | 2 |
| |---|
| | 3 |
|
| #+NAME: t2
| #+CALL: t1() :exports results
|
| #+CAPTION: T2
| #+RESULTS: t2
| | A |
| | 2 |
| | 3 |
`----


ob-python.el seems to be doing its own thing here.

What you see in the second instance is the usual Babel output for a table.

In my view this is a bug in ob-python.el.

See: (info "(org) hlines") for the proper idiom.

HTH,

Chuck

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

* Re: #+CALL get the first row of output table lost when using latex export
  2014-11-17 16:08     ` Charles C. Berry
@ 2014-11-19 14:48       ` iemacs
  0 siblings, 0 replies; 5+ messages in thread
From: iemacs @ 2014-11-19 14:48 UTC (permalink / raw)
  To: Charles C. Berry; +Cc: org-mode mailing list

#+NAME: t2
#+CALL: t1() :exports results :hlines yes
will give the right latex output,  thank you!


Kind regards,

Tian Qiu


On Mon, Nov 17, 2014 at 11:08 AM, Charles C. Berry <ccberry@ucsd.edu> wrote:
> On Mon, 17 Nov 2014, iemacs@gmail.com wrote:
>
>> Thank you, Charles.  And =:colnames yes= does work here.  But the
>> results are the same when I evaluate t1 and t2 with
>> `org-babel-execute-maybe'.
>>
>> When I take another try, new problem seems to occur.
>>
>> The test file is:
>> #+BEGIN_EXAMPLE
>> #+NAME: t1
>> #+BEGIN_SRC python :exports results
>>  return [['A'],None,[2],None,[3]]
>> #+END_SRC
>>
>> #+CAPTION: T1
>> #+RESULTS: t1
>>
>> #+NAME: t2
>> #+CALL: t1() :exports results
>>
>> #+CAPTION: T2
>> #+RESULTS: t2
>> #+END_EXAMPLE
>>
>> The results of `org-babel-execute-maybe' on t1 and t2 are identical:
>> #+BEGIN_SRC org
>>  | A |
>>  |---|
>>  | 2 |
>>  |---|
>>  | 3 |
>> #+END_SRC
>
>
> Not in my world (unless you add `:hlines').
>
> ,----
> | #+NAME: t1
> | #+BEGIN_SRC python :exports results
> |   return [['A'],None,[2],None,[3]]
> | #+END_SRC
> |
> | #+CAPTION: T1
> | #+RESULTS: t1
> | | A |
> | |---|
> | | 2 |
> | |---|
> | | 3 |
> |
> | #+NAME: t2
> | #+CALL: t1() :exports results
> |
> | #+CAPTION: T2
> | #+RESULTS: t2
> | | A |
> | | 2 |
> | | 3 |
> `----
>
>
> ob-python.el seems to be doing its own thing here.
>
> What you see in the second instance is the usual Babel output for a table.
>
> In my view this is a bug in ob-python.el.
>
> See: (info "(org) hlines") for the proper idiom.
>
> HTH,
>
> Chuck

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

end of thread, other threads:[~2014-11-19 14:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-15 15:34 #+CALL get the first row of output table lost when using latex export iemacs
2014-11-16 18:37 ` Charles Berry
2014-11-17 14:43   ` iemacs
2014-11-17 16:08     ` Charles C. Berry
2014-11-19 14:48       ` iemacs

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