emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: Problem with LaTeX export, footnotes in table headers, and longtabu [8.3.4 (8.3.4-31-gcb683e-elpa @ /home/berhol/.emacs.d/elpa/org-20160404/)]
@ 2016-04-12  8:54 Berthold Höllmann
  2016-04-14  8:03 ` Nicolas Goaziou
  0 siblings, 1 reply; 8+ messages in thread
From: Berthold Höllmann @ 2016-04-12  8:54 UTC (permalink / raw)
  To: emacs-orgmode

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



Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

     http://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org-mode mailing list.
------------------------------------------------------------------------

I am exporting a large table from org to pdf via LaTeX. The meaning of
some of the column headers are to be explained in footnotes. The table
spans more than one page, so continuation headers are generated using
longtabu. These continuation headers mangle with the footnote numbering
as can be seen in this example:

# -*- mode: org -*-
#+STARTUP: showall
#+LaTeX_CLASS_OPTIONS: [a5paper]
#+LATEX_HEADER: \usepackage[T1]{fontenc}
#+LATEX_HEADER: \usepackage[utf8x]{inputenc}
#+LATEX_HEADER: \usepackage{tabu}
#+TITLE: Multi page table test

* Multi page table

  #+ATTR_LATEX: :environment longtabu
  | *Typ[fn:test]* |
  |----------------|
  |              1 |
  |              2 |
  |              3 |
  |              4 |
  |              5 |
  |              6 |
  |    7[fn:test2] |
  |              8 |
  |              9 |
  |             10 |
  |----------------|

* Footnotes

[fn:test]
  Testing footnotes with multi page latex tables.

[fn:test2]
  Another Test

DNV GL SE, Registered Office Hamburg No. HRB 115442 • Chairman of the Supervisory Board: Remi Eriksen • Executive Board: Knut Ørbeck-Nilssen • Torsten Schramm • Björn-Olaf Borth •
The latest edition of the General Terms and Conditions of DNV GL SE is applicable.

**************************************************************************************
This e-mail and any attachments thereto may contain confidential information and/or information protected by intellectual property rights for the exclusive attention of the intended addressees named above. If you have received this transmission in error, please immediately notify the sender by return e-mail and delete this message and its attachments. Unauthorized use, copying or further full or partial distribution of this e-mail or its contents is prohibited.
**************************************************************************************

[-- Attachment #2: org_ltxtab.tex --]
[-- Type: text/x-tex, Size: 1323 bytes --]

% Created 2016-04-12 Di 10:53
\documentclass[a5paper]{article}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{wasysym}
\usepackage{amssymb}
\usepackage{hyperref}
\usepackage{booktabs}
\tolerance=1000
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage{tabu}
\author{Berthold Höllmann}
\date{\today}
\title{Multi page table test}
\hypersetup{
 pdfauthor={Berthold Höllmann},
 pdftitle={Multi page table test},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 24.5.1 (Org mode 8.3.4)}, 
 pdflang={English}}
\begin{document}

\maketitle
\tableofcontents


\section{Multi page table}
\label{sec:orgheadline1}

\begin{longtabu}{r}
\textbf{Typ\footnotemark}\\
\hline
\endfirsthead
\multicolumn{1}{l}{Continued from previous page} \\
\hline

\textbf{Typ\footnotemark} \\

\hline
\endhead
\hline\multicolumn{1}{r}{Continued on next page} \\
\endfoot
\endlastfoot
\hline
1\\
2\\
3\\
4\\
5\\
6\\
7\footnotemark\\
8\\
9\\
10\\
\hline
\end{longtabu}
\footnotetext[1]{Testing footnotes with multi page latex tables.}\footnotetext[2]{Another Test}
\end{document}

[-- Attachment #3: org_ltxtab.pdf --]
[-- Type: application/pdf, Size: 19054 bytes --]

[-- Attachment #4: Type: text/plain, Size: 8131 bytes --]


[fn:test] becomes [1] in the first, and [2] in the continuation headers,
but [2] links to the content of [fn:test2], which becomes a reference
without target.
 

Emacs  : GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8)
 of 2015-04-13 on pc130799.gl.ad.germanlloyd.org
Package: Org-mode version 8.3.4 (8.3.4-31-gcb683e-elpa @ /home/berhol/.emacs.d/elpa/org-20160404/)

current state:
==============
(setq
 org-src-lang-modes '(("ipython" . python) ("ocaml" . tuareg) ("elisp" . emacs-lisp)
                      ("ditaa" . artist) ("asymptote" . asy) ("dot" . fundamental)
                      ("sqlite" . sql) ("calc" . fundamental) ("C" . c) ("cpp" . c++)
                      ("C++" . c++) ("screen" . shell-script) ("shell" . sh) ("bash" . sh))
 org-journal-mode-hook '(#[nil "\301\b\302\303\304$\207"
                           [org-journal-encrypt-on org-add-hook org-journal-encryption-hook nil
                            t]
                           5]
                         (lambda nil
                          (org-add-hook org-journal-encrypt-on
                           (quote org-journal-encryption-hook) nil t)
                          )
                         )
 org-tab-first-hook '(org-hide-block-toggle-maybe org-babel-hide-result-toggle-maybe
                      org-babel-header-arg-expand)
 outline-minor-mode-hook '(outshine-hook-function)
 org-latex-classes '(("dnvglartcl"
                      "\\documentclass[paper=a4,%\ntwoside,%\n10pt,%\nheadings=small,footinclude=false,%\nheadinclude,%\nheadlines,%\nBCOR12mm,%\nDIV14,%\ncolhead]{dnvglartcl}\n[EXTRA]"
                      ("\\section{%s}" . "\\section*{%s}")
                      ("\\subsection{%s}" . "\\subsection*{%s}")
                      ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
                      ("\\paragraph{%s}" . "\\paragraph*{%s}")
                      ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
                     ("article" "\\documentclass[11pt]{article}"
                      ("\\section{%s}" . "\\section*{%s}")
                      ("\\subsection{%s}" . "\\subsection*{%s}")
                      ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
                      ("\\paragraph{%s}" . "\\paragraph*{%s}")
                      ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
                     ("report" "\\documentclass[11pt]{report}" ("\\part{%s}" . "\\part*{%s}")
                      ("\\chapter{%s}" . "\\chapter*{%s}") ("\\section{%s}" . "\\section*{%s}")
                      ("\\subsection{%s}" . "\\subsection*{%s}")
                      ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
                     ("book" "\\documentclass[11pt]{book}" ("\\part{%s}" . "\\part*{%s}")
                      ("\\chapter{%s}" . "\\chapter*{%s}") ("\\section{%s}" . "\\section*{%s}")
                      ("\\subsection{%s}" . "\\subsection*{%s}")
                      ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
                     )
 org-latex-default-packages-alist '(("" "fixltx2e" nil) ("" "graphicx" t) ("" "longtable" nil)
                                    ("" "float" nil) ("" "wrapfig" nil) ("" "rotating" nil)
                                    ("normalem" "ulem" t) ("" "amsmath" t) ("" "textcomp" t)
                                    ("" "marvosym" t) ("" "wasysym" t) ("" "amssymb" t)
                                    ("" "hyperref" nil) ("" "booktabs" t) "\\tolerance=1000")
 org-pre-cycle-hook '(org-fstree-show-entry-maybe)
 org-speed-command-hook '(org-speed-command-default-hook org-babel-speed-command-hook)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-html-format-drawer-function '(lambda (name contents) contents)
 org-log-done t
 org-latex-format-inlinetask-function 'org-latex-format-inlinetask-default-function
 org-confirm-shell-link-function 'yes-or-no-p
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-link-translation-function 'toc-org-unhrefify
 org-latex-pdf-process '("latexmk -C -latex=xelatex -bibtex-cond -f %f"
                         "latexmk -latex=xelatex -bibtex-cond -f %f")
 org-latex-format-headline-function 'org-latex-format-headline-default-function
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-latex-format-drawer-function '(lambda (name contents) contents)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '(flyspell-mode toc-org-enable org-autolist-mode
                 #[nil "\300\301\302\303\304$\207"
                   [org-add-hook change-major-mode-hook org-show-block-all append local] 5]
                 #[nil "\300\301\302\303\304$\207"
                   [org-add-hook change-major-mode-hook org-babel-show-result-all append local]
                   5]
                 org-babel-result-hide-spec org-babel-hide-all-hashes
                 emoji-cheat-sheet-plus-display-mode org-journal-update-auto-mode-alist
                 org-bullets-mode whitespace-cleanup-mode)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-ascii-format-drawer-function '(lambda (name contents width) contents)
 org-ctrl-c-ctrl-c-hook '(org-fstree-apply-maybe org-babel-hash-at-point
                          org-babel-execute-safely-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
                  org-cycle-show-empty-lines org-optimize-window-after-visibility-change)
 org-linkany/browse-function 'browse-url-firefox
 org-export-before-processing-hook '(org-impress-js-begin)
 org-babel-tangle-lang-exts '(("python" . "py") ("perl" . "pl") ("maxima" . "max")
                              ("lisp" . "lisp") ("latex" . "tex") ("java" . "java")
                              ("fortran" . "F90") ("awk" . "awk") ("asymptote" . "asy")
                              ("D" . "d") ("C++" . "cpp") ("emacs-lisp" . "el")
                              ("elisp" . "el"))
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 outline-mode-hook '(flyspell-mode)
 org-babel-after-execute-hook '(org-display-inline-images)
 org-latex-listings t
 org-html-format-headline-function 'org-html-format-headline-default-function
 org-babel-load-languages '((C . t) (R . t) (asymptote . t) (awk . t) (calc) (clojure)
                            (comint . t) (css . t) (ditaa . t) (dot . t) (emacs-lisp . t)
                            (fortran . t) (gnuplot . t) (haskell) (io) (java . t) (js . t)
                            (latex . t) (ledger) (lilypond) (lisp . t) (matlab . t)
                            (maxima . t) (mscgen) (ocaml) (octave . t) (org . t) (perl . t)
                            (picolisp) (plantuml) (python . t) (ref . t) (ruby) (sass) (scala)
                            (scheme) (screen) (sh . t) (shen) (sql . t) (sqlite . t))
 org-reveal-start-hook '(org-decrypt-entry)
 org-html-format-inlinetask-function 'org-html-format-inlinetask-default-function
 org-agenda-mode-hook '(desktop+--org-agenda-mode-hook)
 org-agenda-files '("~/note.org")
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-confirm-babel-evaluate nil
 )
-- 
Best regards
for DNV GL SE

Berthold Höllmann
-- 
Development Eng. - Structural Methods, Information Management Research & Development, Hamburg


E-mail berthold.hoellmann@dnvgl.com
Direct +49 40 36149 7374

www.dnvgl.com | www.linkedin.com/company/dnvgl

DNV GL

DNV and GL have merged to form DNV GL
We are now the world's largest ship and offshore classification
society, the leading technical advisor to the global oil and gas
industry, and a leading expert for the energy value chain including
renewables and energy efficiency. We've also taken a position as one
of the top three certification bodies in the world. Read more here:
www.dnvgl.com/merger.

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

* Re: Bug: Problem with LaTeX export, footnotes in table headers, and longtabu [8.3.4 (8.3.4-31-gcb683e-elpa @ /home/berhol/.emacs.d/elpa/org-20160404/)]
  2016-04-12  8:54 Bug: Problem with LaTeX export, footnotes in table headers, and longtabu [8.3.4 (8.3.4-31-gcb683e-elpa @ /home/berhol/.emacs.d/elpa/org-20160404/)] Berthold Höllmann
@ 2016-04-14  8:03 ` Nicolas Goaziou
  2016-04-14 14:02   ` Berthold Hoellmann
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2016-04-14  8:03 UTC (permalink / raw)
  To: Berthold Höllmann; +Cc: emacs-orgmode

Hello,

Berthold Höllmann <berthold.hoellmann@dnvgl.com> writes:

> I am exporting a large table from org to pdf via LaTeX. The meaning of
> some of the column headers are to be explained in footnotes. The table
> spans more than one page, so continuation headers are generated using
> longtabu. These continuation headers mangle with the footnote numbering
> as can be seen in this example:
>
> # -*- mode: org -*-
> #+STARTUP: showall
> #+LaTeX_CLASS_OPTIONS: [a5paper]
> #+LATEX_HEADER: \usepackage[T1]{fontenc}
> #+LATEX_HEADER: \usepackage[utf8x]{inputenc}
> #+LATEX_HEADER: \usepackage{tabu}
> #+TITLE: Multi page table test
>
> * Multi page table
>
>   #+ATTR_LATEX: :environment longtabu
>   | *Typ[fn:test]* |
>   |----------------|
>   |              1 |
>   |              2 |
>   |              3 |
>   |              4 |
>   |              5 |
>   |              6 |
>   |    7[fn:test2] |
>   |              8 |
>   |              9 |
>   |             10 |
>   |----------------|
>
> * Footnotes
>
> [fn:test]
>   Testing footnotes with multi page latex tables.
>
> [fn:test2]
>   Another Test

[...]

> \section{Multi page table}
> \label{sec:orgheadline1}
>
> \begin{longtabu}{r}
> \textbf{Typ\footnotemark}\\
> \hline
> \endfirsthead
> \multicolumn{1}{l}{Continued from previous page} \\
> \hline
>
> \textbf{Typ\footnotemark} \\
>
> \hline
> \endhead
> \hline\multicolumn{1}{r}{Continued on next page} \\
> \endfoot
> \endlastfoot
> \hline
> 1\\
> 2\\
> 3\\
> 4\\
> 5\\
> 6\\
> 7\footnotemark\\
> 8\\
> 9\\
> 10\\
> \hline
> \end{longtabu}
> \footnotetext[1]{Testing footnotes with multi page latex tables.}\footnotetext[2]{Another Test}
> \end{document}
>
>
>
> [fn:test] becomes [1] in the first, and [2] in the continuation headers,
> but [2] links to the content of [fn:test2], which becomes a reference
> without target.

Isn't it a LaTeX limitation? IIRC, footnotes support in tables is
somewhat flaky. Anyway, if you think it is Org's fault, do you know the
LaTeX code that should be produced in this case?


Regards,

-- 
Nicolas Goaziou

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

* Re: Bug: Problem with LaTeX export, footnotes in table headers, and longtabu [8.3.4 (8.3.4-31-gcb683e-elpa @ /home/berhol/.emacs.d/elpa/org-20160404/)]
  2016-04-14  8:03 ` Nicolas Goaziou
