emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Force center alignment in LaTeX table export?


From: Phil Regier
Subject: Re: [O] Force center alignment in LaTeX table export?
Date: Sun, 26 Mar 2017 12:13:24 -0700

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 <address@hidden> 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: ecm.org
Description: Lotus Organizer


reply via email to

[Prev in Thread] Current Thread [Next in Thread]