Re: [O] [PATCH] Longtable continuation strings customizable
Hello, t...@tsdye.com (Thomas S. Dye) writes: I have this, based on the example above: #+name: tsd-continuation-strings #+begin_src emacs-lisp (defun my-personal-table-continuation-strings (row backend info) (when (org-export-derived-backend-p 'latex) (replace-regexp-in-string multicolumn{[0-9]+}{l}{\\(.*\\)} \\ldots\\ continued from previous page row nil nil 1) (replace-regexp-in-string multicolumn{[0-9]+}{r}{\\(.*\\)} continued on next page \\ldots row nil nil 1))) (add-to-list 'org-export-filter-table-row-functions 'my-personal-table-continuation-strings) #+end_src I also tried 'org-export-filter-table-functions without success. I always get the default continuation strings. I've looked around for an error message, but there doesn't appear to be one, at least that I can find. The asynchronous export runs through to completion. The first `replace-regexp-in-string' has to be applied to the return value of the second one. IOW they have to be nested. Also, you need to double again backslashes in replacement string, or use a non-nil LITERAL argument in `replace-regexp-in-string'. Eventually, I made a typo in my suggestion: the second line should be: (org-export-derived-backend-p backend 'latex) In a nutshell: (defun my-personal-table-continuation-strings (row backend info) (when (org-export-derived-backend-p backend 'latex) (replace-regexp-in-string multicolumn{[0-9]+}{l}{\\(.*\\)} \\ldots\\ continued from previous page (replace-regexp-in-string multicolumn{[0-9]+}{r}{\\(.*\\)} continued on next page \\ldots row nil t 1) nil t 1))) Regards, -- Nicolas Goaziou
Re: [O] [PATCH] Longtable continuation strings customizable
Nicolas Goaziou n.goaz...@gmail.com writes: In a nutshell: (defun my-personal-table-continuation-strings (row backend info) (when (org-export-derived-backend-p backend 'latex) (replace-regexp-in-string multicolumn{[0-9]+}{l}{\\(.*\\)} \\ldots\\ continued from previous page (replace-regexp-in-string multicolumn{[0-9]+}{r}{\\(.*\\)} continued on next page \\ldots row nil t 1) nil t 1))) Thanks again for your patience and help. This works! All the best, Tom -- Thomas S. Dye http://www.tsdye.com
Re: [O] [PATCH] Longtable continuation strings customizable
Nicolas Goaziou n.goaz...@gmail.com writes: An example filter? (defun my-personal-table-continuation-strings (row backend info) (when (org-export-derived-backend-p 'latex) (replace-regexp-in-string multicolumn{[0-9]+}{l}{\\(.*\\)} String 1 (replace-regexp-in-string multicolumn{[0-9]+}{r}{\\(.*\\)} String 2 row nil nil 1) nil nil 1))) (add-to-list 'org-export-filter-table-row-functions 'my-personal-table-continuation-strings) Untested. I can't get this to work :( I have this, based on the example above: #+name: tsd-continuation-strings #+begin_src emacs-lisp (defun my-personal-table-continuation-strings (row backend info) (when (org-export-derived-backend-p 'latex) (replace-regexp-in-string multicolumn{[0-9]+}{l}{\\(.*\\)} \\ldots\\ continued from previous page row nil nil 1) (replace-regexp-in-string multicolumn{[0-9]+}{r}{\\(.*\\)} continued on next page \\ldots row nil nil 1))) (add-to-list 'org-export-filter-table-row-functions 'my-personal-table-continuation-strings) #+end_src I also tried 'org-export-filter-table-functions without success. I always get the default continuation strings. I've looked around for an error message, but there doesn't appear to be one, at least that I can find. The asynchronous export runs through to completion. All the best, Tom -- Thomas S. Dye http://www.tsdye.com
Re: [O] [PATCH] Longtable continuation strings customizable
Hello, t...@tsdye.com (Thomas S. Dye) writes: Nicolas Goaziou n.goaz...@gmail.com writes: Am I missing something? An example filter? (defun my-personal-table-continuation-strings (row backend info) (when (org-export-derived-backend-p 'latex) (replace-regexp-in-string multicolumn{[0-9]+}{l}{\\(.*\\)} String 1 (replace-regexp-in-string multicolumn{[0-9]+}{r}{\\(.*\\)} String 2 row nil nil 1) nil nil 1))) (add-to-list 'org-export-filter-table-row-functions 'my-personal-table-continuation-strings) Untested. Thanks! I switched to hardcoded strings and internationalization. Now, we need volunteers to fill missing translations for: Continued on next page Continued from previous page Regards, -- Nicolas Goaziou
Re: [O] [PATCH] Longtable continuation strings customizable
Hello, t...@tsdye.com (Thomas S. Dye) writes: I think there are two axes of variation here: 1) internationalization, and 2) style guides, e.g., for a particular journal, Chicago Manual, etc. IIUC, hardcoding and org-export-dictionary solve 1) but not 2). In my experience, variation in 2) is idiosyncratic, though I haven't looked specifically at table continuation lines. The user can solve both 1) and 2) with customizable continuation strings, so it might be best to stay on this path instead of hardcoding and internationalization in org-export-dictionary. I agree customization is more powerful here (although it means that all non-English Org users will need to change it), but so it is for every other multilingual string. Since we didn't choose to make multilingual strings customizable, I find it strange that this particular one is. Also, I you can use a filter to modify that string and make it comply to a specific style, if needed. IOW, you also get 1) and 2) with the `org-export-dictionary' way, with 1) being more user-friendly and 2) more difficult than in the current way. Am I missing something? Regards, -- Nicolas Goaziou
Re: [O] [PATCH] Longtable continuation strings customizable
Nicolas Goaziou n.goaz...@gmail.com writes: I agree customization is more powerful here (although it means that all non-English Org users will need to change it), but so it is for every other multilingual string. Since we didn't choose to make multilingual strings customizable, I find it strange that this particular one is. Also, I you can use a filter to modify that string and make it comply to a specific style, if needed. IOW, you also get 1) and 2) with the `org-export-dictionary' way, with 1) being more user-friendly and 2) more difficult than in the current way. Am I missing something? An example filter? Otherwise, I agree, there is no need to break the mold here. All the best, Tom -- Thomas S. Dye http://www.tsdye.com
Re: [O] [PATCH] Longtable continuation strings customizable
Nicolas Goaziou n.goaz...@gmail.com writes: Am I missing something? An example filter? (defun my-personal-table-continuation-strings (row backend info) (when (org-export-derived-backend-p 'latex) (replace-regexp-in-string multicolumn{[0-9]+}{l}{\\(.*\\)} String 1 (replace-regexp-in-string multicolumn{[0-9]+}{r}{\\(.*\\)} String 2 row nil nil 1) nil nil 1))) (add-to-list 'org-export-filter-table-row-functions 'my-personal-table-continuation-strings) Untested. Thanks! Tom -- Thomas S. Dye http://www.tsdye.com
Re: [O] [PATCH] Longtable continuation strings customizable
Hello, t...@tsdye.com (Thomas S. Dye) writes: The attached patch should be applied on top of the earlier patch. It makes the continuation strings customizable. Wouldn't it be better if these strings where hardcoded, but with support for internationalization in `org-export-dictionary'? Meanwhile, I applied your patch. Thank you. Regards, -- Nicolas Goaziou
Re: [O] [PATCH] Longtable continuation strings customizable
On 27.10.2013, at 09:05, Nicolas Goaziou n.goaz...@gmail.com wrote: Hello, t...@tsdye.com (Thomas S. Dye) writes: The attached patch should be applied on top of the earlier patch. It makes the continuation strings customizable. Wouldn't it be better if these strings where hardcoded, but with support for internationalization in `org-export-dictionary'? I agree that this would be better. - Carsten Meanwhile, I applied your patch. Thank you. Regards, -- Nicolas Goaziou
Re: [O] [PATCH] Longtable continuation strings customizable
Carsten Dominik carsten.domi...@gmail.com writes: On 27.10.2013, at 09:05, Nicolas Goaziou n.goaz...@gmail.com wrote: Hello, t...@tsdye.com (Thomas S. Dye) writes: The attached patch should be applied on top of the earlier patch. It makes the continuation strings customizable. Wouldn't it be better if these strings where hardcoded, but with support for internationalization in `org-export-dictionary'? I agree that this would be better. - Carsten I think there are two axes of variation here: 1) internationalization, and 2) style guides, e.g., for a particular journal, Chicago Manual, etc. IIUC, hardcoding and org-export-dictionary solve 1) but not 2). In my experience, variation in 2) is idiosyncratic, though I haven't looked specifically at table continuation lines. The user can solve both 1) and 2) with customizable continuation strings, so it might be best to stay on this path instead of hardcoding and internationalization in org-export-dictionary. All the best, Tom -- Thomas S. Dye http://www.tsdye.com
[O] [PATCH] Longtable continuation strings customizable
Aloha all, The attached patch should be applied on top of the earlier patch. It makes the continuation strings customizable. All the best, Tom From 2b3fbcf9a8ea64ef6207237ef48b9c62cded01ff Mon Sep 17 00:00:00 2001 From: Thomas Dye t...@tsdye.com Date: Sat, 26 Oct 2013 14:37:30 -1000 Subject: [PATCH] Longtable continuation strings customizable --- lisp/ox-latex.el | 21 ++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 6426d55..6bca7a3 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -525,6 +525,19 @@ When nil, no transformation is made. (string :tag Format string) (const :tag No formatting))) +(defcustom org-latex-longtable-continued-on Continued on next page + String to indicate table continued on next page. + :group 'org-export-latex + :version 24.4 + :package-version '(Org . 8.0) + :type 'string) + +(defcustom org-latex-longtable-continued-from Continued from previous page + String to indicate table continued from previous page. + :group 'org-export-latex + :version 24.4 + :package-version '(Org . 8.0) + :type 'string) Text markup @@ -2625,17 +2638,18 @@ a communication channel. ((and longtablep (org-export-table-row-ends-header-p table-row info)) (format %s \\endfirsthead -\\multicolumn{%d}{l}{Continued from previous page} +\\multicolumn{%d}{l}{%s} %s %s \n %s \\endhead -%s\\multicolumn{%d}{r}{Continued on next page} +%s\\multicolumn{%d}{r}{%s} \\endfoot \\endlastfoot (if booktabsp \\midrule \\hline) (cdr (org-export-table-dimensions (org-export-get-parent-table table-row) info)) + org-latex-longtable-continued-from (cond ((and booktabsp (memq 'top borders)) \\toprule\n) ((and (memq 'top borders) (memq 'above borders)) \\hline\n) @@ -2645,7 +2659,8 @@ a communication channel. (if booktabsp \\midrule \\hline) ;; Number of columns. (cdr (org-export-table-dimensions - (org-export-get-parent-table table-row) info + (org-export-get-parent-table table-row) info)) + org-latex-longtable-continued-on)) ;; When BOOKTABS are activated enforce bottom rule even when ;; no hline was specifically marked. ((and booktabsp (memq 'bottom borders)) \\bottomrule) -- 1.8.3.3 -- T.S. Dye Colleagues, Archaeologists 735 Bishop St, Suite 315, Honolulu, HI 96813 Tel: 808-529-0866, Fax: 808-529-0884 http://www.tsdye.com