@ 2016-04-14 14:02   ` Berthold Hoellmann
  2016-04-16 10:11     ` Nicolas Goaziou
  0 siblings, 1 reply; 8+ messages in thread
From: Berthold Hoellmann @ 2016-04-14 14:02 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Hello,
>
> Berthold Höllmann <berthold.hoellmann@dnvgl.com> writes:
>
>> I am exporting a large table from org to pdf via LaTeX. The meaning of
>> some of the column headers are to be explained in footnotes. The table
>> spans more than one page, so continuation headers are generated using
>> longtabu. These continuation headers mangle with the footnote numbering
>> as can be seen in this example:
>>
>> # -*- mode: org -*-
>> #+STARTUP: showall
>> #+LaTeX_CLASS_OPTIONS: [a5paper]
>> #+LATEX_HEADER: \usepackage[T1]{fontenc}
>> #+LATEX_HEADER: \usepackage[utf8x]{inputenc}
>> #+LATEX_HEADER: \usepackage{tabu}
>> #+TITLE: Multi page table test
>>
>> * Multi page table
>>
>>   #+ATTR_LATEX: :environment longtabu
>>   | *Typ[fn:test]* |
>>   |----------------|
>>   |              1 |
>>   |              2 |
>>   |              3 |
>>   |              4 |
>>   |              5 |
>>   |              6 |
>>   |    7[fn:test2] |
>>   |              8 |
>>   |              9 |
>>   |             10 |
>>   |----------------|
>>
>> * Footnotes
>>
>> [fn:test]
>>   Testing footnotes with multi page latex tables.
>>
>> [fn:test2]
>>   Another Test
>
> [...]
>
>> \section{Multi page table}
>> \label{sec:orgheadline1}
>>
>> \begin{longtabu}{r}
>> \textbf{Typ\footnotemark}\\
>> \hline
>> \endfirsthead
>> \multicolumn{1}{l}{Continued from previous page} \\
>> \hline
>>
>> \textbf{Typ\footnotemark} \\
>>
>> \hline
>> \endhead
>> \hline\multicolumn{1}{r}{Continued on next page} \\
>> \endfoot
>> \endlastfoot
>> \hline
>> 1\\
>> 2\\
>> 3\\
>> 4\\
>> 5\\
>> 6\\
>> 7\footnotemark\\
>> 8\\
>> 9\\
>> 10\\
>> \hline
>> \end{longtabu}
>> \footnotetext[1]{Testing footnotes with multi page latex tables.}\footnotetext[2]{Another Test}
>> \end{document}
>>
>>
>>
>> [fn:test] becomes [1] in the first, and [2] in the continuation headers,
>> but [2] links to the content of [fn:test2], which becomes a reference
>> without target.
>
> Isn't it a LaTeX limitation? IIRC, footnotes support in tables is
> somewhat flaky. Anyway, if you think it is Org's fault, do you know the
> LaTeX code that should be produced in this case?
>

