emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Phil Regier <phil.regier@gmail.com>
To: Eric S Fraga <e.fraga@ucl.ac.uk>, emacs-orgmode@gnu.org
Subject: Re: Force center alignment in LaTeX table export?
Date: Sun, 26 Mar 2017 12:13:24 -0700	[thread overview]
Message-ID: <CAKO4ir-FmCN5aJdet0e6a4xUa_GC4XEJiyrVAwiEhKVwwne3DQ@mail.gmail.com> (raw)
In-Reply-To: <87mvc8utdq.fsf@t3610>


[-- Attachment #1.1: Type: text/plain, Size: 2468 bytes --]

See inline below and attached.  If exporting to PDF the first table gets a
prefix of "ced!10" and the second is the pale red highlight I was wanting.

Here are the important lines in the LaTeX buffer export:

\(\left[\begin{array}{>{\cocumncococ{ced!10}}c|ccc|ccc}

vs.

\(\left[\begin{array}{a|ccc|ccc}

This latter only works because in my header I have

\newcolumntype{a}{>{\columncolor{red!10}}c}




I'm not sure I'm reading the original issue, the patch, or the surrounding
code right, but is it possible the [lr]->c substitution was intended for
the case where no :align was provided by the author and org generated the
alignment automatically?  If so, would it be appropriate to just move the
substitution to the ";; Extract column groups and alignment ..." block in
org-latex--align-string, which is to say the case (if I'm reading
correctly) where the author has not provided an override?

ox-latex.el-3154-(defun org-latex--align-string (table info)
ox-latex.el-3155-  "Return an appropriate LaTeX alignment string.
ox-latex.el-3156-TABLE is the considered table.  INFO is a plist used as
ox-latex.el-3157-a communication channel."
ox-latex.el:3158:  (or (org-export-read-attribute :attr_latex table :align)
ox-latex.el-3159-      (let (align)
ox-latex.el-3160-    ;; Extract column groups and alignment from first
(non-rule)



Org file to demonstrate problem and workaround:

#+latex_header: \usepackage{xcolor}
#+latex_header: \usepackage{colortbl}

* Non-Working Example
#+ATTR_LaTeX: :mode inline-math :environment array
#+attr_latex: :math-prefix \left[ :math-suffix \right]
#+attr_latex: :align >{\columncolor{red!10}}c|ccc|ccc
|         |   | * | * |   |   |
| *       |   |   | * |   |   |
| \hline* |   |   |   | * |   |
|         |   |   |   | * | * |


* Working Example
  Just define a column type that doesn't use the characters 'l' or 'r'

#+latex_header: \newcolumntype{a}{>{\columncolor{red!10}}c}

#+ATTR_LaTeX: :mode inline-math :environment array
#+attr_latex: :math-prefix \left[ :math-suffix \right]
#+attr_latex: :align a|ccc|ccc
|         |   | * | * |   |   |
| *       |   |   | * |   |   |
| \hline* |   |   |   | * |   |
|         |   |   |   | * | * |


On Sun, Mar 26, 2017 at 5:14 AM, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:

> Can you please post an ECM (small example) of the org table with
> attributes that you are having problems with?
>
> --
> : Eric S Fraga (0xFFFCF67D), Emacs 26.0.50, Org release_9.0.5-385-g72fc2d
>

[-- Attachment #1.2: Type: text/html, Size: 3260 bytes --]

[-- Attachment #2: ecm.org --]
[-- Type: application/vnd.lotus-organizer, Size: 803 bytes --]

  reply	other threads:[~2017-03-26 19:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <6b2d8e5e114b4ea9accc4d28a9d98662@AM4PR01MB1891.eurprd01.prod.exchangelabs.com>
2017-03-26 12:14 ` Force center alignment in LaTeX table export? Eric S Fraga
2017-03-26 19:13   ` Phil Regier [this message]
2017-03-27 11:53     ` Nicolas Goaziou
     [not found]   ` <7201c71ccd6440fe9cfd491a95bf3e26@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-03-27  8:39     ` Eric S Fraga
2017-03-26  6:25 Phil Regier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKO4ir-FmCN5aJdet0e6a4xUa_GC4XEJiyrVAwiEhKVwwne3DQ@mail.gmail.com \
    --to=phil.regier@gmail.com \
    --cc=e.fraga@ucl.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).