emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* LaTeX export of tables
@ 2009-10-13 10:35 Francesco Pizzolante
       [not found] ` <873a5nr379.fsf-djc/iPCCuDYQheJpep6IedvLeJWuRmrY@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Francesco Pizzolante @ 2009-10-13 10:35 UTC (permalink / raw)
  To: mailing-list-org-mode

Hi,

When exporting tables to LaTeX, I think it would be good to have the following
options to be able to define:

  - the table environment to be used: now we have the option to have tabular
    and longtable, but I could also use array, tabular*, tabularx, tabulary,
    etc.

    The general rule is:

    \begin{TABLEENV}{WIDTH}[VPOS]{COLS}
    ROWS
    \end{TABLEENV}

    TABLEENV can be any of tabular, array, tabular*, tabularx, etc., depending
    on the type of table I want.

    Some types of table need a WIDTH to be specified; in this case, I would
    add a WIDTH option. An extra vertical position VPOS option can also be
    added to some types of table.

    The COLS parameter already receives the value from the "align" org
    attribute.

    The following options

    #+ATTR_LATEX: tabularx width=\textwidth align=lX vpos=tb

    would generate the following LaTeX code:

    \begin{tabularx}{\textwidth}[tb]{lX}
    ROWS
    \end{tabularx}


  - the rule to be used as hline (similar option as in
    #+ORGTBL: :hline="\\midrule"):

    #+ATTR_LATEX: hline=midrule or #+ATTR_LATEX: hline="\\midrule"


  - define the top and bottom rules:

    #+ATTR_LATEX: toprule="\\toprule" bottomrule="\\bottomrule"


Does it make sense? Would it be possible to have these new options in a future
orgmode release?

Thanks a lot.
Francesco


_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: LaTeX export of tables
       [not found] ` <873a5nr379.fsf-djc/iPCCuDYQheJpep6IedvLeJWuRmrY@public.gmane.org>
@ 2009-10-19 11:58   ` Francesco Pizzolante
  2009-10-19 18:05     ` Darlan Cavalcante Moreira
  2009-10-20  8:17     ` Carsten Dominik
  0 siblings, 2 replies; 13+ messages in thread
From: Francesco Pizzolante @ 2009-10-19 11:58 UTC (permalink / raw)
  To: mailing-list-org-mode

Hi,

Can I give this thread a bump?

Francesco Pizzolante wrote:
> Hi,
>
> When exporting tables to LaTeX, I think it would be good to have the following
> options to be able to define:
>
>   - the table environment to be used: now we have the option to have tabular
>     and longtable, but I could also use array, tabular*, tabularx, tabulary,
>     etc.
>
>     The general rule is:
>
>     \begin{TABLEENV}{WIDTH}[VPOS]{COLS}
>     ROWS
>     \end{TABLEENV}
>
>     TABLEENV can be any of tabular, array, tabular*, tabularx, etc., depending
>     on the type of table I want.
>
>     Some types of table need a WIDTH to be specified; in this case, I would
>     add a WIDTH option. An extra vertical position VPOS option can also be
>     added to some types of table.
>
>     The COLS parameter already receives the value from the "align" org
>     attribute.
>
>     The following options
>
>     #+ATTR_LATEX: tabularx width=\textwidth align=lX vpos=tb
>
>     would generate the following LaTeX code:
>
>     \begin{tabularx}{\textwidth}[tb]{lX}
>     ROWS
>     \end{tabularx}
>
>
>   - the rule to be used as hline (similar option as in
>     #+ORGTBL: :hline="\\midrule"):
>
>     #+ATTR_LATEX: hline=midrule or #+ATTR_LATEX: hline="\\midrule"
>
>
>   - define the top and bottom rules:
>
>     #+ATTR_LATEX: toprule="\\toprule" bottomrule="\\bottomrule"
>
>
> Does it make sense? Would it be possible to have these new options in a future
> orgmode release?

I really am eager to use orgmode in order to generate all my LaTeX documents.
But, as of now, the LaTeX export of tables offers only limited flexibility.

My proposal is simply to add a few org attributes (type of the table, toprule,
bottomrule, hline, vpos) in order to get an improved flexibility when
generating LaTeX tables.

Can someone take care of my request?

Thanks a lot,
Francesco


_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: LaTeX export of tables
  2009-10-19 11:58   ` Francesco Pizzolante
@ 2009-10-19 18:05     ` Darlan Cavalcante Moreira
  2009-10-20  8:17     ` Carsten Dominik
  1 sibling, 0 replies; 13+ messages in thread
