From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Force center alignment in LaTeX table export? Date: Mon, 27 Mar 2017 13:53:33 +0200 Message-ID: <87fuhzj5qa.fsf@nicolasgoaziou.fr> References: <6b2d8e5e114b4ea9accc4d28a9d98662@AM4PR01MB1891.eurprd01.prod.exchangelabs.com> <87mvc8utdq.fsf@t3610> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35859) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csTDV-0001hA-1f for emacs-orgmode@gnu.org; Mon, 27 Mar 2017 07:53:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1csTDR-0006tM-Vo for emacs-orgmode@gnu.org; Mon, 27 Mar 2017 07:53:45 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:46170) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1csTDR-0006st-PE for emacs-orgmode@gnu.org; Mon, 27 Mar 2017 07:53:41 -0400 In-Reply-To: (Phil Regier's message of "Sun, 26 Mar 2017 12:13:24 -0700") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Phil Regier Cc: emacs-orgmode@gnu.org Hello, Phil Regier writes: > 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* | | | | * | | > | | | | | * | * | Fixed. Thank you. Regards, -- Nicolas Goaziou