Actually I was able to patch `org-latex-footnote-reference' to get the
results I line. The trick is to add the counter number given at the
\footnotetext command to the \footnotemark command also:

(defun org-latex-footnote-reference (footnote-reference contents info)
  "Transcode a FOOTNOTE-REFERENCE element from Org to LaTeX.
CONTENTS is nil.  INFO is a plist holding contextual information."
  (concat
   ;; Insert separator between two footnotes in a row.
   (let ((prev (org-export-get-previous-element footnote-reference info)))
     (when (eq (org-element-type prev) 'footnote-reference)
       (plist-get info :latex-footnote-separator)))
   (cond
    ;; Use \footnotemark if the footnote has already been defined.
    ((not (org-export-footnote-first-reference-p footnote-reference info))
     (format "\\footnotemark[%s]{}"
             (org-export-get-footnote-number footnote-reference info)))
    ;; Use \footnotemark if reference is within another footnote
    ;; reference, footnote definition or table cell.
    ((org-element-lineage footnote-reference
                          '(footnote-reference footnote-definition table-cell))
     (format "\\footnotemark[%s]{}"
             (org-export-get-footnote-number footnote-reference info)))
    ;; Otherwise, define it with \footnote command.
    (t
     (let ((def (org-export-get-footnote-definition footnote-reference info)))
       (concat
        (format "\\footnote{%s}" (org-trim (org-export-data def info)))
        ;; Retrieve all footnote references within the footnote and
        ;; add their definition after it, since LaTeX doesn't support
        ;; them inside.
        (org-latex--delayed-footnotes-definitions def info)))))))


Best regards

Berthold Höllmann
--
Development Eng. - Structural Methods, Information Management Research & Development, Hamburg


E-mail berthold.hoellmann@dnvgl.com
Direct +49 40 36149 7374

www.dnvgl.com | www.linkedin.com/company/dnvgl

DNV GL

DNV and GL have merged to form DNV GL
We are now the world's largest ship and offshore classification
society, the leading technical advisor to the global oil and gas
industry, and a leading expert for the energy value chain including
renewables and energy efficiency. We've also taken a position as one
of the top three certification bodies in the world. Read more here:
www.dnvgl.com/merger.
DNV GL SE, Registered Office Hamburg No. HRB 115442 • Chairman of the Supervisory Board: Remi Eriksen • Executive Board: Knut Ørbeck-Nilssen • Torsten Schramm • Björn-Olaf Borth •
The latest edition of the General Terms and Conditions of DNV GL SE is applicable.

**************************************************************************************
This e-mail and any attachments thereto may contain confidential information and/or information protected by intellectual property rights for the exclusive attention of the intended addressees named above. If you have received this transmission in error, please immediately notify the sender by return e-mail and delete this message and its attachments. Unauthorized use, copying or further full or partial distribution of this e-mail or its contents is prohibited.
**************************************************************************************

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

* Re: Bug: Problem with LaTeX export, footnotes in table headers, and longtabu [8.3.4 (8.3.4-31-gcb683e-elpa @ /home/berhol/.emacs.d/elpa/org-20160404/)]
  2016-04-14 14:02   ` Berthold Hoellmann