From: Darlan Cavalcante Moreira @ 2009-10-19 18:05 UTC (permalink / raw)
  To: Francesco Pizzolante; +Cc: mailing-list-org-mode


If you are going to export only to LaTeX then you may just write the table in
latex syntax. Org-mode will recognize the latex environment and export it as it
is for latex. For HTML the table will be exported as a image, since it is a
"latex table" instead of an "org-mode table". It is not as convenient, but at
least you get what you want for now.

If you need to publish to another format then maybe there is a way to tell
org-mode to export certain part of the file only in latex, and other part only
in HTML. In this way you could have your elaborated table when publishing in
latex and a table following the org-mode syntax when publishing in HTML.


Darlan

At Mon, 19 Oct 2009 13:58:07 +0200,
Francesco Pizzolante <fpz@missioncriticalit.com> wrote:
> 
> Hi,
> 
> Can I give this thread a bump?
> 
> Francesco Pizzolante wrote:
> > Hi,
> >
> > When exporting tables to LaTeX, I think it would be good to have the following
> > options to be able to define:
> >
> >   - the table environment to be used: now we have the option to have tabular
> >     and longtable, but I could also use array, tabular*, tabularx, tabulary,
> >     etc.
> >
> >     The general rule is:
> >
> >     \begin{TABLEENV}{WIDTH}[VPOS]{COLS}
> >     ROWS
> >     \end{TABLEENV}
> >
> >     TABLEENV can be any of tabular, array, tabular*, tabularx, etc., depending
> >     on the type of table I want.
> >
> >     Some types of table need a WIDTH to be specified; in this case, I would
> >     add a WIDTH option. An extra vertical position VPOS option can also be
> >     added to some types of table.
> >
> >     The COLS parameter already receives the value from the "align" org
> >     attribute.
> >
> >     The following options
> >
> >     #+ATTR_LATEX: tabularx width=\textwidth align=lX vpos=tb
> >
> >     would generate the following LaTeX code:
> >
> >     \begin{tabularx}{\textwidth}[tb]{lX}
> >     ROWS
> >     \end{tabularx}
> >
> >
> >   - the rule to be used as hline (similar option as in
> >     #+ORGTBL: :hline="\\midrule"):
> >
> >     #+ATTR_LATEX: hline=midrule or #+ATTR_LATEX: hline="\\midrule"
> >
> >
> >   - define the top and bottom rules:
> >
> >     #+ATTR_LATEX: toprule="\\toprule" bottomrule="\\bottomrule"
> >
> >
> > Does it make sense? Would it be possible to have these new options in a future
> > orgmode release?
> 
> I really am eager to use orgmode in order to generate all my LaTeX documents.
> But, as of now, the LaTeX export of tables offers only limited flexibility.
> 
> My proposal is simply to add a few org attributes (type of the table, toprule,
> bottomrule, hline, vpos) in order to get an improved flexibility when
> generating LaTeX tables.
> 
> Can someone take care of my request?
> 
> Thanks a lot,
> Francesco
> 
> 
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: LaTeX export of tables
  2009-10-19 11:58   ` Francesco Pizzolante
  2009-10-19 18:05     ` Darlan Cavalcante Moreira
@ 2009-10-20  8:17     ` Carsten Dominik
  1 sibling, 0 replies; 13+ messages in thread
From: Carsten Dominik @ 2009-10-20  8:17 UTC (permalink / raw)
  To: Francesco Pizzolante; +Cc: mailing-list-org-mode


On Oct 19, 2009, at 1:58 PM, Francesco Pizzolante wrote:

> Hi,
>
> Can I give this thread a bump?

Hi Francesco,

Org-mode LaTeX export is intended to give you a way to
export your file as LaTeX.  It can never hope to give you
all the formatting options LaTeX has.  Sure, what you are saying could  
be implemented, but so could many other things.  If you can come up  
with a patch, I would consider it, but I am so strained to keep up  
with the daily stuff, I don't expect to be able to put time into this.

An alternative to do this is to post-process your file using one of
the hooks and to switch out the environment used at that moment.

- Carsten

>
> Francesco Pizzolante wrote:
>> Hi,
>>
>> When exporting tables to LaTeX, I think it would be good to have  
>> the following
>> options to be able to define:
>>
>>  - the table environment to be used: now we have the option to have  
>> tabular
>>    and longtable, but I could also use array, tabular*, tabularx,  
>> tabulary,
>>    etc.
>>
>>    The general rule is:
>>
>>    \begin{TABLEENV}{WIDTH}[VPOS]{COLS}
>>    ROWS
>>    \end{TABLEENV}
>>
>>    TABLEENV can be any of tabular, array, tabular*, tabularx, etc.,  
>> depending
>>    on the type of table I want.
>>
>>    Some types of table need a WIDTH to be specified; in this case,  
>> I would
>>    add a WIDTH option. An extra vertical position VPOS option can  
>> also be
>>    added to some types of table.
>>
>>    The COLS parameter already receives the value from the "align" org
>>    attribute.
>>
>>    The following options
>>
>>    #+ATTR_LATEX: tabularx width=\textwidth align=lX vpos=tb
>>
>>    would generate the following LaTeX code:
>>
>>    \begin{tabularx}{\textwidth}[tb]{lX}
>>    ROWS
>>    \end{tabularx}
>>
>>
>>  - the rule to be used as hline (similar option as in
>>    #+ORGTBL: :hline="\\midrule"):
>>
>>    #+ATTR_LATEX: hline=midrule or #+ATTR_LATEX: hline="\\midrule"
>>
>>
>>  - define the top and bottom rules:
>>
>>    #+ATTR_LATEX: toprule="\\toprule" bottomrule="\\bottomrule"
>>
>>
>> Does it make sense? Would it be possible to have these new options  
>> in a future
>> orgmode release?
>
> I really am eager to use orgmode in order to generate all my LaTeX  
> documents.
> But, as of now, the LaTeX export of tables offers only limited  
> flexibility.
>
> My proposal is simply to add a few org attributes (type of the  
> table, toprule,
> bottomrule, hline, vpos) in order to get an improved flexibility when
> generating LaTeX tables.
>
> Can someone take care of my request?
>
> Thanks a lot,
> Francesco
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

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

* Latex export of tables
@ 2013-04-12  8:06 Vikas Rawal
  2013-04-14 23:29 ` Suvayu Ali
  0 siblings, 1 reply; 13+ messages in thread
From: Vikas Rawal @ 2013-04-12  8:06 UTC (permalink / raw)
  To: emacs-orgmode

I am using org-mode version 8.0-pre (release_8.0-pre-247-gbc3ccd @
/home/vikas/lisp/org-mode/lisp/).

I have a table generated by a source block in a document that I would
like to export to latex. In the exported tex file, I would like org to
insert a line like the following between \end(tabular} and \end{table}

\begin{minipage}{\textwidth} \tiny Note: Some descriptive text here. \end{minipage}

Can somebody suggest what I could do to insert this?

I have been playing with something like the following but am not able
to get it right.

#+LATEX: {
#+NAME: table-name-out
#+CAPTION: Average gross value of output and net income from cultivation of wheat intercropped with rapeseed, by class, Mahatwar (Rupees per acre, 2005-06 prices)
#+attr_latex: :environment tabulary :width 15cm :align l|RRR 
#+RESULTS: source_code_name
| A | B | C |
|---+---+---|
| 1 | 1 | 1 |
| 1 | 2 | 3 |
| 2 | 2 | 4 |
#+LATEX: \begin{minipage}{} \tiny Note: Some descriptive text here.#\end{minipage}  }

Vikas

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

* Re: Latex export of tables
  2013-04-12  8:06 Latex " Vikas Rawal
@ 2013-04-14 23:29 ` Suvayu Ali
  2013-04-16 11:56   ` Vikas Rawal
  0 siblings, 1 reply; 13+ messages in thread
From: Suvayu Ali @ 2013-04-14 23:29 UTC (permalink / raw)
  To: emacs-orgmode

Hello Vikas,

On Fri, Apr 12, 2013 at 01:36:01PM +0530, Vikas Rawal wrote:
> I am using org-mode version 8.0-pre (release_8.0-pre-247-gbc3ccd @
> /home/vikas/lisp/org-mode/lisp/).
> 
> I have a table generated by a source block in a document that I would
> like to export to latex. In the exported tex file, I would like org to
> insert a line like the following between \end(tabular} and \end{table}
> 
> \begin{minipage}{\textwidth} \tiny Note: Some descriptive text here. \end{minipage}

I do not think this is possible.  You have to realise that Org does not
aim to support everything you can do with a backend natively.  One of
the primary reasons for that is the backend agnostic abstraction
provided by Org.

When in need of specific needs like this, I resort to writing LaTeX
natively.

Hope this helps somehow,

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Latex export of tables
  2013-04-14 23:29 ` Suvayu Ali
@ 2013-04-16 11:56   ` Vikas Rawal
  2013-04-16 13:13     ` Thomas Alexander Gerds
  2013-04-16 17:39     ` Suvayu Ali
  0 siblings, 2 replies; 13+ messages in thread
From: Vikas Rawal @ 2013-04-16 11:56 UTC (permalink / raw)
  To: Suvayu Ali; +Cc: emacs-orgmode

> > I am using org-mode version 8.0-pre (release_8.0-pre-247-gbc3ccd @
> > /home/vikas/lisp/org-mode/lisp/).
> > 
> > I have a table generated by a source block in a document that I would
> > like to export to latex. In the exported tex file, I would like org to
> > insert a line like the following between \end(tabular} and \end{table}
> > 
> > \begin{minipage}{\textwidth} \tiny Note: Some descriptive text here. \end{minipage}
> 
> I do not think this is possible.  You have to realise that Org does not
> aim to support everything you can do with a backend natively.  One of
> the primary reasons for that is the backend agnostic abstraction
> provided by Org.

I have seen some way of doing things like this. See section 13.3 at
http://orgmode.org/worg/org-tutorials/org-latex-export.html

I can't get it to work though. Will keep trying.

> 
> When in need of specific needs like this, I resort to writing LaTeX
> natively.

I guess one thing about org-mode is that it is addictive. Afterall, if
it is something to do with manipulating text, it ought to be possible
:)

