Hello,

This is my first patch so hopefully I followed the instructions correctly,

While using ~org-table-export~ on a table directly even with ~org-latex-tables-booktabs~ set to ~t~, it exports a normal table instead of booktabs table. But on the same situation, if you export the whole buffer the table will be exported according to booktabs.

So my theory was there is a discrepancy between the method used by ~org-latex-export-to-latex~ and the ~org-table-export~. And on browsing the codes for those two I found this.

The code for ~org-latex-table-row~ used by latex export backend has this line:

#+begin_src emacs-lisp :tangle yes
(booktabsp (if (plist-member attr :booktabs) (plist-get attr :booktabs)
     (plist-get info :latex-tables-booktabs)))
#+end_src

Shows that it also takes into account the ~info~ plist.


I couldn't find out what that info plist has, but I can assume it's the information on the overall buffer or that table's context, and it has the effect of using the booktabs from the config.

While the code for ~orgtbl-to-latex~ shows it only takes into account the ~booktabs~ parameter on latex table.

#+begin_src emacs-lisp :tangle yes
 :latex-tables-booktabs (plist-get params :booktabs)
#+end_src

So I tried changing the line in ~orgtbl-to-latex~ to

#+begin_src emacs-lisp :tangle yes
 :latex-tables-booktabs (if (plist-member params :booktabs) (plist-get params :booktabs)
     org-latex-tables-booktabs)
#+end_src

So if there is ~booktabs~ parameter then it'll overwrite the settings but if not it'll use the booktabs config.

There is probably a better way to use it, but this works for now so I tried this.

Please find the attached patch with the fix.

Regards,
Gaurav