@ 2016-04-16 10:11     ` Nicolas Goaziou
  2016-04-17 15:42       ` Berthold Höllmann
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2016-04-16 10:11 UTC (permalink / raw)
  To: Berthold Hoellmann; +Cc: emacs-orgmode

Hello,

Berthold Hoellmann <berthold.hoellmann@dnvgl.com> writes:

> Actually I was able to patch `org-latex-footnote-reference' to get the
> results I line. The trick is to add the counter number given at the
> \footnotetext command to the \footnotemark command also:

It sounds good. Would you like to provide a patch against master for
that?

Thank you.

Regards,

-- 
Nicolas Goaziou

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

* Re: Bug: Problem with LaTeX export, footnotes in table headers, and longtabu [8.3.4 (8.3.4-31-gcb683e-elpa @ /home/berhol/.emacs.d/elpa/org-20160404/)]
  2016-04-16 10:11     ` Nicolas Goaziou
@ 2016-04-17 15:42       ` Berthold Höllmann
  2016-04-19 19:26         ` Nicolas Goaziou
  0 siblings, 1 reply; 8+ messages in thread
From: Berthold Höllmann @ 2016-04-17 15:42 UTC (permalink / raw)
  To: emacs-orgmode

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

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Hello,
>
> Berthold Hoellmann <berthold.hoellmann@dnvgl.com> writes:
>
>> Actually I was able to patch `org-latex-footnote-reference' to get the
>> results I line. The trick is to add the counter number given at the
>> \footnotetext command to the \footnotemark command also:
>
> It sounds good. Would you like to provide a patch against master for
> that?

I just tried to prepare a patch, but looking into it I reckoned that my
solution breaks hyperref.

The more I looked into the code, the more confused I am (I'm not a lisp
programmer).

hypperref works again half way, if i define the first occurrence of the
footnote using a bare "\footnotemark", and use "\footnotemark[<footnote
number>]" in subsequent uses. As I understand the code,
"\footnotemark[<footnote number>]" should be used, when a footnote
marker is reused, but

  (org-export-footnote-first-reference-p footnote-reference info)

seems to be true only, if "\footnote" was used previously. But I am lost
here.

Kind regards
Berthold Höllmann


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

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

* Re: Bug: Problem with LaTeX export, footnotes in table headers, and longtabu [8.3.4 (8.3.4-31-gcb683e-elpa @ /home/berhol/.emacs.d/elpa/org-20160404/)]
  2016-04-17 15:42       ` Berthold Höllmann