There is also a reason for not doing it natively in latex even if the
org-mode solution is somewhat round-about. I am writing a research
paper using orgmode, with embedded R source blocks in it. I do not
mind embedding some latex source block into it but I would not like to
edit an exported latex file. After all, in the end, the objective is
to be able to have an org file which produces a full paper when exported.

Vikas

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

* Re: Latex export of tables
  2013-04-16 11:56   ` Vikas Rawal
@ 2013-04-16 13:13     ` Thomas Alexander Gerds
  2013-04-16 17:39     ` Suvayu Ali
  1 sibling, 0 replies; 13+ messages in thread
From: Thomas Alexander Gerds @ 2013-04-16 13:13 UTC (permalink / raw)
  To: Vikas Rawal; +Cc: emacs-orgmode

Hi Vikas

I am not sure I understand the problem correctly, but how about this?

Here is a table produced by a R-src block
with some descriptive text in a minipage:

-----------------------snip----------------------------------------------

#+BEGIN_SRC R  :results output latex  :exports results  :session *R* :cache yes 
tab <- matrix(1:12,nrow=4)
cat("\n\\begin{table}\n")
cat("\\begin{minipage}{\\textwidth}\n")
cat("\\tiny{ Note: some descriptive text}\n")
cat("\\end{minipage}\n")
nix <- apply(tab,1,function(x)cat(paste(x,collab="&"),"\\\\\n"))
cat("\\end{table}\n")
#+END_SRC

#+RESULTS[<2013-04-16 15:11:58> 964853177d477abc1cba212a72dde1f7cf3251c0]:
#+BEGIN_LaTeX

\begin{table}
\begin{minipage}{\textwidth}
\tiny{ Note: some descriptive text}
\end{minipage}
1 & 5 & 9 & \\
2 & 6 & 10 & \\
3 & 7 & 11 & \\
4 & 8 & 12 & \\
\end{table}
#+END_LaTeX

-----------------------snap----------------------------------------------

cheers Thomas

Vikas Rawal <vikaslists@agrarianresearch.org> writes:

>> > I am using org-mode version 8.0-pre (release_8.0-pre-247-gbc3ccd @
>> > /home/vikas/lisp/org-mode/lisp/).
>> > 
>> > I have a table generated by a source block in a document that I
>> > would like to export to latex. In the exported tex file, I would
>> > like org to insert a line like the following between \end(tabular}
>> > and \end{table}
>> > 
>> > \begin{minipage}{\textwidth} \tiny Note: Some descriptive text
>> > here. \end{minipage}
>>  I do not think this is possible.  You have to realise that Org does
>> not aim to support everything you can do with a backend natively.
>> One of the primary reasons for that is the backend agnostic
>> abstraction provided by Org.
>
> I have seen some way of doing things like this. See section 13.3 at
> http://orgmode.org/worg/org-tutorials/org-latex-export.html
>
> I can't get it to work though. Will keep trying.
>
>>  When in need of specific needs like this, I resort to writing LaTeX
>> natively.
>
> I guess one thing about org-mode is that it is addictive. Afterall, if
> it is something to do with manipulating text, it ought to be possible
> :)
>
> There is also a reason for not doing it natively in latex even if the
> org-mode solution is somewhat round-about. I am writing a research
> paper using orgmode, with embedded R source blocks in it. I do not
> mind embedding some latex source block into it but I would not like to
> edit an exported latex file. After all, in the end, the objective is
> to be able to have an org file which produces a full paper when
> exported.
>
> Vikas
--
Thomas A. Gerds -- Assoc. Prof. Department of Biostatistics
University of Copenhagen, Øster Farimagsgade 5, 1014 Copenhagen, Denmark
Office: CSS-15.2.07 (Gamle Kommunehospital)
tel: 35327914 (sec: 35327901) 

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

* Re: Latex export of tables
  2013-04-16 11:56   ` Vikas Rawal
  2013-04-16 13:13     ` Thomas Alexander Gerds
@ 2013-04-16 17:39     ` Suvayu Ali
  2013-04-16 20:07       ` Thomas S. Dye
  1 sibling, 1 reply; 13+ messages in thread
From: Suvayu Ali @ 2013-04-16 17:39 UTC (permalink / raw)
  To: emacs-orgmode

Hi Vikas,

On Tue, Apr 16, 2013 at 05:26:19PM +0530, Vikas Rawal wrote:
> > > I am using org-mode version 8.0-pre (release_8.0-pre-247-gbc3ccd @
> > > /home/vikas/lisp/org-mode/lisp/).
> > > 
> > > I have a table generated by a source block in a document that I would
> > > like to export to latex. In the exported tex file, I would like org to
> > > insert a line like the following between \end(tabular} and \end{table}
> > > 
> > > \begin{minipage}{\textwidth} \tiny Note: Some descriptive text here. \end{minipage}
> > 
> > I do not think this is possible.  You have to realise that Org does not
> > aim to support everything you can do with a backend natively.  One of
> > the primary reasons for that is the backend agnostic abstraction
> > provided by Org.
> 
> I have seen some way of doing things like this. See section 13.3 at
> http://orgmode.org/worg/org-tutorials/org-latex-export.html
> 
> I can't get it to work though. Will keep trying.

Many of the things on that page is old exporter specific and probably
will not work with the new exporter.

> There is also a reason for not doing it natively in latex even if the
> org-mode solution is somewhat round-about. I am writing a research
> paper using orgmode, with embedded R source blocks in it. I do not
> mind embedding some latex source block into it but I would not like to
> edit an exported latex file. After all, in the end, the objective is
> to be able to have an org file which produces a full paper when exported.

Then generate LaTeX tables from R not Org tables.  As far as I know, R
is capable of that.  I believe you can pass the ":wrap latex" option to
the babel block to wrap your LaTeX table with
"#+begin_latex..#+end_latex".

I'm suggesting this because if you continue on this path, i.e. litter
your Org file with hacks, soon you will end up with an extremely fragile
and complicated Org project.  I have been down that road while writing
my thesis.  At one point I realised the problem and made the decision to
split things into two kinds of files: static content (document
structuring, text, plots, etc), and dynamic content (babel, TikZ blocks
that generate tables, plots, figures, etc used by the static content
files).  It is still reproducible research, but modular and less hacky
(hence more stable).

Of course all of this is my personal opinion, it might be completely
inappropriate advise for your use case.

Good luck,

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Latex export of tables
  2013-04-16 17:39     ` Suvayu Ali
