emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* LaTeX multicolumn count wrong in table export
@ 2009-08-28 21:51 Karl Stump
  2009-08-28 23:04 ` Nick Dokos
  0 siblings, 1 reply; 4+ messages in thread
From: Karl Stump @ 2009-08-28 21:51 UTC (permalink / raw)
  To: emacs-orgmode


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

When exporting a table with a horizontal line the column count is wrong.

Output from pdflatex run:

! Extra alignment tab has been changed to \cr.
<template> \endtemplate 
                        
l.32 ...\multicolumn{4}{r}{Continued on next page}
                                                  \
? 

Here's the table in the tex file:

\begin{longtable}{||lll||}
\caption{This is a long table with lines around and between cells}\\
 Heading1  &  Heading2  &  Heading3 \\
\hline
\endhead
\hline\multicolumn{4}{r}{Continued on next page}\
\endfoot
\endlastfoot
\hline
 alpha     &  beta      &  gamma     \\
           &            &            \\
\end{longtable}

Here's the org file:

** table export test

#+CAPTION: This is a long table with lines around and between cells
#+LATEX_HEADER: \usepackage[landscape]{geometry}
#+LATEX_HEADER: \geometry{left=0.12in,right=0.12in,top=0.25in,bottom=0.25in}
#+ATTR_LaTeX: longtable align=||lll||

    | / | <30>     | <10>     | <10>     |
    |   | Heading1 | Heading2 | Heading3 |
    |---+----------+----------+----------|
    |   | alpha    | beta     | gamma    |
    |   |          |          |          |





      

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

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: LaTeX multicolumn count wrong in table export
  2009-08-28 21:51 LaTeX multicolumn count wrong in table export Karl Stump
@ 2009-08-28 23:04 ` Nick Dokos
  2009-08-29  4:01   ` Nick Dokos
  2009-08-29  5:24   ` Carsten Dominik
  0 siblings, 2 replies; 4+ messages in thread
From: Nick Dokos @ 2009-08-28 23:04 UTC (permalink / raw)
  To: Karl Stump; +Cc: emacs-orgmode

Karl Stump <karlstump@yahoo.com> wrote:

> When exporting a table with a horizontal line the column count is wrong.    
>                                                                             
> Output from pdflatex run:                                                   
>                                                                             
> ! Extra alignment tab has been changed to \cr.                              
> <template> \endtemplate                                                     
>                                                                             
> l.32 ....\multicolumn{4}{r}{Continued on next page}                         
>                                                   \                         
> ?                                                                           
>                                                                             
> Here's the table in the tex file:                                           
>                                                                             
> \begin{longtable}{||lll||}                                                  
> \caption{This is a long table with lines around and between cells}\\        
>  Heading1  &  Heading2  &  Heading3 \\                                      
> \hline                                                                      
> \endhead                                                                    
> \hline\multicolumn{4}{r}{Continued on next page}\                           
> \endfoot                                                                    
> \endlastfoot                                                                
> \hline                                                                      
>  alpha     &  beta      &  gamma     \\                                     
>            &            &            \\                                     
> \end{longtable}                                                             
>                                                                             
> Here's the org file:                                                        
>                                                                             
> ** table export test                                                        
>                                                                             
> #+CAPTION: This is a long table with lines around and between cells         
> #+LATEX_HEADER: \usepackage[landscape]{geometry}                            
> #+LATEX_HEADER: \geometry{left=0.12in,right=0.12in,top=0.25in,bottom=0.25in}
> #+ATTR_LaTeX: longtable align=||lll||                                       
>                                                                             
>     | / | <30>     | <10>     | <10>     |                                  
>     |   | Heading1 | Heading2 | Heading3 |                                  
>     |---+----------+----------+----------|                                  
>     |   | alpha    | beta     | gamma    |                                  
>     |   |          |          |          |                                  
> 
> start: 0000-00-00 end: 0000-00-00
> 


I believe it's because of the dummy "calculation-mark" column,
which is not exported. However, the variable org-table-last-alignment
(a list, whose length becomes the value of the \multicolumn argument)
ends up having the value (nil nil nil nil), i.e. it counts the dummy
column as well. What the proper place to adjust the value is, I don't
know, but it should be easy for Carsten to fix it. For the time being,
you can either get rid of the dummy row and column (e.g. if you don't
need the widths) or fix it by hand in the LaTeX file.

Nick

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