@ 2016-04-19 19:26         ` Nicolas Goaziou
  2016-04-19 22:11           ` Berthold Höllmann
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2016-04-19 19:26 UTC (permalink / raw)
  To: Berthold Höllmann; +Cc: emacs-orgmode, berthold

Hello,

bhoel@despammed.com (Berthold Höllmann) writes:

> hypperref works again half way, if i define the first occurrence of the
> footnote using a bare "\footnotemark", and use "\footnotemark[<footnote
> number>]" in subsequent uses.

Isn't it the case already?

  (cond
   ;; Use \footnotemark if the footnote has already been defined.
   ((not (org-export-footnote-first-reference-p footnote-reference info))
    (format "\\footnotemark[%s]{}"
            (org-export-get-footnote-number footnote-reference info)))
   ;; Use \footnotemark if reference is within another footnote
   ;; reference, footnote definition or table cell.
   ((org-element-lineage footnote-reference
                         '(footnote-reference footnote-definition table-cell))
    "\\footnotemark")
   ...)


Regards,

-- 
Nicolas Goaziou

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

* Re: Bug: Problem with LaTeX export, footnotes in table headers, and longtabu [8.3.4 (8.3.4-31-gcb683e-elpa @ /home/berhol/.emacs.d/elpa/org-20160404/)]
  2016-04-19 19:26         ` Nicolas Goaziou
@ 2016-04-19 22:11           ` Berthold Höllmann
  2016-04-20 21:40             ` Nicolas Goaziou
  0 siblings, 1 reply; 8+ messages in thread
From: Berthold Höllmann @ 2016-04-19 22:11 UTC (permalink / raw)
  To: emacs-orgmode

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

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

Hello,

> Hello,
>
> bhoel@despammed.com (Berthold Höllmann) writes:
>
>> hypperref works again half way, if i define the first occurrence of the
>> footnote using a bare "\footnotemark", and use "\footnotemark[<footnote
>> number>]" in subsequent uses.
>
> Isn't it the case already?
>

I also thought so, after looking into the code, but the result I get
seemed to proves otherwise.

I simplified my example:

,----
| #+LATEX_HEADER: \usepackage{tabu}
| #+TITLE: Multi page table test
| 
| #+ATTR_LATEX: :environment longtabu
| | *Typ[fn:1]* |
| |-------------|
| | 1[fn:1]     |
| |-------------|
| 
| * Footnotes
| 
| [fn:1]
|   Blind[fn:1] text
`----

and the important part of the generated LaTeX file is:

,----
| \begin{longtabu}{l}
| \textbf{Typ\footnotemark}\\
| \hline
| \endfirsthead
| \multicolumn{1}{l}{Continued from previous page} \\
| \hline
| 
| \textbf{Typ\footnotemark} \\
| 
| \hline
| \endhead
| \hline\multicolumn{1}{r}{Continued on next page} \\
| \endfoot
| \endlastfoot
| \hline
| 1\footnotemark[1]{}\\
| \hline
| \end{longtabu}
| \footnotetext[1]{Blind\footnotemark[1]{} text}
`----

Even so there seem to be two different routines for writing the column
header for the first and the subsequent pages (in the first one the \\
follows directly to the '}', whereas the second time a space is added),
it seems, the string is generated only once, because the "[1]" is
missing on the second "\footnotemark", but added to the third one.

>
>
> Regards,

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

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

* Re: Bug: Problem with LaTeX export, footnotes in table headers, and longtabu [8.3.4 (8.3.4-31-gcb683e-elpa @ /home/berhol/.emacs.d/elpa/org-20160404/)]
  2016-04-19 22:11           ` Berthold Höllmann
@ 2016-04-20 21:40             ` Nicolas Goaziou
  0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Goaziou @ 2016-04-20 21:40 UTC (permalink / raw)
  To: Berthold Höllmann; +Cc: emacs-orgmode, berthold

Hello,

bhoel@despammed.com (Berthold Höllmann) writes:

> Even so there seem to be two different routines for writing the column
> header for the first and the subsequent pages (in the first one the \\
> follows directly to the '}', whereas the second time a space is added),
> it seems, the string is generated only once, because the "[1]" is
> missing on the second "\footnotemark", but added to the third one.

This is exactly that. In `ox-latex-table-row', string bound to argument
CONTENTS is used twice.

I guess we could workaround that by first checking if there is any
footnote reference within the row and, in that case, force re-exporting
each cell in the row.

OTOH, Org already piles up workarounds in order to support footnotes
within tables (and other locations) in LaTeX export. We will probably
need to stop at some point, and handle this at the LaTeX level (i.e.,
with an appropriate package).

WDYT?


Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2016-04-20 21:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-12  8:54 Bug: Problem with LaTeX export, footnotes in table headers, and longtabu [8.3.4 (8.3.4-31-gcb683e-elpa @ /home/berhol/.emacs.d/elpa/org-20160404/)] Berthold Höllmann
2016-04-14  8:03 ` Nicolas Goaziou
2016-04-14 14:02   ` Berthold Hoellmann
2016-04-16 10:11     ` Nicolas Goaziou
2016-04-17 15:42       ` Berthold Höllmann
2016-04-19 19:26         ` Nicolas Goaziou
2016-04-19 22:11           ` Berthold Höllmann
2016-04-20 21:40             ` Nicolas Goaziou

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