@ 2013-04-16 20:07       ` Thomas S. Dye
  2013-04-16 21:39         ` Suvayu Ali
  0 siblings, 1 reply; 13+ messages in thread
From: Thomas S. Dye @ 2013-04-16 20:07 UTC (permalink / raw)
  To: Suvayu Ali; +Cc: emacs-orgmode

Aloha all,

Jumping in here with apologies :)

Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:

> Hi Vikas,
>
> On Tue, Apr 16, 2013 at 05:26:19PM +0530, Vikas Rawal wrote:
>> > > I am using org-mode version 8.0-pre (release_8.0-pre-247-gbc3ccd @
>> > > /home/vikas/lisp/org-mode/lisp/).
>> > > 
>> > > I have a table generated by a source block in a document that I would
>> > > like to export to latex. In the exported tex file, I would like org to
>> > > insert a line like the following between \end(tabular} and \end{table}
>> > > 
>> > > \begin{minipage}{\textwidth} \tiny Note: Some descriptive text
>> > > here. \end{minipage}
>> > 
>> > I do not think this is possible.  You have to realise that Org does not
>> > aim to support everything you can do with a backend natively.  One of
>> > the primary reasons for that is the backend agnostic abstraction
>> > provided by Org.
>> 
>> I have seen some way of doing things like this. See section 13.3 at
>> http://orgmode.org/worg/org-tutorials/org-latex-export.html
>> 
>> I can't get it to work though. Will keep trying.
>
> Many of the things on that page is old exporter specific and probably
> will not work with the new exporter.