* Re: LaTeX multicolumn count wrong in table export
  2009-08-28 23:04 ` Nick Dokos
@ 2009-08-29  4:01   ` Nick Dokos
  2009-08-29  5:24   ` Carsten Dominik
  1 sibling, 0 replies; 4+ messages in thread
From: Nick Dokos @ 2009-08-29  4:01 UTC (permalink / raw)
  To: Karl Stump; +Cc: emacs-orgmode

Nick Dokos <nicholas.dokos@hp.com> wrote:

> Karl Stump <karlstump@yahoo.com> wrote:
> 
> > When exporting a table with a horizontal line the column count is wrong.    
> >                                                                             
> > Output from pdflatex run:                                                   
> >                                                                             
> > ! Extra alignment tab has been changed to \cr.                              
> > <template> \endtemplate                                                     
> >                                                                             
> > l.32 ....\multicolumn{4}{r}{Continued on next page}                         
> >                                                   \                         
> >                                                                             
> > ** table export test                                                        
> >                                                                             
> > #+CAPTION: This is a long table with lines around and between cells         
> > #+LATEX_HEADER: \usepackage[landscape]{geometry}                            
> > #+LATEX_HEADER: \geometry{left=0.12in,right=0.12in,top=0.25in,bottom=0.25in}
> > #+ATTR_LaTeX: longtable align=||lll||                                       
> >                                                                             
> >     | / | <30>     | <10>     | <10>     |                                  
> >     |   | Heading1 | Heading2 | Heading3 |                                  
> >     |---+----------+----------+----------|                                  
> >     |   | alpha    | beta     | gamma    |                                  
> >     |   |          |          |          |                                  
> > 
> > start: 0000-00-00 end: 0000-00-00
> > 
> 
> 
> I believe it's because of the dummy "calculation-mark" column,
> which is not exported. However, the variable org-table-last-alignment
> (a list, whose length becomes the value of the \multicolumn argument)
> ends up having the value (nil nil nil nil), i.e. it counts the dummy
> column as well. What the proper place to adjust the value is, I don't
> know, but it should be easy for Carsten to fix it. For the time being,
> you can either get rid of the dummy row and column (e.g. if you don't
> need the widths) or fix it by hand in the LaTeX file.
> 

I think the following patch fixes the above problem and is correct in
its essentials:

diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index c21c9ce..d41c231 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -1449,7 +1449,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
 \\endhead
 \\hline\\multicolumn{%d}{r}{Continued on next page}\\
 \\endfoot
-\\endlastfoot" (length org-table-last-alignment))
+\\endlastfoot" (- (length org-table-last-alignment) (if org-table-clean-did-remove-column 1 0)))
 					   nil)))
 		      (if (not longtblp) (concat "\n\\end{tabular}"))
 		      (if longtblp "\n" (if org-export-latex-tables-centered


HTH,
Nick

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

* Re: LaTeX multicolumn count wrong in table export
  2009-08-28 23:04 ` Nick Dokos
  2009-08-29  4:01   ` Nick Dokos
@ 2009-08-29  5:24   ` Carsten Dominik
  1 sibling, 0 replies; 4+ messages in thread
From: Carsten Dominik @ 2009-08-29  5:24 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode


On Aug 29, 2009, at 1:04 AM, Nick Dokos wrote:

> Karl Stump <karlstump@yahoo.com> wrote:
>
>> When exporting a table with a horizontal line the column count is  
>> wrong.
>>
>> Output from pdflatex run:
>>
>> ! Extra alignment tab has been changed to \cr.
>> <template> \endtemplate
>>
>> l.32 ....\multicolumn{4}{r}{Continued on next page}
>>                                                  \
>> ?
>>
>> Here's the table in the tex file:
>>
>> \begin{longtable}{||lll||}
>> \caption{This is a long table with lines around and between cells}\\
>> Heading1  &  Heading2  &  Heading3 \\
>> \hline
>> \endhead
>> \hline\multicolumn{4}{r}{Continued on next page}\
>> \endfoot
>> \endlastfoot
>> \hline
>> alpha     &  beta      &  gamma     \\
>>           &            &            \\
>> \end{longtable}
>>
>> Here's the org file:
>>
>> ** table export test
>>
>> #+CAPTION: This is a long table with lines around and between cells
>> #+LATEX_HEADER: \usepackage[landscape]{geometry}
>> #+LATEX_HEADER:  
>> \geometry{left=0.12in,right=0.12in,top=0.25in,bottom=0.25in}
>> #+ATTR_LaTeX: longtable align=||lll||
>>
>>    | / | <30>     | <10>     | <10>     |
>>    |   | Heading1 | Heading2 | Heading3 |
>>    |---+----------+----------+----------|
>>    |   | alpha    | beta     | gamma    |
>>    |   |          |          |          |
>>
>> start: 0000-00-00 end: 0000-00-00
>>
>
>
> I believe it's because of the dummy "calculation-mark" column,
> which is not exported. However, the variable org-table-last-alignment
> (a list, whose length becomes the value of the \multicolumn argument)
> ends up having the value (nil nil nil nil), i.e. it counts the dummy
> column as well. What the proper place to adjust the value is, I don't
> know, but it should be easy for Carsten to fix it. For the time being,
> you can either get rid of the dummy row and column (e.g. if you don't
> need the widths) or fix it by hand in the LaTeX file.
>

Indeed.  I have fixed this.  We now pops `org-table-last-alignment' if
the first column has been removed by `org-table-clean-before-export'.
The same problem must have caused a one-off error when setting the
alignment in LaTeX tables, bu it seems nobody has noticed this so
far.  Anyway, also this is fixed now.

Thanks to both of you!

- Carsten

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

end of thread, other threads:[~2009-08-29  5:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-28 21:51 LaTeX multicolumn count wrong in table export Karl Stump
2009-08-28 23:04 ` Nick Dokos
2009-08-29  4:01   ` Nick Dokos
2009-08-29  5:24   ` Carsten Dominik

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