emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Exporting tables with cell borders to Latex/PDF
@ 2024-10-18 21:31 jman
  2024-10-18 23:37 ` Mark Barton
  0 siblings, 1 reply; 3+ messages in thread
From: jman @ 2024-10-18 21:31 UTC (permalink / raw)
  To: Emacs Orgmode


Hello,

When export to Latex/PDF I'd like /all/ table cells to have borders, so also vertical column
separators.
After looking around a bit, I learned about column groups:
https://orgmode.org/manual/Column-Groups.html

I think the only way to accomplish what I want is the following trick, adding a "cosmetic" column
just to be able to have a border at the beginning of the table:

|---+---+-----+-----+-----+---------+------------|
|   | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
|---+---+-----+-----+-----+---------+------------|
| / | < |   < |   < |   < |       < |         <> |
|   | 1 |   1 |   1 |   1 |       1 |          1 |
|   | 2 |   4 |   8 |  16 |  1.4142 |     1.1892 |
|   | 3 |   9 |  27 |  81 |  1.7321 |     1.3161 |
|---+---+-----+-----+-----+---------+------------|
#+TBLFM: $2=$1^2::$3=$1^3::$4=$1^4::$5=sqrt($1)::$6=sqrt(sqrt(($1)))

Am I missing a better solution?

Thanks



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

* Re: Exporting tables with cell borders to Latex/PDF
  2024-10-18 21:31 Exporting tables with cell borders to Latex/PDF jman
@ 2024-10-18 23:37 ` Mark Barton
  2024-10-19 12:25   ` jman
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Barton @ 2024-10-18 23:37 UTC (permalink / raw)
  To: jman; +Cc: Org Mode List

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



> On Oct 18, 2024, at 2:31 PM, jman <emacs-orgmode@city17.xyz> wrote:
> 
> 
> Hello,
> 
> When export to Latex/PDF I'd like /all/ table cells to have borders, so also vertical column
> separators.
> After looking around a bit, I learned about column groups:
> https://orgmode.org/manual/Column-Groups.html
> 
> I think the only way to accomplish what I want is the following trick, adding a "cosmetic" column
> just to be able to have a border at the beginning of the table:
> 
> |---+---+-----+-----+-----+---------+------------|
> |   | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
> |---+---+-----+-----+-----+---------+------------|
> | / | < |   < |   < |   < |       < |         <> |
> |   | 1 |   1 |   1 |   1 |       1 |          1 |
> |   | 2 |   4 |   8 |  16 |  1.4142 |     1.1892 |
> |   | 3 |   9 |  27 |  81 |  1.7321 |     1.3161 |
> |---+---+-----+-----+-----+---------+------------|
> #+TBLFM: $2=$1^2::$3=$1^3::$4=$1^4::$5=sqrt($1)::$6=sqrt(sqrt(($1)))
> 
> Am I missing a better solution?
> 
> Thanks
> 
> 

Here is an example of using the #+ATTR_LaTeX: line to pass parameters to the LaTeX process that creates the pdf.

#+ATTR_LaTeX: :environment tabular :align |l|l|l|
|-----+-----+-------|
| one | two | three |
|-----+-----+-------|
|   1 |   2 |     3 |
|-----+-----+-------|

Mark

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

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

* Re: Exporting tables with cell borders to Latex/PDF
  2024-10-18 23:37 ` Mark Barton
@ 2024-10-19 12:25   ` jman
  0 siblings, 0 replies; 3+ messages in thread
From: jman @ 2024-10-19 12:25 UTC (permalink / raw)
  To: Mark Barton; +Cc: Org Mode List

Mark Barton <mbarton98@gmail.com> writes:

> Here is an example of using the #+ATTR_LaTeX: line to pass parameters to the LaTeX process that 
> creates the pdf.
>
> #+ATTR_LaTeX: :environment tabular :align |l|l|l|
> |-----+-----+-------|
> | one | two | three |
> |-----+-----+-------|
> |   1 |   2 |     3 |
> |-----+-----+-------|

Oh thank you for the tip! Now I've found a mention in the documentation:
https://orgmode.org/manual/Tables-in-LaTeX-export.html

I'll try unpacking the solution for clarity: `l` means align to the left, the pipe (`|`) means add a 
vertical separator.
Here a bit more documentation about the tabular package:
https://www.overleaf.com/learn/latex/Tables

Note: I think it also works without setting `:environment tabular`, why?

Cheers,


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

end of thread, other threads:[~2024-10-19 12:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-18 21:31 Exporting tables with cell borders to Latex/PDF jman
2024-10-18 23:37 ` Mark Barton
2024-10-19 12:25   ` jman

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