Yes, this page is all about workarounds for the old exporter.  I believe
John Hendy is reorganizing this material and at some point will either
remove the tutorial or label it clearly as specific to the old exporter.

>
>> There is also a reason for not doing it natively in latex even if the
>> org-mode solution is somewhat round-about. I am writing a research
>> paper using orgmode, with embedded R source blocks in it. I do not
>> mind embedding some latex source block into it but I would not like to
>> edit an exported latex file. After all, in the end, the objective is
>> to be able to have an org file which produces a full paper when exported.
>
> Then generate LaTeX tables from R not Org tables.  As far as I know, R
> is capable of that.  I believe you can pass the ":wrap latex" option to
> the babel block to wrap your LaTeX table with
> "#+begin_latex..#+end_latex".

One reason to stick with Org tables is to ensure stylistic consistency
in the LaTeX output for all tables, regardless of where they originated.
This is more of a convenience than anything else, since the approach you
suggest can yield arbitrarily styled tables, too.

>
> I'm suggesting this because if you continue on this path, i.e. litter
> your Org file with hacks, soon you will end up with an extremely fragile
> and complicated Org project.  I have been down that road while writing
> my thesis.  At one point I realised the problem and made the decision to
> split things into two kinds of files: static content (document
> structuring, text, plots, etc), and dynamic content (babel, TikZ blocks
> that generate tables, plots, figures, etc used by the static content
> files).  It is still reproducible research, but modular and less hacky
> (hence more stable).

