* latex export and booktabs tables @ 2010-06-22 21:36 Erik Butz 2010-06-22 23:03 ` Thomas S. Dye 2010-06-23 8:23 ` Sébastien Vauban 0 siblings, 2 replies; 13+ messages in thread From: Erik Butz @ 2010-06-22 21:36 UTC (permalink / raw) To: emacs-orgmode Hi all, I found a very old thread on the list about using the booktabs package to have nicer tables in latex export. I found that, making the changes below I can use the booktab package to export tables, and using standard tables only, this seems to work fine. Can anyone advice on whether this kind of change is meaningful or if this is likely to introduce difficulties elsewhere which I did not experience due to the limited scope of usage? It should be said that I did not at all look into longtables so far. Cheers, Erik diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 01a4b05..31ceba4 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -1658,7 +1658,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (if (and longtblp caption) "\\\\\n" "\n") (if (and org-export-latex-tables-centered (not longtblp)) "\\begin{center}\n") - (if (not longtblp) (concat "\\begin{tabular}{" align "}\n")) + (if (not longtblp) (concat "\\begin{tabular}{" align "}\n\\toprule\n")) (orgtbl-to-latex lines `(:tstart nil :tend nil @@ -1670,7 +1670,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." \\endfoot \\endlastfoot" (length org-table-last-alignment)) nil))) - (if (not longtblp) (concat "\n\\end{tabular}")) + (if (not longtblp) (concat "\n\\bottomrule\n\\end{tabular}")) (if longtblp "\n" (if org-export-latex-tables-centered "\n\\end{center}\n" "\n")) (if longtblp diff --git a/lisp/org-table.el b/lisp/org-table.el index 46efc28..130ccf2 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -4222,7 +4222,7 @@ this function is called." :tstart (concat "\\begin{tabular}{" alignment "}") :tend "\\end{tabular}" :lstart "" :lend " \\\\" :sep " & " - :efmt "%s\\,(%s)" :hline "\\hline"))) + :efmt "%s\\,(%s)" :hline "\\midrule"))) (orgtbl-to-generic table (org-combine-plists params2 params)))) (defun orgtbl-to-html (table params) diff --git a/lisp/org.el b/lisp/org.el index 2628152..ed6dabe 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -3087,6 +3087,7 @@ will be appended." ("" "wasysym" t) ("" "latexsym" t) ("" "amssymb" t) + ("" "booktabs" t) ("" "hyperref" nil) "\\tolerance=1000" ) ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: latex export and booktabs tables 2010-06-22 21:36 latex export and booktabs tables Erik Butz @ 2010-06-22 23:03 ` Thomas S. Dye 2010-06-23 8:23 ` Sébastien Vauban 1 sibling, 0 replies; 13+ messages in thread From: Thomas S. Dye @ 2010-06-22 23:03 UTC (permalink / raw) To: Erik Butz; +Cc: emacs-orgmode Aloha Erik, The rules defined in booktabs work with longtables, if that is what you are asking. All the best, Tom On Jun 22, 2010, at 11:36 AM, Erik Butz wrote: > Hi all, > > I found a very old thread on the list about using the booktabs package > to have nicer tables in latex export. > > I found that, making the changes below I can use the booktab package > to export tables, and using standard tables only, this seems to work > fine. > > Can anyone advice on whether this kind of change is meaningful or if > this is likely to introduce difficulties elsewhere which I did not > experience due to the limited scope of usage? It should be said that I > did not at all look into longtables so far. > > Cheers, > > Erik > > diff --git a/lisp/org-latex.el b/lisp/org-latex.el > index 01a4b05..31ceba4 100644 > --- a/lisp/org-latex.el > +++ b/lisp/org-latex.el > @@ -1658,7 +1658,7 @@ The conversion is made depending of > STRING-BEFORE and STRING-AFTER." > (if (and longtblp caption) "\\\\\n" "\n") > (if (and org-export-latex-tables-centered > (not longtblp)) > "\\begin{center}\n") > - (if (not longtblp) (concat > "\\begin{tabular}{" align "}\n")) > + (if (not longtblp) (concat > "\\begin{tabular}{" align "}\n\\toprule\n")) > (orgtbl-to-latex > lines > `(:tstart nil :tend nil > @@ -1670,7 +1670,7 @@ The conversion is made depending of > STRING-BEFORE and STRING-AFTER." > \\endfoot > \\endlastfoot" (length org-table-last-alignment)) > nil))) > - (if (not longtblp) (concat "\n\ > \end{tabular}")) > + (if (not longtblp) (concat > "\n\\bottomrule\n\\end{tabular}")) > (if longtblp "\n" (if org-export-latex- > tables-centered > "\n\\end{center}\n" > "\n")) > (if longtblp > diff --git a/lisp/org-table.el b/lisp/org-table.el > index 46efc28..130ccf2 100644 > --- a/lisp/org-table.el > +++ b/lisp/org-table.el > @@ -4222,7 +4222,7 @@ this function is called." > :tstart (concat "\\begin{tabular}{" alignment "}") > :tend "\\end{tabular}" > :lstart "" :lend " \\\\" :sep " & " > - :efmt "%s\\,(%s)" :hline "\\hline"))) > + :efmt "%s\\,(%s)" :hline "\\midrule"))) > (orgtbl-to-generic table (org-combine-plists params2 params)))) > > (defun orgtbl-to-html (table params) > diff --git a/lisp/org.el b/lisp/org.el > index 2628152..ed6dabe 100644 > --- a/lisp/org.el > +++ b/lisp/org.el > @@ -3087,6 +3087,7 @@ will be appended." > ("" "wasysym" t) > ("" "latexsym" t) > ("" "amssymb" t) > + ("" "booktabs" t) > ("" "hyperref" nil) > "\\tolerance=1000" > ) > > _______________________________________________ > Emacs-orgmode mailing list > Please 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 and booktabs tables 2010-06-22 21:36 latex export and booktabs tables Erik Butz 2010-06-22 23:03 ` Thomas S. Dye @ 2010-06-23 8:23 ` Sébastien Vauban 2010-06-28 5:09 ` Eric Schulte 1 sibling, 1 reply; 13+ messages in thread From: Sébastien Vauban @ 2010-06-23 8:23 UTC (permalink / raw) To: emacs-orgmode-mXXj517/zsQ Hi Erik, Erik Butz wrote: > I found a very old thread on the list about using the booktabs package to > have nicer tables in latex export. > > I found that, making the changes below I can use the booktab package to > export tables, and using standard tables only, this seems to work fine. > > Can anyone advice on whether this kind of change is meaningful or if this is > likely to introduce difficulties elsewhere which I did not experience due to > the limited scope of usage? It should be said that I did not at all look > into longtables so far. While trying to improve this, I think one could extend it so that the table environment can be changed as well, from `tabular' to `array', `tabular*', `tabularx' or any other. There was a discussion on this, a while ago, by Francesco Pizzolante. Have a read at: http://www.mail-archive.com/emacs-orgmode-mXXj517/zsQ@public.gmane.org/msg18311.html. Best regards, Seb -- Sébastien Vauban _______________________________________________ Emacs-orgmode mailing list Please 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: Re: latex export and booktabs tables 2010-06-23 8:23 ` Sébastien Vauban @ 2010-06-28 5:09 ` Eric Schulte 2010-06-28 6:05 ` Carsten Dominik 2010-06-29 8:00 ` Thomas S. Dye 0 siblings, 2 replies; 13+ messages in thread From: Eric Schulte @ 2010-06-28 5:09 UTC (permalink / raw) To: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 417 bytes --] One way to deal with this without adding even more complexity to the core of org-mode could be through the use of "Library of Babel" functions. The attached org-mode file provides a function for exporting to the longtable environment with some example usage. If this looks generally useful it (and maybe similar functions) could be added to the library of babel distributed w/Org-mode. What do you think? -- Eric [-- Attachment #2: longtable.org --] [-- Type: application/octet-stream, Size: 2690 bytes --] #+TITLE: longtable #+OPTIONS: toc:nil a simple example #+call: longtable(table=my-table, align="{|r|}") :results latex :exports results a more complex example which uses =my-first-header= from below #+call: longtable(table=my-table, align="{|r|}", firsthead=my-firsthead) :results latex :exports results * COMMENT table hidden in a commented section #+tblname: my-table | 1 | | 2 | | 3 | | 4 | #+results: my-firsthead #+begin_LaTeX \hline \multicolumn{1}{ |c|}{Numbers}\\ \hline \hline #+end_LaTeX * COMMENT longtable function This block can be used to wrap a table in the latex =longtable= environment, it takes the following arguments -- all but the first two are optional. | arg | description | |-----------+-------------------------------------------------------------| | table | a reference to the table | | align | optional alignment string | | width | optional width specification string | | hline | the string to use as hline separator, defaults to "\\hline" | | head | optional "head" string | | firsthead | optional "firsthead" string | | foot | optional "foot" string | | lastfoot | optional "lastfoot" string | #+srcname: longtable #+begin_src emacs-lisp :var table='((:table)) :var width='() :var align='() :var hline="\\hline" :var firsthead='() :var head='() :var foot='() :var lastfoot='() :noweb yes :results latex (org-fill-template " \\begin{longtable}%width%align %firsthead %head %foot %lastfoot %table \\end{longtable}\n" (list (cons "width" (if width (format "{%s}" width) "")) (cons "align" (if align (format "{%s}" align) "")) (cons "firsthead" (if firsthead (concat firsthead "\n\\endfirsthead\n") "")) (cons "head" (if head (concat head "\n\\endhead\n") "")) (cons "foot" (if foot (concat foot "\n\\endfoot\n") "")) (cons "lastfoot" (if lastfoot (concat lastfoot "\n\\endlastfoot\n") "")) (cons "table" (orgtbl-to-generic (mapcar (lambda (lis) (if (listp lis) (mapcar (lambda (el) (if (stringp el) el (format "%S" el))) lis) lis)) table) (list :lend " \\\\" :sep " & " :hline hline))))) #+end_src [-- Attachment #3: Type: text/plain, Size: 1016 bytes --] Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes: > Hi Erik, > > Erik Butz wrote: >> I found a very old thread on the list about using the booktabs package to >> have nicer tables in latex export. >> >> I found that, making the changes below I can use the booktab package to >> export tables, and using standard tables only, this seems to work fine. >> >> Can anyone advice on whether this kind of change is meaningful or if this is >> likely to introduce difficulties elsewhere which I did not experience due to >> the limited scope of usage? It should be said that I did not at all look >> into longtables so far. > > While trying to improve this, I think one could extend it so that the table > environment can be changed as well, from `tabular' to `array', `tabular*', > `tabularx' or any other. > > There was a discussion on this, a while ago, by Francesco Pizzolante. Have a > read at: http://www.mail-archive.com/emacs-orgmode@gnu.org/msg18311.html. > > Best regards, > Seb [-- Attachment #4: Type: text/plain, Size: 201 bytes --] _______________________________________________ Emacs-orgmode mailing list Please 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: Re: latex export and booktabs tables 2010-06-28 5:09 ` Eric Schulte @ 2010-06-28 6:05 ` Carsten Dominik 2010-06-28 8:45 ` Sébastien Vauban 2010-06-29 8:00 ` Thomas S. Dye 1 sibling, 1 reply; 13+ messages in thread From: Carsten Dominik @ 2010-06-28 6:05 UTC (permalink / raw) To: Eric Schulte; +Cc: emacs-orgmode On Jun 28, 2010, at 7:09 AM, Eric Schulte wrote: > One way to deal with this without adding even more complexity to the > core of org-mode could be through the use of "Library of Babel" > functions. > > The attached org-mode file provides a function for exporting to the > longtable environment with some example usage. If this looks > generally > useful it (and maybe similar functions) could be added to the > library of > babel distributed w/Org-mode. > > What do you think? -- Eric This looks like a great solution to me. - Carsten > > <longtable.org> > Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes: > >> Hi Erik, >> >> Erik Butz wrote: >>> I found a very old thread on the list about using the booktabs >>> package to >>> have nicer tables in latex export. >>> >>> I found that, making the changes below I can use the booktab >>> package to >>> export tables, and using standard tables only, this seems to work >>> fine. >>> >>> Can anyone advice on whether this kind of change is meaningful or >>> if this is >>> likely to introduce difficulties elsewhere which I did not >>> experience due to >>> the limited scope of usage? It should be said that I did not at >>> all look >>> into longtables so far. >> >> While trying to improve this, I think one could extend it so that >> the table >> environment can be changed as well, from `tabular' to `array', >> `tabular*', >> `tabularx' or any other. >> >> There was a discussion on this, a while ago, by Francesco >> Pizzolante. Have a >> read at: http://www.mail-archive.com/emacs-orgmode@gnu.org/msg18311.html >> . >> >> Best regards, >> Seb > _______________________________________________ > Emacs-orgmode mailing list > Please 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
* Re: latex export and booktabs tables 2010-06-28 6:05 ` Carsten Dominik @ 2010-06-28 8:45 ` Sébastien Vauban 2010-06-28 15:16 ` Eric Schulte 0 siblings, 1 reply; 13+ messages in thread From: Sébastien Vauban @ 2010-06-28 8:45 UTC (permalink / raw) To: emacs-orgmode-mXXj517/zsQ Hi Eric, Carsten Dominik wrote: > On Jun 28, 2010, at 7:09 AM, Eric Schulte wrote: > >> One way to deal with this without adding even more complexity to the core >> of org-mode could be through the use of "Library of Babel" functions. >> >> The attached org-mode file provides a function for exporting to the >> longtable environment with some example usage. If this looks generally >> useful it (and maybe similar functions) could be added to the library of >> babel distributed w/Org-mode. >> >> What do you think? -- Eric > > This looks like a great solution to me. It does look great to me as well. Just a request on the wish-list: could the table environment be made a parameter (so that we can choose between tabular, tabular*, etc.)? Best regards, Seb -- Sébastien Vauban _______________________________________________ Emacs-orgmode mailing list Please 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: Re: latex export and booktabs tables 2010-06-28 8:45 ` Sébastien Vauban @ 2010-06-28 15:16 ` Eric Schulte 2010-06-28 20:07 ` Erik Butz 2010-06-28 20:14 ` Sébastien Vauban 0 siblings, 2 replies; 13+ messages in thread From: Eric Schulte @ 2010-06-28 15:16 UTC (permalink / raw) To: Sébastien Vauban; +Cc: emacs-orgmode Hi Sébastien, Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes: > Hi Eric, > > Carsten Dominik wrote: >> On Jun 28, 2010, at 7:09 AM, Eric Schulte wrote: >> >>> One way to deal with this without adding even more complexity to the core >>> of org-mode could be through the use of "Library of Babel" functions. >>> >>> The attached org-mode file provides a function for exporting to the >>> longtable environment with some example usage. If this looks generally >>> useful it (and maybe similar functions) could be added to the library of >>> babel distributed w/Org-mode. >>> >>> What do you think? -- Eric >> >> This looks like a great solution to me. > > It does look great to me as well. Just a request on the wish-list: could the > table environment be made a parameter (so that we can choose between tabular, > tabular*, etc.)? > Sure, my thinking was that it may be more natural to use the environment type as the function name (allowing more concise function calls). Also, that way if there are some arguments that only make sense for particular environment (I'm not sure that there are) then it would be easy to customize the functions on a per-environment bases. But if these environments are all pretty similar - tabular* - booktabs - longtable - tablex - array then I guess one single function is the way to go. I'll add this to the library-of-babel.org in contrib/babel/library-of-babel.org and please feel free to play around with the function definition. This file lives in the contrib directory to encourage user participation -- in fact maybe the library-of-babel.org (or a copy) should move to Worg. Thanks -- Eric > > Best regards, > Seb ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Re: latex export and booktabs tables 2010-06-28 15:16 ` Eric Schulte @ 2010-06-28 20:07 ` Erik Butz 2010-06-28 20:14 ` Sébastien Vauban 1 sibling, 0 replies; 13+ messages in thread From: Erik Butz @ 2010-06-28 20:07 UTC (permalink / raw) To: Eric Schulte; +Cc: emacs-orgmode Hi Eric, I can only agree with what has already been said, namely that this is a very nice solution which indeed is much more generic and does not require fiddling with the core of the distribution. Thanks for this, this even closes, I think, the older thread or re-opens it to further discussion ;) Cheers, Erik On Mon, Jun 28, 2010 at 5:16 PM, Eric Schulte <schulte.eric@gmail.com> wrote: > Hi Sébastien, > > Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes: > >> Hi Eric, >> >> Carsten Dominik wrote: >>> On Jun 28, 2010, at 7:09 AM, Eric Schulte wrote: >>> >>>> One way to deal with this without adding even more complexity to the core >>>> of org-mode could be through the use of "Library of Babel" functions. >>>> >>>> The attached org-mode file provides a function for exporting to the >>>> longtable environment with some example usage. If this looks generally >>>> useful it (and maybe similar functions) could be added to the library of >>>> babel distributed w/Org-mode. >>>> >>>> What do you think? -- Eric >>> >>> This looks like a great solution to me. >> >> It does look great to me as well. Just a request on the wish-list: could the >> table environment be made a parameter (so that we can choose between tabular, >> tabular*, etc.)? >> > > Sure, my thinking was that it may be more natural to use the environment > type as the function name (allowing more concise function calls). Also, > that way if there are some arguments that only make sense for particular > environment (I'm not sure that there are) then it would be easy to > customize the functions on a per-environment bases. But if these > environments are all pretty similar > - tabular* > - booktabs > - longtable > - tablex > - array > then I guess one single function is the way to go. > > I'll add this to the library-of-babel.org in > contrib/babel/library-of-babel.org and please feel free to play around > with the function definition. This file lives in the contrib directory > to encourage user participation -- in fact maybe the > library-of-babel.org (or a copy) should move to Worg. > > Thanks -- Eric > >> >> Best regards, >> Seb > > _______________________________________________ > Emacs-orgmode mailing list > Please 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 and booktabs tables 2010-06-28 15:16 ` Eric Schulte 2010-06-28 20:07 ` Erik Butz @ 2010-06-28 20:14 ` Sébastien Vauban 1 sibling, 0 replies; 13+ messages in thread From: Sébastien Vauban @ 2010-06-28 20:14 UTC (permalink / raw) To: emacs-orgmode-mXXj517/zsQ Hi Eric, "Eric Schulte" wrote: > Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes: >> Carsten Dominik wrote: >>> On Jun 28, 2010, at 7:09 AM, Eric Schulte wrote: >>> >>>> One way to deal with this without adding even more complexity to the core >>>> of org-mode could be through the use of "Library of Babel" functions. >>>> >>>> The attached org-mode file provides a function for exporting to the >>>> longtable environment with some example usage. If this looks generally >>>> useful it (and maybe similar functions) could be added to the library of >>>> babel distributed w/Org-mode. >>>> >>>> What do you think? -- Eric >>> >>> This looks like a great solution to me. >> >> It does look great to me as well. Just a request on the wish-list: could >> the table environment be made a parameter (so that we can choose between >> tabular, tabular*, etc.)? > > Sure, my thinking was that it may be more natural to use the environment > type as the function name (allowing more concise function calls). Also, that > way if there are some arguments that only make sense for particular > environment (I'm not sure that there are) then it would be easy to customize > the functions on a per-environment bases. I think your argumentation is persuasive. Maybe that's better to do so, if we want to avoid subtle differences between environments. > But if these environments are all pretty similar > - tabular* > - booktabs > - longtable > - tablex > - array > then I guess one single function is the way to go. As said, maybe stay on your initial point of view. Have different functions for different environments. > I'll add this to the library-of-babel.org in > contrib/babel/library-of-babel.org and please feel free to play around with > the function definition. I'll clearly commit to do it, on a "on need" basis. As soon as I add something, this will be made publicly available, for review and comments. > This file lives in the contrib directory to encourage user participation -- > in fact maybe the library-of-babel.org (or a copy) should move to Worg. Thanks, Seb -- Sébastien Vauban _______________________________________________ Emacs-orgmode mailing list Please 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: Re: latex export and booktabs tables 2010-06-28 5:09 ` Eric Schulte 2010-06-28 6:05 ` Carsten Dominik @ 2010-06-29 8:00 ` Thomas S. Dye 2010-06-29 17:10 ` Eric Schulte 1 sibling, 1 reply; 13+ messages in thread From: Thomas S. Dye @ 2010-06-29 8:00 UTC (permalink / raw) To: Eric Schulte; +Cc: emacs-orgmode [-- Attachment #1.1: Type: text/plain, Size: 2576 bytes --] Hi Eric, This is neat, but it doesn't directly address the problem posed by the OP. Currently, the LaTeX exporter uses \hline for all the horizontal rules in a table. Booktabs defines three rules of different thickness for use at the top of the table, after the column heads, and at the bottom of the table. So, one would want a function that let each of the rules take a different value. The default for each could be hline, giving the current behavior of the exporter. Francesco Pizzolante set this out nicely a while back: http://www.mail-archive.com/emacs-orgmode@gnu.org/msg18311.html in a message that Seb Vauban brought up in a slightly different context. All the best, Tom On Jun 27, 2010, at 7:09 PM, Eric Schulte wrote: > One way to deal with this without adding even more complexity to the > core of org-mode could be through the use of "Library of Babel" > functions. > > The attached org-mode file provides a function for exporting to the > longtable environment with some example usage. If this looks > generally > useful it (and maybe similar functions) could be added to the > library of > babel distributed w/Org-mode. > > What do you think? -- Eric > > <longtable.org> > Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes: > >> Hi Erik, >> >> Erik Butz wrote: >>> I found a very old thread on the list about using the booktabs >>> package to >>> have nicer tables in latex export. >>> >>> I found that, making the changes below I can use the booktab >>> package to >>> export tables, and using standard tables only, this seems to work >>> fine. >>> >>> Can anyone advice on whether this kind of change is meaningful or >>> if this is >>> likely to introduce difficulties elsewhere which I did not >>> experience due to >>> the limited scope of usage? It should be said that I did not at >>> all look >>> into longtables so far. >> >> While trying to improve this, I think one could extend it so that >> the table >> environment can be changed as well, from `tabular' to `array', >> `tabular*', >> `tabularx' or any other. >> >> There was a discussion on this, a while ago, by Francesco >> Pizzolante. Have a >> read at: http://www.mail-archive.com/emacs-orgmode@gnu.org/msg18311.html >> . >> >> Best regards, >> Seb > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode [-- Attachment #1.2: Type: text/html, Size: 4305 bytes --] [-- Attachment #2: Type: text/plain, Size: 201 bytes --] _______________________________________________ Emacs-orgmode mailing list Please 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: Re: latex export and booktabs tables 2010-06-29 8:00 ` Thomas S. Dye @ 2010-06-29 17:10 ` Eric Schulte 2010-06-30 3:01 ` Thomas S. Dye 2010-06-30 18:54 ` Eric Schulte 0 siblings, 2 replies; 13+ messages in thread From: Eric Schulte @ 2010-06-29 17:10 UTC (permalink / raw) To: Thomas S. Dye; +Cc: emacs-orgmode Hi Tom, How about the following proposed library of babel function which constructs a booktabs environment using a toprule, (conditionally) a midrule, and a bottomrule. --8<---------------cut here---------------start------------->8--- *** booktabs This block can be used to wrap a table in the latex =booktabs= environment, it takes the following arguments -- all but the first two are optional. | arg | description | |-------+--------------------------------------------| | table | a reference to the table | | align | optional alignment string | | env | optional environment, default to "tabular" | | width | optional width specification string | #+srcname: booktabs #+begin_src emacs-lisp :var table='((:head) hline (:body)) :var align='() :var env="tabular" :var width='() :noweb yes :results latex (flet ((to-tab (tab) (orgtbl-to-generic (mapcar (lambda (lis) (if (listp lis) (mapcar (lambda (el) (if (stringp el) el (format "%S" el))) lis) lis)) tab) (list :lend " \\\\" :sep " & " :hline "\\hline")))) (org-fill-template " \\begin{%env}%width%align \\toprule %table \\bottomrule \\end{%env}\n" (list (cons "env" (or env "table")) (cons "width" (if width (format "{%s}" width) "")) (cons "align" (if align (format "{%s}" align) "")) (cons "table" ;; only use \midrule if it looks like there are column headers (if (equal 'hline (second table)) (concat (to-tab (list (first table))) "\n\\midrule\n" (to-tab (cddr table))) (to-tab table)))))) #+end_src --8<---------------cut here---------------end--------------->8--- once loaded it can be applied as here --8<---------------cut here---------------start------------->8--- ** booktabs #+tblname: months | num | Abbrev. | |-----+---------| | 1 | Jan. | | 2 | Feb. | | 3 | Mar. | #+call: booktabs(table=months, align="r|l") :results latex :exports results --8<---------------cut here---------------end--------------->8--- Also, note that the longtable function currently in the library-of-babel does allow for replacing the global default hline value. I'm sure the above isn't perfect, however hopefully it is close enough that you could recommend how to get the rest of the way there. Thanks -- Eric "Thomas S. Dye" <tsd@tsdye.com> writes: > Hi Eric, > > This is neat, but it doesn't directly address the problem posed by the > OP. > > Currently, the LaTeX exporter uses \hline for all the horizontal rules > in a table. Booktabs defines three rules of different thickness for > use at the top of the table, after the column heads, and at the bottom > of the table. So, one would want a function that let each of the > rules take a different value. The default for each could be hline, > giving the current behavior of the exporter. Francesco Pizzolante set > this out nicely a while back: > http://www.mail-archive.com/emacs-orgmode@gnu.org/msg18311.html in a > message that Seb Vauban brought up in a slightly different context. > > All the best, > Tom > > On Jun 27, 2010, at 7:09 PM, Eric Schulte wrote: > >> One way to deal with this without adding even more complexity to the >> core of org-mode could be through the use of "Library of Babel" >> functions. >> >> The attached org-mode file provides a function for exporting to the >> longtable environment with some example usage. If this looks >> generally >> useful it (and maybe similar functions) could be added to the >> library of >> babel distributed w/Org-mode. >> >> What do you think? -- Eric >> >> <longtable.org> >> Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes: >> >>> Hi Erik, >>> >>> Erik Butz wrote: >>>> I found a very old thread on the list about using the booktabs >>>> package to >>>> have nicer tables in latex export. >>>> >>>> I found that, making the changes below I can use the booktab >>>> package to >>>> export tables, and using standard tables only, this seems to work >>>> fine. >>>> >>>> Can anyone advice on whether this kind of change is meaningful or >>>> if this is >>>> likely to introduce difficulties elsewhere which I did not >>>> experience due to >>>> the limited scope of usage? It should be said that I did not at >>>> all look >>>> into longtables so far. >>> >>> While trying to improve this, I think one could extend it so that >>> the table >>> environment can be changed as well, from `tabular' to `array', >>> tabular*', >>> `tabularx' or any other. >>> >>> There was a discussion on this, a while ago, by Francesco >>> Pizzolante. Have a >>> read at: >>> http://www.mail-archive.com/emacs-orgmode@gnu.org/msg18311.html >>> . >>> >>> Best regards, >>> Seb >> _______________________________________________ >> Emacs-orgmode mailing list >> Please 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: Re: latex export and booktabs tables 2010-06-29 17:10 ` Eric Schulte @ 2010-06-30 3:01 ` Thomas S. Dye 2010-06-30 18:54 ` Eric Schulte 1 sibling, 0 replies; 13+ messages in thread From: Thomas S. Dye @ 2010-06-30 3:01 UTC (permalink / raw) To: Eric Schulte; +Cc: emacs-orgmode Hi Eric, Sweet! Here is a stripped-down version that integrates with the AucTeX function, (LaTeX-environment ARG). --8<---------------cut here---------------start------------->8--- #+srcname: booktabs-2 #+begin_src emacs-lisp :var table='((:head) hline (:body)) (flet ((to-tab (tab) (orgtbl-to-generic (mapcar (lambda (lis) (if (listp lis) (mapcar (lambda (el) (if (stringp el) el (format "%S" el))) lis) lis)) tab) (list :lend " \\\\" :sep " & " :hline "\\hline")))) (org-fill-template " \\toprule %table \\bottomrule\n" (list (cons "table" ;; only use \midrule if it looks like there are column headers (if (equal 'hline (second table)) (concat (to-tab (list (first table))) "\n\\midrule\n" (to-tab (cddr table))) (to-tab table)))))) #+end_src --8<---------------cut here---------------end--------------->8--- Here is an example of how I intend to use it. --8<---------------cut here---------------start------------->8--- #+srcname: test #+begin_src latex :noweb yes \begin{table}[htb!] \centering \caption{A test table} \label{tab:test} \begin{tabular}{rl} <<booktabs-2(table=months)>> \end{tabular} \end{table} #+end_src --8<---------------cut here---------------end--------------->8--- Everything around the noweb reference was due to the AucTeX function. Thanks for the two Library of Babel functions. I'll be using them a lot! All the best, Tom On Jun 29, 2010, at 7:10 AM, Eric Schulte wrote: > Hi Tom, > > How about the following proposed library of babel function which > constructs a booktabs environment using a toprule, (conditionally) a > midrule, and a bottomrule. > > --8<---------------cut here---------------start------------->8--- > *** booktabs > This block can be used to wrap a table in the latex =booktabs= > environment, it takes the following arguments -- all but the first two > are optional. > | arg | description | > |-------+--------------------------------------------| > | table | a reference to the table | > | align | optional alignment string | > | env | optional environment, default to "tabular" | > | width | optional width specification string | > > #+srcname: booktabs > #+begin_src emacs-lisp :var table='((:head) hline (:body)) :var > align='() :var env="tabular" :var width='() :noweb yes :results latex > (flet ((to-tab (tab) > (orgtbl-to-generic > (mapcar (lambda (lis) > (if (listp lis) > (mapcar (lambda (el) > (if (stringp el) > el > (format "%S" el))) lis) > lis)) tab) > (list :lend " \\\\" :sep " & " :hline "\\hline")))) > (org-fill-template > " > \\begin{%env}%width%align > \\toprule > %table > \\bottomrule > \\end{%env}\n" > (list > (cons "env" (or env "table")) > (cons "width" (if width (format "{%s}" width) "")) > (cons "align" (if align (format "{%s}" align) "")) > (cons "table" > ;; only use \midrule if it looks like there are column > headers > (if (equal 'hline (second table)) > (concat (to-tab (list (first table))) > "\n\\midrule\n" > (to-tab (cddr table))) > (to-tab table)))))) > #+end_src > --8<---------------cut here---------------end--------------->8--- > > once loaded it can be applied as here > > --8<---------------cut here---------------start------------->8--- > ** booktabs > #+tblname: months > | num | Abbrev. | > |-----+---------| > | 1 | Jan. | > | 2 | Feb. | > | 3 | Mar. | > > #+call: booktabs(table=months, align="r|l") :results latex :exports > results > --8<---------------cut here---------------end--------------->8--- > > Also, note that the longtable function currently in the library-of- > babel > does allow for replacing the global default hline value. > > I'm sure the above isn't perfect, however hopefully it is close enough > that you could recommend how to get the rest of the way there. > > Thanks -- Eric > > "Thomas S. Dye" <tsd@tsdye.com> writes: > >> Hi Eric, >> >> This is neat, but it doesn't directly address the problem posed by >> the >> OP. >> >> Currently, the LaTeX exporter uses \hline for all the horizontal >> rules >> in a table. Booktabs defines three rules of different thickness for >> use at the top of the table, after the column heads, and at the >> bottom >> of the table. So, one would want a function that let each of the >> rules take a different value. The default for each could be hline, >> giving the current behavior of the exporter. Francesco Pizzolante >> set >> this out nicely a while back: >> http://www.mail-archive.com/emacs-orgmode@gnu.org/msg18311.html in a >> message that Seb Vauban brought up in a slightly different context. >> >> All the best, >> Tom >> >> On Jun 27, 2010, at 7:09 PM, Eric Schulte wrote: >> >>> One way to deal with this without adding even more complexity to the >>> core of org-mode could be through the use of "Library of Babel" >>> functions. >>> >>> The attached org-mode file provides a function for exporting to the >>> longtable environment with some example usage. If this looks >>> generally >>> useful it (and maybe similar functions) could be added to the >>> library of >>> babel distributed w/Org-mode. >>> >>> What do you think? -- Eric >>> >>> <longtable.org> >>> Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes: >>> >>>> Hi Erik, >>>> >>>> Erik Butz wrote: >>>>> I found a very old thread on the list about using the booktabs >>>>> package to >>>>> have nicer tables in latex export. >>>>> >>>>> I found that, making the changes below I can use the booktab >>>>> package to >>>>> export tables, and using standard tables only, this seems to work >>>>> fine. >>>>> >>>>> Can anyone advice on whether this kind of change is meaningful or >>>>> if this is >>>>> likely to introduce difficulties elsewhere which I did not >>>>> experience due to >>>>> the limited scope of usage? It should be said that I did not at >>>>> all look >>>>> into longtables so far. >>>> >>>> While trying to improve this, I think one could extend it so that >>>> the table >>>> environment can be changed as well, from `tabular' to `array', >>>> tabular*', >>>> `tabularx' or any other. >>>> >>>> There was a discussion on this, a while ago, by Francesco >>>> Pizzolante. Have a >>>> read at: >>>> http://www.mail-archive.com/emacs-orgmode@gnu.org/msg18311.html >>>> . >>>> >>>> Best regards, >>>> Seb >>> _______________________________________________ >>> Emacs-orgmode mailing list >>> Please 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: Re: latex export and booktabs tables 2010-06-29 17:10 ` Eric Schulte 2010-06-30 3:01 ` Thomas S. Dye @ 2010-06-30 18:54 ` Eric Schulte 1 sibling, 0 replies; 13+ messages in thread From: Eric Schulte @ 2010-06-30 18:54 UTC (permalink / raw) To: Thomas S. Dye; +Cc: emacs-orgmode This booktabs function has now been added to the library of babel. Cheers -- Eric "Eric Schulte" <schulte.eric@gmail.com> writes: > Hi Tom, > > How about the following proposed library of babel function which > constructs a booktabs environment using a toprule, (conditionally) a > midrule, and a bottomrule. > > *** booktabs > This block can be used to wrap a table in the latex =booktabs= > environment, it takes the following arguments -- all but the first two > are optional. > | arg | description | > |-------+--------------------------------------------| > | table | a reference to the table | > | align | optional alignment string | > | env | optional environment, default to "tabular" | > | width | optional width specification string | > > #+srcname: booktabs > #+begin_src emacs-lisp :var table='((:head) hline (:body)) :var align='() :var env="tabular" :var width='() :noweb yes :results latex > (flet ((to-tab (tab) > (orgtbl-to-generic > (mapcar (lambda (lis) > (if (listp lis) > (mapcar (lambda (el) > (if (stringp el) > el > (format "%S" el))) lis) > lis)) tab) > (list :lend " \\\\" :sep " & " :hline "\\hline")))) > (org-fill-template > " > \\begin{%env}%width%align > \\toprule > %table > \\bottomrule > \\end{%env}\n" > (list > (cons "env" (or env "table")) > (cons "width" (if width (format "{%s}" width) "")) > (cons "align" (if align (format "{%s}" align) "")) > (cons "table" > ;; only use \midrule if it looks like there are column headers > (if (equal 'hline (second table)) > (concat (to-tab (list (first table))) > "\n\\midrule\n" > (to-tab (cddr table))) > (to-tab table)))))) > #+end_src > > once loaded it can be applied as here > > ** booktabs > #+tblname: months > | num | Abbrev. | > |-----+---------| > | 1 | Jan. | > | 2 | Feb. | > | 3 | Mar. | > > #+call: booktabs(table=months, align="r|l") :results latex :exports results > > Also, note that the longtable function currently in the library-of-babel > does allow for replacing the global default hline value. > > I'm sure the above isn't perfect, however hopefully it is close enough > that you could recommend how to get the rest of the way there. > > Thanks -- Eric > > "Thomas S. Dye" <tsd@tsdye.com> writes: > >> Hi Eric, >> >> This is neat, but it doesn't directly address the problem posed by the >> OP. >> >> Currently, the LaTeX exporter uses \hline for all the horizontal rules >> in a table. Booktabs defines three rules of different thickness for >> use at the top of the table, after the column heads, and at the bottom >> of the table. So, one would want a function that let each of the >> rules take a different value. The default for each could be hline, >> giving the current behavior of the exporter. Francesco Pizzolante set >> this out nicely a while back: >> http://www.mail-archive.com/emacs-orgmode@gnu.org/msg18311.html in a >> message that Seb Vauban brought up in a slightly different context. >> >> All the best, >> Tom >> >> On Jun 27, 2010, at 7:09 PM, Eric Schulte wrote: >> >>> One way to deal with this without adding even more complexity to the >>> core of org-mode could be through the use of "Library of Babel" >>> functions. >>> >>> The attached org-mode file provides a function for exporting to the >>> longtable environment with some example usage. If this looks >>> generally >>> useful it (and maybe similar functions) could be added to the >>> library of >>> babel distributed w/Org-mode. >>> >>> What do you think? -- Eric >>> >>> <longtable.org> >>> Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes: >>> >>>> Hi Erik, >>>> >>>> Erik Butz wrote: >>>>> I found a very old thread on the list about using the booktabs >>>>> package to >>>>> have nicer tables in latex export. >>>>> >>>>> I found that, making the changes below I can use the booktab >>>>> package to >>>>> export tables, and using standard tables only, this seems to work >>>>> fine. >>>>> >>>>> Can anyone advice on whether this kind of change is meaningful or >>>>> if this is >>>>> likely to introduce difficulties elsewhere which I did not >>>>> experience due to >>>>> the limited scope of usage? It should be said that I did not at >>>>> all look >>>>> into longtables so far. >>>> >>>> While trying to improve this, I think one could extend it so that >>>> the table >>>> environment can be changed as well, from `tabular' to `array', >>>> tabular*', >>>> `tabularx' or any other. >>>> >>>> There was a discussion on this, a while ago, by Francesco >>>> Pizzolante. Have a >>>> read at: >>>> http://www.mail-archive.com/emacs-orgmode@gnu.org/msg18311.html >>>> . >>>> >>>> Best regards, >>>> Seb >>> _______________________________________________ >>> Emacs-orgmode mailing list >>> Please 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
end of thread, other threads:[~2010-06-30 18:54 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-06-22 21:36 latex export and booktabs tables Erik Butz 2010-06-22 23:03 ` Thomas S. Dye 2010-06-23 8:23 ` Sébastien Vauban 2010-06-28 5:09 ` Eric Schulte 2010-06-28 6:05 ` Carsten Dominik 2010-06-28 8:45 ` Sébastien Vauban 2010-06-28 15:16 ` Eric Schulte 2010-06-28 20:07 ` Erik Butz 2010-06-28 20:14 ` Sébastien Vauban 2010-06-29 8:00 ` Thomas S. Dye 2010-06-29 17:10 ` Eric Schulte 2010-06-30 3:01 ` Thomas S. Dye 2010-06-30 18:54 ` Eric Schulte
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).