emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Force center alignment in LaTeX table export?
@ 2017-03-26  6:25 Phil Regier
  0 siblings, 0 replies; 5+ messages in thread
From: Phil Regier @ 2017-03-26  6:25 UTC (permalink / raw)
  To: emacs-orgmode

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

Apologies in advance if this has been discussed already; I lost track of
the list for a while.

That said, since updating to ELPA org-20170210, I can no longer (I'm pretty
sure this was working previously but I can't prove it -- maybe my document
was broken and I just didn't notice) use \columncolor{red} in the :align
argument to #+latex+attr: for tables any more; this gets changed to
\cocumncococ{ced} by the following ox-latex code:

3361             ;; Make sure cells are always centered while preserving
3362             ;; vertical separators.
3363             (let ((align (replace-regexp-in-string
3364                           "[lr]" "c" (org-latex--align-string table
info))))

at

http://orgmode.org/w/org-mode.git?p=org-mode.git;a=blob;f=lisp/ox-latex.el;hb=9faf000e6a6977135a1d09dba4a078cdd9e04b38#l3361

I'm not certain whether I should be surprised that all non-centered
alignments are changed to centered, or that in general any text with an 'l'
or 'r' isn't valid in :align, or both.

This seems to have been commit 975260cb2596fb8cf0660cc91f2207c48b845699 to
preserve column groups, but I'm not sure I understand the original problem
or the fix.  What does replacing l's and r's with c's achieve?  Should I be
defining new column types and/or just using a \newcommand that doesn't use
the characters "l" or "r" instead of trying to directly set \columncolor
directly in the alignment string?

Thanks...

Phil

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

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

* Re: Force center alignment in LaTeX table export?
       [not found] <6b2d8e5e114b4ea9accc4d28a9d98662@AM4PR01MB1891.eurprd01.prod.exchangelabs.com>
@ 2017-03-26 12:14 ` Eric S Fraga
  2017-03-26 19:13   ` Phil Regier
       [not found]   ` <7201c71ccd6440fe9cfd491a95bf3e26@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
  0 siblings, 2 replies; 5+ messages in thread
From: Eric S Fraga @ 2017-03-26 12:14 UTC (permalink / raw)
  To: emacs-orgmode

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

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

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

* Re: Force center alignment in LaTeX table export?
  2017-03-26 12:14 ` Force center alignment in LaTeX table export? Eric S Fraga
@ 2017-03-26 19:13   ` Phil Regier
  2017-03-27 11:53     ` Nicolas Goaziou
       [not found]   ` <7201c71ccd6440fe9cfd491a95bf3e26@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
  1 sibling, 1 reply; 5+ messages in thread
From: Phil Regier @ 2017-03-26 19:13 UTC (permalink / raw)
  To: Eric S Fraga, emacs-orgmode


[-- 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 --]

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

* Re: Force center alignment in LaTeX table export?
       [not found]   ` <7201c71ccd6440fe9cfd491a95bf3e26@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
@ 2017-03-27  8:39     ` Eric S Fraga
  0 siblings, 0 replies; 5+ messages in thread
From: Eric S Fraga @ 2017-03-27  8:39 UTC (permalink / raw)
  To: emacs-orgmode

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

On Sunday, 26 Mar 2017 at 19:13, Phil Regier wrote:
> 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.

Thanks for the example.  I cannot add anything to your analysis.  Hope
somebody else can help.

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50, Org release_9.0.5-385-g72fc2d

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

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

* Re: Force center alignment in LaTeX table export?
  2017-03-26 19:13   ` Phil Regier
@ 2017-03-27 11:53     ` Nicolas Goaziou
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2017-03-27 11:53 UTC (permalink / raw)
  To: Phil Regier; +Cc: emacs-orgmode

Hello,

Phil Regier <phil.regier@gmail.com> 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

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

end of thread, other threads:[~2017-03-27 11:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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
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

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