The path to a fragile and complicated Org project is well-worn, I've
been down it too many times myself. The habits I've developed over time
have helped, but I think they are less systematic than what you've
devised. I'd love to see some notes on your solution as a brief tutorial
or an expanded FAQ on Worg.  I'll be happy to contribute or help if you
find time to do something like this.

All the best,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

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

* Re: Latex export of tables
  2013-04-16 20:07       ` Thomas S. Dye
@ 2013-04-16 21:39         ` Suvayu Ali
  2013-04-16 23:45           ` Thomas S. Dye
  2013-04-17 10:21           ` Myles English
  0 siblings, 2 replies; 13+ messages in thread
From: Suvayu Ali @ 2013-04-16 21:39 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: emacs-orgmode

Hey Tom,

On Tue, Apr 16, 2013 at 10:07:26AM -1000, Thomas S. Dye wrote:
> Aloha all,
> 
> Jumping in here with apologies :)

Isn't that why we discuss on mailing lists, so that people can jump in
;).

> > I'm suggesting this because if you continue on this path, i.e. litter
> > your Org file with hacks, soon you will end up with an extremely fragile
> > and complicated Org project.  I have been down that road while writing
> > my thesis.  At one point I realised the problem and made the decision to
> > split things into two kinds of files: static content (document
> > structuring, text, plots, etc), and dynamic content (babel, TikZ blocks
> > that generate tables, plots, figures, etc used by the static content
> > files).  It is still reproducible research, but modular and less hacky
> > (hence more stable).
> 
> The path to a fragile and complicated Org project is well-worn, I've
> been down it too many times myself. The habits I've developed over time
> have helped, but I think they are less systematic than what you've
> devised. I'd love to see some notes on your solution as a brief tutorial
> or an expanded FAQ on Worg.  I'll be happy to contribute or help if you
> find time to do something like this.

Actually, I am working on a workflow for large writing projects, my PhD
thesis in this case :-p.  What I have in mind is have a Makefile based
build system that uses `emacs --batch' to export to LaTeX and html.  The
images are generated separately using babel blocks or standalone TeX
files with TikZ code.  I intend to make pdf images for LaTeX and convert
them to png/svg with imagemagick/inkscape.  Of course all of this is
still a pipe dream; if I get it working, I'll definitely write a Worg
page on it.  Of course it will be great if people with interesting ideas
pitch in :).  I expect to have an early working environment in a couple
of months.

:)

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Latex export of tables
  2013-04-16 21:39         ` Suvayu Ali
@ 2013-04-16 23:45           ` Thomas S. Dye
  2013-04-17 10:21           ` Myles English
  1 sibling, 0 replies; 13+ messages in thread
From: Thomas S. Dye @ 2013-04-16 23:45 UTC (permalink / raw)
  To: Suvayu Ali; +Cc: emacs-orgmode

Hi Suvayu,

Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:

> Hey Tom,
>
> Actually, I am working on a workflow for large writing projects, my PhD
> thesis in this case :-p.  What I have in mind is have a Makefile based
> build system that uses `emacs --batch' to export to LaTeX and html.  The
> images are generated separately using babel blocks or standalone TeX
> files with TikZ code.  I intend to make pdf images for LaTeX and convert
> them to png/svg with imagemagick/inkscape.  Of course all of this is
> still a pipe dream; if I get it working, I'll definitely write a Worg
> page on it.  Of course it will be great if people with interesting ideas
> pitch in :).  I expect to have an early working environment in a couple
> of months.

This sounds like the system I was using near the end of the old
exporter's life. When Nicolas added asynchronous export to the new
exporter I was able to abandon the Makefile. Lately, I've been tangling
init.el files from my source document. I really like this approach
because the asynchronous exporter starts off with a fresh emacs instance
(the infamous emacs -Q, I think) and you don't have to worry if your
.emacs has an old setting that has some weird effect on export--all of
the setup is in the babel block that generates the init.el file. I like
that the init.el setup travels with the document in the Org mode file. I
think it helps with reproducibility.

All the best,
Tom

-- 
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com

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

* Re: Latex export of tables
  2013-04-16 21:39         ` Suvayu Ali
  2013-04-16 23:45           ` Thomas S. Dye
@ 2013-04-17 10:21           ` Myles English
  1 sibling, 0 replies; 13+ messages in thread
From: Myles English @ 2013-04-17 10:21 UTC (permalink / raw)
  To: Suvayu Ali; +Cc: emacs-orgmode, Thomas S. Dye


Hi Suvayu,

Suvayu Ali writes:

> Actually, I am working on a workflow for large writing projects, my PhD
> thesis in this case :-p.  What I have in mind is have a Makefile based
> build system that uses `emacs --batch' to export to LaTeX and html.  The
> images are generated separately using babel blocks or standalone TeX
> files with TikZ code.  I intend to make pdf images for LaTeX and convert
> them to png/svg with imagemagick/inkscape.  Of course all of this is
> still a pipe dream; if I get it working, I'll definitely write a Worg
> page on it.  Of course it will be great if people with interesting ideas
> pitch in :).  I expect to have an early working environment in a couple
> of months.

I am looking forward to seeing what you come up with.  (I have mentioned
this before, however) I have been using a CMake system for LaTeX export:

http://cmake.org/Wiki/images/8/80/UseLATEX.cmake

This allows (amongst other things) generating graphics from stand alone
R scripts that get their own data from a database.  I believe the new
version has some kind of support for SVG.  I used this system for
several papers and my thesis and it has three main advantages:

1) out-of-source builds, so my working dir doesn't get cluttered with
LaTeX files

2) asynchronous export of org to LaTeX (although this is now available
with the new exporter)

3) the graphics are regenerated every time so I know it all still
works

I tangle a CMakeList.txt from every org file that I want to export, then
run cmake ~/path; make from the commandline.

(Version control as part of this workflow is possibly another topic: I
have been using git subtrees to make project-local copies of files such
as mystyle.sty and mybiblatex.bib and then update the main git repo with
the changes, and pull the changes down to another project.)

I'll just paste the whole CMakeList.txt so you can see what it looks
like, but the most interesting part is the emacs --batch command:

#+BEGIN_SRC sh :tangle CMakeLists.txt
  cmake_minimum_required(VERSION 2.8)
    
  project(relk NONE)
    
  include(/usr/share/cmake-2.8/Modules/UseLATEX.cmake)
    
  # export the .tex file from the .org file
  # using the emacs orgmode exporter
  latex_get_output_path(OUTPUT_DIR)
    
  file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/relkpaper.org DESTINATION ${OUTPUT_DIR}/ )
  file(COPY /home/myles/lib/lisp/my-export.el DESTINATION ${OUTPUT_DIR}/ )
  
  add_custom_target( orgfile ALL
      DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/relkpaper.org )
  
  add_custom_target( elfile ALL
      DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/my-export.el )
  
  add_custom_command(
      OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/relkpaper.tex
      COMMAND emacs --batch --eval \"(progn
          (add-to-list 'load-path
          (expand-file-name \\"~/.emacs.d/plugins/org-mode/lisp/\\"))
        (add-to-list 'load-path
              (expand-file-name \\"~/.emacs.d/plugins/org-mode/contrib/lisp/\\" t))
          (require 'org)
        (require 'ox)
          (require 'org-exp)
        (require 'org-inlinetask)
          (org-babel-do-load-languages
              'org-babel-load-languages
          '((emacs-lisp . t)
              (sh . t)))
          (setq org-confirm-babel-evaluate nil)
          (setq org-export-with-todo-keywords nil)
          (setq org-export-babel-evaluate nil)
          (load-file \\"my-export.el\\")
          (add-to-list 'org-export-before-parsing-hook 'my-export-delete-headlines-tagged-noheading)
          (add-to-list 'org-export-filter-link-functions
          'my-autoref-filter-link-func)
          (find-file \\"${CMAKE_CURRENT_BINARY_DIR}/relkpaper.org\\")
          (org-latex-export-to-latex))\"
      DEPENDS orgfile elfile
      COMMENT "Exporting orgmode file to LaTeX using emacs")
  
  add_custom_target( mainfile ALL
      DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/relkpaper.tex )
    
  # Set R executable
  set(R_COMPILE "/usr/bin/Rscript")
  # Set the location of data files
  ##set(DATA_DIR data)
  # Set the location of the directory for image files
  set(IMAGE_DIR graphicsauto)
    
  # Get a list of R files
  file(GLOB_RECURSE R_FILES "*.R")
    
  # Copy over all R scripts
  # add_custom_command(
  #   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/R
  #   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/R
  #   COMMAND ${CMAKE_COMMAND} -E copy_directory
  #     ${CMAKE_CURRENT_SOURCE_DIR}/R
  #     ${CMAKE_CURRENT_BINARY_DIR}/R
  # )
  file( COPY ${CMAKE_CURRENT_SOURCE_DIR}/R
      DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
  file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR})
    
  foreach(file ${R_FILES})
      message("processing ${file}")
      get_filename_component(basename "${file}" NAME_WE)
      #file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/R/${file} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/R/${file})
      # # Replace strings in R files so data files can be found
      # file(READ
      # ${CMAKE_CURRENT_SOURCE_DIR}/${IMAGE_DIR}/${basename}.R
      # file_contents
      # )
      # string(REPLACE "${DATA_DIR}" "${IMAGE_DIR}/${DATA_DIR}"
      # changed_file_contents ${file_contents}
      # )
      # file(WRITE
      # ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${basename}.R
      # ${changed_file_contents}
      # )
    
        # Command to run R
        if(R_COMPILE)
          message("Adding ........... ${CMAKE_CURRENT_BINARY_DIR}/R/${basename}.R")
    
          add_custom_command(
            OUTPUT
              ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${basename}.eps
            DEPENDS
              ${CMAKE_CURRENT_BINARY_DIR}/R/${basename}.R
              #      ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${DATA_DIR}
            COMMAND
              ${R_COMPILE}
            ARGS
              ${CMAKE_CURRENT_BINARY_DIR}/R/${basename}.R
              ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${basename}.eps
          )
    message("Running ${R_COMPILE} ${CMAKE_CURRENT_BINARY_DIR}/R/${basename}.R ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${basename}.eps")
    
       # add_dependencies( ${CMAKE_CURRENT_BINARY_DIR}/R/${basename}.R
     # ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${basename}.eps
    #)
    endif(R_COMPILE)
    
        # Make a list of all R files (for ADD_LATEX_DOCUMENT depend)
        set(ALL_R_FILES ${ALL_R_FILES}
          ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${basename}.eps
        )
  endforeach(file)
    
  # # Copy over all data files needed to generate R graphs
  # add_custom_command(
  #   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${DATA_DIR}
  #   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${IMAGE_DIR}/${DATA_DIR}
  #   COMMAND ${CMAKE_COMMAND} -E copy_directory
  #     ${CMAKE_CURRENT_SOURCE_DIR}/${IMAGE_DIR}/${DATA_DIR}
  #     ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${DATA_DIR}
  # )
    
  add_latex_document( a.tex
      INPUTS texlib/mystyle.sty
      IMAGE_DIRS img/scans ${IMAGE_DIR} img
      DEPENDS ${ALL_R_FILES}
              mainfile
      BIBFILES texlib/mybiblatex.bib
      DEFAULT_PDF
      USE_NOMENCL
  )
    
#+END_SRC

Myles

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

end of thread, other threads:[~2013-04-17 10:20 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-13 10:35 LaTeX export of tables Francesco Pizzolante
     [not found] ` <873a5nr379.fsf-djc/iPCCuDYQheJpep6IedvLeJWuRmrY@public.gmane.org>
2009-10-19 11:58   ` Francesco Pizzolante
2009-10-19 18:05     ` Darlan Cavalcante Moreira
2009-10-20  8:17     ` Carsten Dominik
  -- strict thread matches above, loose matches on Subject: below --
2013-04-12  8:06 Latex " Vikas Rawal
2013-04-14 23:29 ` Suvayu Ali
2013-04-16 11:56   ` Vikas Rawal
2013-04-16 13:13     ` Thomas Alexander Gerds
2013-04-16 17:39     ` Suvayu Ali
2013-04-16 20:07       ` Thomas S. Dye
2013-04-16 21:39         ` Suvayu Ali
2013-04-16 23:45           ` Thomas S. Dye
2013-04-17 10:21           ` Myles English

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