[O] ox-odt: column width in list-tables
Hi, I am using the list-table feature of the odt exporter, a very convenient feature when one needs a table where one column has structured content. Unfortunately, the column widths currently cannot be controlled from within the org document. An attribute :column-widths would turn out handy. (Of course, this would be different from the way column widths are controlled in standard org-mode tables.). Also, attributes like :width seem not to be handed over to the resulting table. I am really amazed how easy the production of libre office documents in org-mode is. Actually, adjusting list-table column widths is currently the only manual step I ever need to do after exporting. Thanks, Martin
Re: [O] Adding new table rows/cols in a formula update
>> Dima Kogan writes: >> >> > Suppose I have this .org file: >> > >> > | | >> > #+TBLFM: @1$2=5 >> > >> > It's a 1x1 table with a formula. The formula sets a cell that's out of >> > bounds in the table, so evaluating this formula results in an error. >> > How set-in-stone is this behavior? I haven't dug too deeply into the >> > code, but are there fundamental assumptions here? Would a patch that >> > extends the table before applying such a formula be too naive in some >> way? > > Subhan Michael Tindall writes: > > I would include a customization variable to control this behavior, defaulting > to whatever the current behavior is: > IE: > (setq org-calc-extend-file nil) default system behavior > (setq org-calc-extend-file t) always silently extend rows > (setq org-calc-extend-file "warn") issue warning in message buffer that line > was extended > (setq org-calc-extend-file "prompt") prompt user y/n on whether or not to > extend column OK. Patch attached. >From 3b6581c647cb87f0d3e8cee94ce2fb1fb122d3fd Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Tue, 30 Sep 2014 22:36:21 -0700 Subject: [PATCH] Field formulas can now add columns as needed The org-table-formula-make-new-cols customization controls whether and how this is done --- lisp/org-table.el | 27 ++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/lisp/org-table.el b/lisp/org-table.el index 7607ead..f2933ed 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -354,6 +354,16 @@ portability of tables." (const :tag "Stick to hline" nil) (const :tag "Error on attempt to cross" error))) +(defcustom org-table-formula-make-new-cols nil + "Non-nil means that evaluation of a field formula can add new +columns if an out-of-bounds field is being set." + :group 'org-table-calculation + :type '(choice + (const :tag "Setting an out-of-bounds field generates an error (default)" nil) + (const :tag "Setting an out-of-bounds field silently adds columns as needed" t) + (const :tag "Setting an out-of-bounds field adds columns as needed, but issues a warning message" warn) + (const :tag "When setting an out-of-bounds field, the user is prompted" prompt))) + (defgroup org-table-import-export nil "Options concerning table import and export in Org-mode." :tag "Org Table Import Export" @@ -3125,7 +3135,22 @@ known that the table will be realigned a little later anyway." (while (setq eq (pop eqlname1)) (message "Re-applying formula to field: %s" (car eq)) (org-goto-line (nth 1 eq)) - (org-table-goto-column (nth 2 eq)) + (let* ((column-target (nth 2 eq)) + (column-count (progn (end-of-line) +(1- (org-table-current-column + (create-new-column + (and (> column-target column-count) + (or (eq org-table-formula-make-new-cols t) + (and + (eq org-table-formula-make-new-cols 'warn) + (progn + (org-display-warning "Out-of-bounds formula added columns") + t)) + (and + (eq org-table-formula-make-new-cols 'prompt) + (yes-or-no-p "Out-of-bounds formula. Add columns?")) + (org-table-goto-column column-target nil create-new-column)) + (org-table-eval-formula nil (nth 3 eq) 'noalign 'nocst 'nostore 'noanalysis)) -- 2.0.0
Re: [O] Improved way to include some headlines from an external org file
Hi Rasmus, Le 01/10/2014 01:10, Rasmus a écrit : Hi Xavier, You could test the patch here: http://permalink.gmane.org/gmane.emacs.orgmode/91307 I am following the discussion since the beginning (and all your exchange with Nicolas) I think it introduces something close to what you are looking for. This is exactly what I needed and I will try to test it today. #+BEGIN_SRC org #+INCLUDE: "./base.org" :headline "First base chapter" ,* A more personal chapter #+INCLUDE: "./base.org" :headline "Second base chapter" ,* Another personal chapter #+END_SRC You'd be able to do * first chapter Note how we're renaming /first base chapter/ on the fly. * In this book /first base chapter/ is my second chapter #+INCLUDE: "./base.org::*First base chapter" :only-contents t Of course, you can also include other named objects such as tables and probably code blocks. Reading the discussion, I didn't get this last feature of including named code blocks and tables ! I have another use case that can benefit from this patch. So thanks a lot for all the hard work. Cheers, Xavier —Rasmus
Re: [O] Improved way to include some headlines from an external org file
Hi Andrea, Le 30/09/2014 21:55, Andrea Rossetti a écrit : Xavier Garrido writes: Is there a way ... ... to write something like that ... #+BEGIN_SRC org #+INCLUDE: "./base.org" :headline "First base chapter" ,* A more personal chapter #+INCLUDE: "./base.org" :headline "Second base chapter" ,* Another personal chapter #+END_SRC Hi! today I crossed into Sacha's weekly links ( http://sachachua.com/blog/#post-27515 ). One of the proposed link suggests a solution not too far from your initial question: http://endlessparentheses.com/updating-org-mode-include-statements-on-the-fly.html?source=rss Thanks for the follow-up. Actually I am waiting this patch http://article.gmane.org/gmane.emacs.orgmode/90932/match=include+resolve+links to be pushed by Rasmus (see the comment in the endlessparentheses article). Thanks again, Xavier Kindest regards, Andrea
Re: [O] Exporting to multiple files
Marcin Borkowski writes: > On 2014-03-09, at 02:34, Marcin Borkowski wrote: > >> Hi all, >> >> I'd like to export an Org-mode file to /multiple/ HTML files. For >> instance, I might want to convert all first and second level headings >> to files, and third-level headings to , fourth-level ones to >> inside these files etc. Is that possible? I looked into the docs, but >> didn't find anything like this. > > Hi all, > > I'm now coming back to this old question of mine, now a bit more > determined to actually code something (as opposed to just thinking about > it). > > One question: is it a good idea to implement my custom options, set in > the > > #+:OPTIONS > > line? If yes (that's what I assume), how to do it? I'm pretty sure there's nothing out of the box that does this. I've spent time thinking about this off and on in the past, as I've been (very slowly) chewing through a direct-to-epub export backend, and it can be nice to have multiple HTML files in the epub package. Splitting the files is a bit of a problem, but the real pain in the neck is re-writing internal links so they're still valid. I thought about using Org publishing mechanism instead of exporting, but the two systems seem pretty locked in their paradigms: publishing is many-to-many, exporting is one-to-one (or many-to-one, with includes). There's no built-in option for one-to-many. If you don't care about internal links, you'll still have to largely short-circuit the export process. You could use org-element-map to zip over the headlines, breaking off subtrees where appropriate and putting them in a temporary Org-mode buffer, using org-promote-subtree to change the depth, and then exporting the buffer to an appropriate file. Or you could go the parsed route: split the file into buffers, parse each buffer, remove top-level headings, increment the :level property of all remaining headings, and then use `org-export-data' to get the HTML. I'm sort of just thinking out loud here, I'm not sure what the best approach would be. Eric
Re: [O] Error Embedding SQL Source from code block into R Source of Another (noweb)
Grant Rettke writes: > On Tue, Sep 30, 2014 at 2:15 PM, Nick Dokos wrote: >> Eric Brown writes: >> >>> 2) Grant, I tried your code, but there seem to be some missing headers. >>> Do you have a complete minimal example that exhibits the behavior that >>> you have demonstrated? >> >> Add :noweb yes. Also Grant seems to have gone non-standard and replaced >> the <> markup with guillemots. Using the default markers, That should be "guillemets". >> it should read: > > Yikes what a week sorry about that here is what you would need I shall > be defining a function to provide all such details in the future and > thanks Nick for addressing: > > ╭ > │ (setq org-babel-noweb-wrap-start "«") > │ (setq org-babel-noweb-wrap-end "»") > ╰ > > And an OT question: Since on my keyboard I can type << much more easily than I can type « I was wondering: does your keyboard provide an easy way to type a guillemet? Is that why you changed it? Or is it purely aesthetics? -- Nick
Re: [O] Bug (regression) in org-replace-disputed-keys. Bisected.
(The entire thread can be viewed at: http://thread.gmane.org/gmane.emacs.orgmode/90626 . cc: Miro Bezjak.) I propose fixes, but first I explain the whole picture. TOC 1. Backgrounds 2. Fixes I propose 1. Backgrounds In fact, beginning from org-8.1 `org-replace-disputed-keys' is intentionally ignored, but ** only in ** org-read-date. To be blunt, it was wrong. At least, such an exceptional behavior is hard to expect, or incoherence in short. Why this change was done? One single user asked [1] how to disable org-replace-disputed-keys in org-read-date in org-8.0 for his/her **personal configuration**. Somehow Carsten Dominik, one of our respectable org developers, decided it to be the hard-coded default [1][2] without stating the reason. [1] http://comments.gmane.org/gmane.emacs.orgmode/72180 [2] * http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=a6986494a0c4fc5d3363c2bebe48215e7138e4f1 * http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=e8023dde58f267a525b63184ec07d371b5a4c8b5 But since (defvar org-read-date-minibuffer-local-map) was introduced in org-8.0.3, s/he can simply customize it. It's the norm in Emacs, rather than forcing an exception. (If it were a common request, then we could accept it, but it's not.) 2. Fixes Basically, I'll do what I can, sending patches for both codes and texinfo, if you want. Anyway (a) the info file lacks the description on org-read-date-minibuffer-local-map. (b) The fact that org-replace-disputed-keys is ignored in org-read-date is written in the changelog http://orgmode.org/Changes.html for ver 8.1, under the section "Important bugfixes", but it should have been in "Incompatible changes". Moreover, the wording is unsearchable, by lacking the relevant variable names. (If it gets reverted as I propose below, an annotation must accompany, like "But this was reverted later in 8.2.x".) Now a real fix. There're two candidates: (i) Revert the wrong commit. Since it was in fact done in two separate commits[2], you need another patch, not git-revert. Here it is: diff -u -r org-8.2.7c-orig/lisp/org.el org-8.2.7c/lisp/org.el --- org-8.2.7c-orig/lisp/org.el 2014-09-30 18:10:54.485977061 +0900 +++ org-8.2.7c/lisp/org.el 2014-09-30 18:11:24.293602328 +0900 @@ -16220,8 +16220,7 @@ (defvar org-read-date-inactive) (defvar org-read-date-minibuffer-local-map - (let* ((org-replace-disputed-keys nil) -(map (make-sparse-keymap))) + (let* ((map (make-sparse-keymap))) (set-keymap-parent map minibuffer-local-map) (org-defkey map (kbd ".") (lambda () (interactive) (ii) Leave the code as-is, and be satisfied by doc fixes only. Then you have to fix * Texinfo, the `org-replace-disputed-keys' part, adding "Exception: it's ignored in ...", * `org-read-date' w/ "Exception..." * and also the changelog in 8.2 (or later): "org-replace-disputed-keys is ignored in org-read-date. In fact it has been so since 8.1, but has not been described adequately." Thanks to Nicolas Goaziou for reading, and all other org developers. (Sorry for posting my original message twice.) Regards, Teika (Teika kazura)
Re: [O] Solution for very long hyperlinks when exporting to latex?
That is exactly the problem, Rasmus... I am lost in the complexity of object and metalevels and don't really know where to start reducing it. Except for the naughty monster urls everything else works fine. Thanks anyway. :) Good night, Martin Am Mittwoch, 1. Oktober 2014, 02:20:45 schrieb Rasmus: > Martin Weigele writes: > > There you go. Thx. > > Please send a minimal example that displays the undesired behavior :) > > > #+TITLE: Blah > > #+AUTHOR: Me und Du > > > > #+OPTIONS: H:20 > > #+LATEX_CLASS: scrbook > > > > #+LATEX_CLASS_OPTIONS: > > [paper=17cm:22cm,DIV=calc,BCOR=12mm,titlepage,11pt,scrhack] > > > > #+LATEX_HEADER: \usepackage[english,ngerman]{babel} > > #+LATEX_HEADER:\usepackage{ > > #+LATEX_HEADER: fixltx2e % Verbessert einige Kernkompetenzen von LaTeX2e > > #+LATEX_HEADER:} > > #+LATEX_HEADER:\usepackage{% > > #+LATEX_HEADER: ellipsis, % Korrigiert den Weißraum um Auslassungspunkte > > #+LATEX_HEADER: ragged2e, % Ermöglicht Flattersatz mit Silbentrennung > > #+LATEX_HEADER: marginnote,% Für bessere Randnotizen mit \marginnote statt > > #+LATEX_HEADER:% \marginline > > #+LATEX_HEADER:} > > #+LATEX_HEADER:\usepackage[tracking=true]{microtype}% > > #+LATEX_HEADER:% Microtype ist einfach super, aber lesen Sie > > #+LATEX_HEADER:% unbedingt die Anleitung um das Folgende zu > > #+LATEX_HEADER:% verstehen. > > #+LATEX_HEADER: \usepackage{mathptmx, enumerate, > > setspace,alnumsec}\alnumsecstyle{LRald} > > #+LATEX_HEADER: \pagenumbering{roman} > > #+LATEX_HEADER: \usepackage[hyphens]{url} > > #+LATEX_HEADER: \usepackage{pdfpages} > > #+LATEX_HEADER: \usepackage{graphics, color} > > #+LATEX_HEADER: \usepackage{xcolor} > > #+LATEX_HEADER: \usepackage{graphicx, latexsym, keyval, ifthen, moreverb} > > #+LATEX_HEADER: \usepackage{gnuplottex} > > #+LATEX_HEADER: \usepackage{tikz} > > #+LATEX_HEADER: \usepackage{gnuplot-lua-tikz} > > #+LATEX_HEADER: \hypersetup{ > > #+LATEX_HEADER: breaklinks=true, > > #+LATEX_HEADER: pdfkeywords={}, > > #+LATEX_HEADER: pdfsubject={}, > > #+LATEX_HEADER: pdfcreator={Emacs Org-mode version }} > > > > #+TEXT: [TABLE-OF-CONTENTS] > > > > - > > > > (require 'package) > > (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/";) t) > > (require 'ox-odt) > > (require 'org-latex) > > (setq org-export-latex-listings t) > > (add-to-list 'org-latex-classes > > > > '("scrartcl" > > > >"\\documentclass{scrartcl}" > > > > ;; [NO-DEFAULT-PACKAGES] > > ;; [EXTRA]" > > > >("\\section{%s}" . "\\section*{%s}") > >("\\subsection{%s}" . "\\subsection*{%s}") > >("\\subsubsection{%s}" . "\\subsubsection*{%s}") > >("\\paragraph{%s}" . "\\paragraph*{%s}") > >("\\subparagraph{%s}" . "\\subparagraph*{%s}"))) > > > > (add-to-list 'org-latex-classes > > > > '("scrbook" > > > >"\\documentclass{scrbook}" > > > > ;; [NO-DEFAULT-PACKAGES] > > ;; [EXTRA]" > > > >("\\chapter{%s}" . "\\chapter*{%s}") > > > >("\\section{%s}" . "\\section*{%s}") > >("\\subsection{%s}" . "\\subsection*{%s}") > >("\\subsubsection{%s}" . "\\subsubsection*{%s}") > >("\\paragraph{%s}" . "\\paragraph*{%s}") > >("\\subparagraph{%s}" . "\\subparagraph*{%s}"))) > > > > ;; active Babel languages > > (org-babel-do-load-languages > > > > 'org-babel-load-languages > > '((gnuplot . t))) > > > > ;; add additional languages with '((language . t))) > > (custom-set-variables > > > > ;; custom-set-variables was added by Custom. > > ;; If you edit it by hand, you could mess it up, so be careful. > > ;; Your init file should contain only one such instance. > > ;; If there is more than one, they won't work right. > > '(org-latex-with-hyperref nil)) > > > > (custom-set-faces > > > > ;; custom-set-faces was added by Custom. > > ;; If you edit it by hand, you could mess it up, so be careful. > > ;; Your init file should contain only one such instance. > > ;; If there is more than one, they won't work right. > > ) > > > > > > > > Am Mittwoch, 1. Oktober 2014, 02:04:34 schrieb Rasmus: > >> Martin Weigele writes: > >> > Hi Rasmus, thank you very much, Wasn't really aware of texdoc > >> > this is great. A lot improvement since the old days... :) > >> > >> TL is astonishing software. > >> > >> > Yes \url{...} is being produced by the exporter in the footnotes. > >> > However, > >> > when I try to set the values by means of #+LATEX_HEADER: > >> > \usepackage[hyphens] {url} I get an option clash with pdfpages, and if > >> > removed, with graphics. > >> > > >> > Also I found the information that hyperref calls the package url, but > >> > it > >>
Re: [O] Solution for very long hyperlinks when exporting to latex?
There you go. Thx. #+TITLE: Blah #+AUTHOR: Me und Du #+OPTIONS: H:20 #+LATEX_CLASS: scrbook #+LATEX_CLASS_OPTIONS: [paper=17cm:22cm,DIV=calc,BCOR=12mm,titlepage,11pt,scrhack] #+LATEX_HEADER: \usepackage[english,ngerman]{babel} #+LATEX_HEADER:\usepackage{ #+LATEX_HEADER: fixltx2e % Verbessert einige Kernkompetenzen von LaTeX2e #+LATEX_HEADER:} #+LATEX_HEADER:\usepackage{% #+LATEX_HEADER: ellipsis, % Korrigiert den Weißraum um Auslassungspunkte #+LATEX_HEADER: ragged2e, % Ermöglicht Flattersatz mit Silbentrennung #+LATEX_HEADER: marginnote,% Für bessere Randnotizen mit \marginnote statt #+LATEX_HEADER:% \marginline #+LATEX_HEADER:} #+LATEX_HEADER:\usepackage[tracking=true]{microtype}% #+LATEX_HEADER:% Microtype ist einfach super, aber lesen Sie #+LATEX_HEADER:% unbedingt die Anleitung um das Folgende zu #+LATEX_HEADER:% verstehen. #+LATEX_HEADER: \usepackage{mathptmx, enumerate, setspace,alnumsec}\alnumsecstyle{LRald} #+LATEX_HEADER: \pagenumbering{roman} #+LATEX_HEADER: \usepackage[hyphens]{url} #+LATEX_HEADER: \usepackage{pdfpages} #+LATEX_HEADER: \usepackage{graphics, color} #+LATEX_HEADER: \usepackage{xcolor} #+LATEX_HEADER: \usepackage{graphicx, latexsym, keyval, ifthen, moreverb} #+LATEX_HEADER: \usepackage{gnuplottex} #+LATEX_HEADER: \usepackage{tikz} #+LATEX_HEADER: \usepackage{gnuplot-lua-tikz} #+LATEX_HEADER: \hypersetup{ #+LATEX_HEADER: breaklinks=true, #+LATEX_HEADER: pdfkeywords={}, #+LATEX_HEADER: pdfsubject={}, #+LATEX_HEADER: pdfcreator={Emacs Org-mode version }} #+TEXT: [TABLE-OF-CONTENTS] - (require 'package) (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/";) t) (require 'ox-odt) (require 'org-latex) (setq org-export-latex-listings t) (add-to-list 'org-latex-classes '("scrartcl" "\\documentclass{scrartcl}" ;; [NO-DEFAULT-PACKAGES] ;; [EXTRA]" ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}") ("\\paragraph{%s}" . "\\paragraph*{%s}") ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))) (add-to-list 'org-latex-classes '("scrbook" "\\documentclass{scrbook}" ;; [NO-DEFAULT-PACKAGES] ;; [EXTRA]" ("\\chapter{%s}" . "\\chapter*{%s}") ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}") ("\\paragraph{%s}" . "\\paragraph*{%s}") ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))) ;; active Babel languages (org-babel-do-load-languages 'org-babel-load-languages '((gnuplot . t))) ;; add additional languages with '((language . t))) (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(org-latex-with-hyperref nil)) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. ) Am Mittwoch, 1. Oktober 2014, 02:04:34 schrieb Rasmus: > Martin Weigele writes: > > Hi Rasmus, thank you very much, Wasn't really aware of texdoc > > this is great. A lot improvement since the old days... :) > > TL is astonishing software. > > > Yes \url{...} is being produced by the exporter in the footnotes. However, > > when I try to set the values by means of #+LATEX_HEADER: > > \usepackage[hyphens] {url} I get an option clash with pdfpages, and if > > removed, with graphics. > > > > Also I found the information that hyperref calls the package url, but it > > is > > not clear to me how to influence this behaviour in time in the exporter. > > The story is similar if I try to modify hyperref with option breaklinks > > (which is perhaps just passed on to url as 'hyphens'). > > Please share a complete example as org (that produces the quirk from > emacs -q) or as tex. > > A unsatisfactory solution is url shortener. > > —Rasmus
Re: [O] Solution for very long hyperlinks when exporting to latex?
Martin Weigele writes: > Hi Rasmus, thank you very much, Wasn't really aware of texdoc this > is great. A lot improvement since the old days... :) TL is astonishing software. > Yes \url{...} is being produced by the exporter in the footnotes. However, > when I try to set the values by means of #+LATEX_HEADER: \usepackage[hyphens] > {url} I get an option clash with pdfpages, and if removed, with graphics. > > Also I found the information that hyperref calls the package url, but it is > not clear to me how to influence this behaviour in time in the exporter. The > story is similar if I try to modify hyperref with option breaklinks (which is > perhaps just passed on to url as 'hyphens'). Please share a complete example as org (that produces the quirk from emacs -q) or as tex. A unsatisfactory solution is url shortener. —Rasmus -- Summon the Mothership!
Re: [O] Solution for very long hyperlinks when exporting to latex?
Hi Rasmus, thank you very much, Wasn't really aware of texdoc this is great. A lot improvement since the old days... :) Yes \url{...} is being produced by the exporter in the footnotes. However, when I try to set the values by means of #+LATEX_HEADER: \usepackage[hyphens] {url} I get an option clash with pdfpages, and if removed, with graphics. Also I found the information that hyperref calls the package url, but it is not clear to me how to influence this behaviour in time in the exporter. The story is similar if I try to modify hyperref with option breaklinks (which is perhaps just passed on to url as 'hyphens'). Thx anyway, Martin Am Mittwoch, 1. Oktober 2014, 01:02:07 schrieb Rasmus: > Hi Martin, > > Martin Weigele writes: > > very happy with orgmode but rather desperate these days trying to get very > > long url hyperlinks in footnotes to typeset as line-broken-up links after > > latex export. I have tried the hints available on texstack etc., but none > > of the proposed latex methods work. Not even manual \- produces a > > reasonable result. I have tried with hyperref switched on and off in the > > emacs org exporter configuration, and with the "linebreak" option of > > hyperref which is not even accepted depending on the exporter setting. > > > > I am using org-version 8.2.4, emacs 24.3.1, texlive 2014, scrbook (added > > this style to .emacs which works fine otherwise). I am not sure if it has > > to do with the exporter or with latex/koma script only, or maybe all > > three of them. > > > > Surely someone must have come across this problem and may be able to > > provide a hint? > > url.sy is usually pretty good a breaking urls. Is the url wrapped in > \url{·} in your .tex file? If no, you probably did something wrong. > If yes you should consult the url manual ("texdoc url" in your > terminal if you have TeXLive). Section 5.2 and maybe section 6 could > be helpful. > > Hope it helps, > Rasmus -- Dr. Martin Weigele, Kapellenweg 32, 53179 Bonn, Germany ph. (+49)(0)228 2894468 office - fax (+49)(0)228 2894446 ph. (+49)(0)228 2893997 privat - mobil (+49)(0)177 4196 515 mailto:mar...@weigele.de - http://www.weigele.de
Re: [O] Exporting to multiple files
On 2014-03-09, at 02:34, Marcin Borkowski wrote: > Hi all, > > I'd like to export an Org-mode file to /multiple/ HTML files. For > instance, I might want to convert all first and second level headings > to files, and third-level headings to , fourth-level ones to > inside these files etc. Is that possible? I looked into the docs, but > didn't find anything like this. Hi all, I'm now coming back to this old question of mine, now a bit more determined to actually code something (as opposed to just thinking about it). One question: is it a good idea to implement my custom options, set in the #+:OPTIONS line? If yes (that's what I assume), how to do it? Best, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Adam Mickiewicz University
Re: [O] Error Embedding SQL Source from code block into R Source of Another (noweb)
On Tue, Sep 30, 2014 at 2:15 PM, Nick Dokos wrote: > Eric Brown writes: > >> 2) Grant, I tried your code, but there seem to be some missing headers. >> Do you have a complete minimal example that exhibits the behavior that >> you have demonstrated? > > Add :noweb yes. Also Grant seems to have gone non-standard and replaced > the <> markup with guillemots. Using the default markers, > it should read: Yikes what a week sorry about that here is what you would need I shall be defining a function to provide all such details in the future and thanks Nick for addressing: ╭ │ (setq org-babel-noweb-wrap-start "«") │ (setq org-babel-noweb-wrap-end "»") ╰
Re: [O] Improved way to include some headlines from an external org file
Hi Xavier, Xavier Garrido writes: > Le 12/09/2014 02:45, Andrea Rossetti a écrit : >> Xavier Garrido writes: >>> Of course, I can achieve that by using =:lines= and calculating how many >>> lines embeds the given headline. >> >>Hi Xavier, another possible approach (maybe less handy, but in >> some cases it might fit): the user could keep one .org file >> per headline, and #+INCLUDE one headline (= one entire file) >> when needed. >> > > This is something I use when dealing with a book or report with > basically one big file per chapter. Here the problem is slightly > different : I have 4 org/Beamer presentations that almost 80% of them > are the same. So instead of maintening this 80% in 4 different places, > I'd like to write them and change them in one place and then include > the needed headlines at the right place in each of the 4 > presentations. > > I know this can't be done with #+INCLUDE maybe with a nice babel > function or a bit of elisp. So maybe someone already did > that. Otherwise this may be a nice addition for further release of org > ;) You could test the patch here: http://permalink.gmane.org/gmane.emacs.orgmode/91307 I think it introduces something close to what you are looking for. > #+BEGIN_SRC org > #+INCLUDE: "./base.org" :headline "First base chapter" > ,* A more personal chapter > #+INCLUDE: "./base.org" :headline "Second base chapter" > ,* Another personal chapter > #+END_SRC You'd be able to do * first chapter Note how we're renaming /first base chapter/ on the fly. * In this book /first base chapter/ is my second chapter #+INCLUDE: "./base.org::*First base chapter" :only-contents t Of course, you can also include other named objects such as tables and probably code blocks. —Rasmus -- Hvor meget poesi tror De kommer ud af et glas isvand?
Re: [O] Solution for very long hyperlinks when exporting to latex?
Hi Martin, Martin Weigele writes: > very happy with orgmode but rather desperate these days trying to get very > long url hyperlinks in footnotes to typeset as line-broken-up links after > latex export. I have tried the hints available on texstack etc., but none of > the proposed latex methods work. Not even manual \- produces a reasonable > result. I have tried with hyperref switched on and off in the emacs org > exporter configuration, and with the "linebreak" option of hyperref which is > not even accepted depending on the exporter setting. > > I am using org-version 8.2.4, emacs 24.3.1, texlive 2014, scrbook (added this > style to .emacs which works fine otherwise). I am not sure if it has to do > with the exporter or with latex/koma script only, or maybe all three of them. > > Surely someone must have come across this problem and may be able to provide > a > hint? url.sy is usually pretty good a breaking urls. Is the url wrapped in \url{·} in your .tex file? If no, you probably did something wrong. If yes you should consult the url manual ("texdoc url" in your terminal if you have TeXLive). Section 5.2 and maybe section 6 could be helpful. Hope it helps, Rasmus -- You people at the NSA are becoming my new best friends!
Re: [O] [patch, ox] Unnumbered headlines
Hi, Alan did some testing on a slightly older version of this patch and he managed to publish his book without errors and with working links. So let's give it another shot. I briefly tested the output of LaTeX, html, texinfo, odt, md, and plaintext and made sure links work and that the right text is shown in the output. Nicolas Goaziou writes: >> Should I write tests for the new behavior? If so, tests for each >> backend or only for vanilla-ox functions? > Tests for "ox.el" are mandatory. See "test-ox.el" I have added some. I don't know if it's comprehensive enough. It was not obvious to me what to test. >> (ids (delq nil >>(list (org-element-property :CUSTOM_ID headline) >> -(concat "sec-" section-number) >> +(and section-number (concat "sec-" >> section-number)) >> (org-element-property :ID headline >> - (preferred-id (car ids)) >> + (preferred-id (org-export-get-headline-id headline info)) > > I think the following is more in the spirit of the code (you don't > ignore :custom-id property): > > (ids (delq nil > (list (org-element-property :CUSTOM_ID headline) >(org-export-get-headline-id headline info) >(org-element-property :ID headline > (preferred-id (car ids)) But we are not checking that :CUSTOM_ID is unique. In ox-latex you're required to turn on a variable on to get this behavior (I could be mistaken here). For now I have done as you suggest. But I don't understand why we are favoring CUSTOM_ID here over the nice, unique label we've generated? >> - (let ((href .. >> (headline-label ... >> - (org-html--anchor ... I reintroduced the CUSTOM_ID in these. >> + (let ((num 0)) >> +(org-element-map data 'headline >> +(lambda (headline) >> + (unless (org-export-numbered-headline-p headline options) >> +(cons headline (list (setq num (1+ num) > > Last line: > > (list headline (incf num)) Oh incf is quite handy. Didn't know that one. I leave it as (cons headline (list (incf num))). Why? 'Cause that's the format used by `org-export--collect-headline-numbering'. While simpler is nicer, I think it's better not to have to consider different data structures depending on whether data is from `org-export--collect-headline-numbering' or `org-export--collect-unnumbered-headline-id'. If you feel the simpler structure is better we can also use that. > Use `assq' instead of `assoc'. Right, no need for equal here. >> +(defun org-export-get-unnumberd-headline-id (headline info) >> + "Return unnumbered HEADLINE id as list of numbers. >> INFO is a plist holding contextual information." >> - (cdr (assoc headline (plist-get info :headline-numbering >> + (and (not (org-export-numbered-headline-p headline info)) >> + (cdr (assoc headline (plist-get info :unnumbered-headline-id) > > I don't think it is worth to make this function standalone. I don't see > any use case outside `org-export-get-headline-id'. I suggest to move it > there. Yeah, seems fair. >> + (unless >> + (or (org-export-get-node-property :UNNUMBERED headline) >> + (loop for parent in (org-export-get-genealogy headline) >> +when (org-export-get-node-property :UNNUMBERED parent) >> +return t)) > > (unless (org-some >(lambda (h) (org-not-nil (org-element-property :UNNUMBERED h))) >(org-export-get-genealogy headline)) > ...) Handy. AFAIK BLOB is not a member of (org-export-get-genealogy BLOB) (or so the output suggests), so (or · ·) is still needed. Thanks again, Rasmus -- There are known knowns; there are things we know that we know >From e25b297d285b31fd8a842356aa5818d303b4dec9 Mon Sep 17 00:00:00 2001 From: Rasmus Date: Sun, 21 Sep 2014 16:17:55 +0200 Subject: [PATCH] ox: Support unnumbered headlines via property. * ox.el (org-export--collect-headline-numbering): Ignore unnumbered headline. (org-export-get-headline-id, org-export--collect-unnumbered-headline-id): New functions. (org-export-numbered-headline-p): Further tests for unnumbered headline. * ox-odt.el (org-odt-headline, org-odt-link, org-odt-link--infer-description) ox-md.el (org-md-headline, org-md-link), ox-latex.el (org-latex-headline, org.latex-link), ox-html.el (org-html-headline, org-html-link), ox-ascii.el (org-ascii-link): Support ununbered headlines. * test-ox.el (test-org-export/org-export-get-headline-id): New test. --- lisp/org.el | 2 +- lisp/ox-ascii.el| 8 ++-- lisp/ox-html.el | 39 +++-- lisp/ox-latex.el| 23 ++ lisp/ox-md.el | 24 +-- lisp/ox-odt.el | 39 + lisp/ox.el | 52 + testing
[O] Solution for very long hyperlinks when exporting to latex?
Hi, very happy with orgmode but rather desperate these days trying to get very long url hyperlinks in footnotes to typeset as line-broken-up links after latex export. I have tried the hints available on texstack etc., but none of the proposed latex methods work. Not even manual \- produces a reasonable result. I have tried with hyperref switched on and off in the emacs org exporter configuration, and with the "linebreak" option of hyperref which is not even accepted depending on the exporter setting. I am using org-version 8.2.4, emacs 24.3.1, texlive 2014, scrbook (added this style to .emacs which works fine otherwise). I am not sure if it has to do with the exporter or with latex/koma script only, or maybe all three of them. Surely someone must have come across this problem and may be able to provide a hint? Thanks, Martin
Re: [O] [patch, ox] #+INCLUDE resolves links
Hi, Changes are one sentence in the documentations, casing, and I changed the regexp so that :only-contents is valid (it's nil). Nicolas Goaziou writes: > Rasmus writes: > >> It's two extra words and maybe it's helpful to make the concept clear >> to people unfamilar with org-element. The statement "contents of the >> requested element", while technically clear, is only barely >> comprehensible for the uninvited. >> >> However, it's only tweo extra words, so I'm happy to remove them if >> you have strong feeling about this. > > I have no strong feeling. Though, I admit the "etc" these two words > imply annoys me. Anyway, you will be the final judge. Is it better now? >> I don't know what you mean with regular. Anyway, my reasoning is that >> this INCLUDE-command >> >> #+INCLUDE: "/tmp/test0.org" :my-random-prop "foo" >> >> Will give me something like: >> >> \#+\textsc{begin}\(_{\text{my}}\)-random-prop >> \section{test0} >> \label{sec-2} >> 1 >> \#+\textsc{end}\(_{\text{my}}\)-random-prop >> >> In casual testing similar stuff happened when I did not remove the >> match. It could have been it was a bit too casual and that I >> misspelling the property. I will test this properly later. > > OK. I wait for your report. Block sucks up whatever remains, so the match must be removed: (block (and (string-match "\\<\\(\\S-+\\)\\>" value) (match-string 1 value))) I want to discuss one more important potential issue before having the patch applied. Currently, location is ignored if the included part is not an env (line 3381) and not a block (3392). I'm not sure this is right. I could do one of the following: 1. Nothing (current state) 2. Throw an error if location and env or block are combined. 3. Try to use location even if block is set. Recall, though, that location is resolved using org-mode. 4. Let location be a general regexp if env or block is non-nil. But then we are breaking with the org file-link idea. 5. Make location work for org files when env or block, otherwise throw an error. WDYT? Less important. Should the >From 44e20962a3c16e1f79a2d5bbc8420f00f93db637 Mon Sep 17 00:00:00 2001 From: Rasmus Date: Sun, 28 Sep 2014 21:05:17 +0200 Subject: [PATCH] ox: Allow file-links with #+INCLUDE-keyword * org.el (org-edit-special): Handle file-links for INCLUDE. * ox.el (org-export--prepare-file-contents): Handle links and add option no-heading. * ox.el (org-export-expand-include-keyword): Resolve headline links and add option :only-contents. * orgguide.texi (Include files) org.texi (Include files): Updated. * testing/examples/include.org: New examples. * test-ox.el (test-org-export/expand-include): New tests. --- doc/org.texi | 17 +++ doc/orgguide.texi| 9 +++- lisp/org.el | 9 ++-- lisp/ox.el | 117 +++ testing/examples/include.org | 25 + testing/lisp/test-ox.el | 59 +- 6 files changed, 220 insertions(+), 16 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index 7d98d51..296e289 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -10008,6 +10008,23 @@ to use the obvious defaults. #+INCLUDE: "~/.emacs" :lines "10-"@r{Include lines from 10 to EOF} @end example +Finally, you may use a file-link, see @ref{search option in file links}, to +extract an object as matched by @code{org-link-search}@footnote{Note that +@code{org-link-search-must-match-exact-headline} is locally bound to non-nil. +Therefore, @code{org-link-search} only matches headlines and named +elements.}. If the @code{:only-contents} property is non-nil, only the +contents of the requested element will be included, omitting properties +drawer and planning-line if present. The @code{:lines} keyword +operates locally with respect to the requested element. Some examples: + +@example +#+INCLUDE: "./paper.org::#theory" :only-contents t + @r{Include the body of the heading with the custom id @code{theory}} +#+INCLUDE: "./paper.org::mytable" @r{Include named element.} +#+INCLUDE: "./paper.org::*conclusion" :lines 1-20 + @r{Include the first 20 lines of the headline named conclusion.} +@end example + @table @kbd @kindex C-c ' @item C-c ' diff --git a/doc/orgguide.texi b/doc/orgguide.texi index ca8e052..4feeaca 100644 --- a/doc/orgguide.texi +++ b/doc/orgguide.texi @@ -2264,8 +2264,13 @@ include your @file{.emacs} file, you could use: The optional second and third parameter are the markup (i.e., @samp{example} or @samp{src}), and, if the markup is @samp{src}, the language for formatting the contents. The markup is optional, if it is not given, the text will be -assumed to be in Org mode format and will be processed normally. @kbd{C-c '} -will visit the included file. +assumed to be in Org mode format and will be processed normally. File-links +will be interpreted as well: +@smallexample +#+INCLUDE
[O] behavior of org-image-actual-size with units in attr_* :width
I have set this in my init file (setq org-image-actual-width '(600)) It works great, unless I use: #+attr_latex: :width 4in This makes my images 4 inches wide in LaTeX, but it sets my images to approximately 4 pixels wide! I feel like it is worth modifying the regexp that gets the width to catch these cases and fall back on the variable value when they exist. Any thoughts? -- --- John Kitchin http://kitchingroup.cheme.cmu.edu
Re: [O] orgmode in drupal
Thanks Christian Moe writes: > Thanks for this -- definitely interesting, but I'll have no time to try > it out for a while. > > Yours, > Christian > > David Arroyo Menendez writes: > >> Hello, >> >> Perhaps in this mailing list there are some drupal admin who wants >> upload his files to drupal. I've a project to make it :) >> https://www.drupal.org/node/1977240. >> >> Regards.
Re: [O] Improved way to include some headlines from an external org file
Xavier Garrido writes: > Is there a way ... ... > to write something like that ... > #+BEGIN_SRC org > #+INCLUDE: "./base.org" :headline "First base chapter" > ,* A more personal chapter > #+INCLUDE: "./base.org" :headline "Second base chapter" > ,* Another personal chapter > #+END_SRC Hi! today I crossed into Sacha's weekly links ( http://sachachua.com/blog/#post-27515 ). One of the proposed link suggests a solution not too far from your initial question: http://endlessparentheses.com/updating-org-mode-include-statements-on-the-fly.html?source=rss Kindest regards, Andrea
Re: [O] Adding new table rows/cols in a formula update
I would include a customization variable to control this behavior, defaulting to whatever the current behavior is: IE: (setq org-calc-extend-file nil) default system behavior (setq org-calc-extend-file t) always silently extend rows (setq org-calc-extend-file "warn") issue warning in message buffer that line was extended (setq org-calc-extend-file "prompt") prompt user y/n on whether or not to extend column > -Original Message- > From: emacs-orgmode-bounces+subhant=familycareinc@gnu.org > [mailto:emacs-orgmode-bounces+subhant=familycareinc@gnu.org] On > Behalf Of Dima Kogan > Sent: Tuesday, September 30, 2014 12:28 PM > To: emacs-orgmode@gnu.org > Subject: Re: [O] Adding new table rows/cols in a formula update > > Dima Kogan writes: > > > Suppose I have this .org file: > > > > | | > > #+TBLFM: @1$2=5 > > > > It's a 1x1 table with a formula. The formula sets a cell that's out of > > bounds in the table, so evaluating this formula results in an error. > > How set-in-stone is this behavior? I haven't dug too deeply into the > > code, but are there fundamental assumptions here? Would a patch that > > extends the table before applying such a formula be too naive in some > way? > > Here's a tiny patch that adds the columns (not rows) as needed. Is this > reasonable? This message is intended for the sole use of the individual and entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended addressee, nor authorized to receive for the intended addressee, you are hereby notified that you may not use, copy, disclose or distribute to anyone the message or any information contained in the message. If you have received this message in error, please immediately advise the sender by reply email and delete the message. Thank you.
Re: [O] sortable columns in html tables
Hi, The syntax for much of this has changed since that post. Instead of #+style: you will want #+HTML_HEAD: And, attaching a class to an exported html table is handled differently too. Instead of #+attr_html: class="sortable" you want #+attr_html: :class "sortable" Such declarations also work for exported tables if placed between code blocks that export tables and the result tables (i.e. immediately after the `#+end_src`) Also, if you want ALL tables to have a class of sortable, you _can_ eval the following (plist-put org-html-table-default-attributes :class "sortable") i.e. by putting it in your emacs init.el Or, on a per-buffer basis, which is probably better, you can put this in your .org file #+BIND: org-html-table-default-attributes (:border "2" :cellspacing "0" :cellpadding "6" :rules "groups" :frame "hsides" :class "sortable") By the way, I don't use sortable, I use dataTable, but the method for getting the class attribute on the html table is the same. ~malcolm_cook >-Original Message- >From: emacs-orgmode-bounces+mec=stowers@gnu.org >[mailto:emacs-orgmode-bounces+mec=stowers@gnu.org] On >Behalf Of Michael Brand >Sent: Tuesday, September 30, 2014 1:12 PM >To: David Arroyo Menendez >Cc: Org Mode >Subject: Re: [O] sortable columns in html tables > >Hi David > >On Tue, Sep 30, 2014 at 1:44 AM, David Arroyo Menendez >wrote: >> How can I make sortable columns in tables? I would be useful to edit or >> export to html. >> >> Some experiences? >> >> Thanks! > >As I understand you this pointer might be of interest: >http://lists.gnu.org/archive/html/emacs-orgmode/2012-11/msg00809.html > >Michael
Re: [O] Adding new table rows/cols in a formula update
Dima Kogan writes: > Suppose I have this .org file: > > | | > #+TBLFM: @1$2=5 > > It's a 1x1 table with a formula. The formula sets a cell that's out of > bounds in the table, so evaluating this formula results in an error. How > set-in-stone is this behavior? I haven't dug too deeply into the code, > but are there fundamental assumptions here? Would a patch that extends > the table before applying such a formula be too naive in some way? Here's a tiny patch that adds the columns (not rows) as needed. Is this reasonable? >From 93e9927dd49d100036853963e899c8b6af5325de Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Tue, 30 Sep 2014 12:27:26 -0700 Subject: [PATCH] org-table: field formulas can now create new columns as needed --- lisp/org-table.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org-table.el b/lisp/org-table.el index 7607ead..31365ad 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -3125,7 +3125,7 @@ known that the table will be realigned a little later anyway." (while (setq eq (pop eqlname1)) (message "Re-applying formula to field: %s" (car eq)) (org-goto-line (nth 1 eq)) - (org-table-goto-column (nth 2 eq)) + (org-table-goto-column (nth 2 eq) nil 'force) (org-table-eval-formula nil (nth 3 eq) 'noalign 'nocst 'nostore 'noanalysis)) -- 2.0.0
Re: [O] Error Embedding SQL Source from code block into R Source of Another (noweb)
Eric Brown writes: > 2) Grant, I tried your code, but there seem to be some missing headers. > Do you have a complete minimal example that exhibits the behavior that > you have demonstrated? Add :noweb yes. Also Grant seems to have gone non-standard and replaced the <> markup with guillemots. Using the default markers, it should read: --8<---cut here---start->8--- #+name: query #+begin_src sql select * from table where x > 10 #+end_src #+begin_src R :noweb yes :tangle output.R input <- ' <> ' #+end_src ## ✂✂ produces this ## ✂✂ input <- ' select * from table where x > 10 ' --8<---cut here---end--->8--- Nick
[O] clock-in and clock-out columns for clock-table
Is there a way to coerce a clock table to include the clock in and clock out information? TIA.
Re: [O] Error Embedding SQL Source from code block into R Source of Another (noweb)
On Tue, Sep 30, 2014 at 9:32 AM, Eric Brown wrote: > 2) Grant, I tried your code, but there seem to be some missing headers. > Do you have a complete minimal example that exhibits the behavior that > you have demonstrated? Sorry for omitting that key point: ✂✂ #+name: msg #+begin_src sql Hello, world. #+end_src #+begin_src R :eval yes print("«msg»") #+end_src #+NAME: [1] "Hello, world." #+end_example #+begin_src emacs-lisp (print emacs-version) (print org-version) (print org-babel-default-header-args) (print org-babel-default-inline-header-args) #+end_src #+NAME: #+begin_example "24.3.1" "8.2.7c" ((:eval . "always") (:noweb . "no-export") (:exports . "both") (:results . "output") (:comments . "no") (:session . "none") (:cache . "no") (:hlines . "no") (:tangle . "no")) ((:results . "value replace") (:eval . "always") (:session . "none") (:exports . "results")) #+end_example ✂✂
Re: [O] Error Embedding SQL Source from code block into R Source of Another (noweb)
Thanks Rainer and Grant for your suggestions. A couple of things: 1) My current code does what I want, the second time. Its advantage is that everything is kept inside of one .org file. Also, I am wondering if it is an R/ESS issue. 2) Grant, I tried your code, but there seem to be some missing headers. Do you have a complete minimal example that exhibits the behavior that you have demonstrated?
Re: [O] Error Embedding SQL Source from code block into R Source of Another (noweb)
Charles Berry writes: > Hmmm. Maybe the bug that was fixed by commit > > 0fd29a5ee7d14c3695b22998196373b9a3637413 > > about two weeks back? Make sure ob-R.el is up to date and compiled (or > that ob-R.elc is deleted). > > > Anyway, your code works as expected for me - first time. > > --- > > FWIW, I prefer to use :var headers to import strings, but it takes some > setup: > > > > #+BEGIN_SRC emacs-lisp > (defun grab-src (name) > (save-excursion > (org-babel-goto-named-src-block name) > (nth 1 (org-babel-get-src-block-info 'light > #+END_SRC > > #+BEGIN_SRC R :var y=(grab-src "sqlsource") :results output :exports both > y > #+END_SRC > > #+RESULTS: > : [1] "select \n * \nfrom \n t \nlimit \n 10" > In fact M-x R before evaluation did fix things. I will try to get the org source going, which contains the fix. Otherwise, I might be content to wait for the fix to make its way into org ELPA. (I'm on .emacs complexity overload) Great idea about the grab-src function! Worked like a charm. Thanks again, Eric
Re: [O] sortable columns in html tables
Hi David On Tue, Sep 30, 2014 at 1:44 AM, David Arroyo Menendez wrote: > How can I make sortable columns in tables? I would be useful to edit or > export to html. > > Some experiences? > > Thanks! As I understand you this pointer might be of interest: http://lists.gnu.org/archive/html/emacs-orgmode/2012-11/msg00809.html Michael
Re: [O] ox-odt doesn't honor :anchor "page"
Martin Gürtler writes: > I'm using Org-mode version 8.2.7c (8.2.7c-74-gd2ecbe-elpa, org-plus-contrib > package). That doesn't seem to be the case, the org-plus-contrib package would advertise itself with the "-elpaplus" suffix. Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ Factory and User Sound Singles for Waldorf Blofeld: http://Synth.Stromeko.net/Downloads.html#WaldorfSounds
Re: [O] Error Embedding SQL Source from code block into R Source of Another (noweb)
Eric Brown fastmail.fm> writes: > > Dear List: > > It is possible to embed SQL code as a string to be evaluated in R. I am > interested in formatting the SQL code in its own source code block, with > its own syntax highlighting and editing mode (C-c '). > > The first time I run the code, I am prompted for R starting directory, > but I get an error: > > --- > load ESSR: + + + Error: unexpected string constant in: > source('~/.emacs.d/elpa/ess-20140913.1153/etc/ESSR/R/.load.R', > local=TRUE) #define load.ESSR > load.ESSR('" > --- > > and the console locks. I can C-g to get out of it, and then > re-evaluate, and the code prints what I expect -- the text of the SQL > command. [rest deleted] Hmmm. Maybe the bug that was fixed by commit 0fd29a5ee7d14c3695b22998196373b9a3637413 about two weeks back? Make sure ob-R.el is up to date and compiled (or that ob-R.elc is deleted). Anyway, your code works as expected for me - first time. --- FWIW, I prefer to use :var headers to import strings, but it takes some setup: --8<---cut here---start->8--- #+BEGIN_SRC emacs-lisp (defun grab-src (name) (save-excursion (org-babel-goto-named-src-block name) (nth 1 (org-babel-get-src-block-info 'light #+END_SRC #+BEGIN_SRC R :var y=(grab-src "sqlsource") :results output :exports both y #+END_SRC #+RESULTS: : [1] "select \n * \nfrom \n t \nlimit \n 10" --8<---cut here---end--->8--- HTH, Chuck
Re: [O] [patch, ox] #+INCLUDE resolves links
Rasmus writes: > It's two extra words and maybe it's helpful to make the concept clear > to people unfamilar with org-element. The statement "contents of the > requested element", while technically clear, is only barely > comprehensible for the uninvited. > > However, it's only tweo extra words, so I'm happy to remove them if > you have strong feeling about this. I have no strong feeling. Though, I admit the "etc" these two words imply annoys me. Anyway, you will be the final judge. > I don't know what you mean with regular. Anyway, my reasoning is that > this INCLUDE-command > > #+INCLUDE: "/tmp/test0.org" :my-random-prop "foo" > > Will give me something like: > > \#+\textsc{begin}\(_{\text{my}}\)-random-prop > \section{test0} > \label{sec-2} > 1 > \#+\textsc{end}\(_{\text{my}}\)-random-prop > > In casual testing similar stuff happened when I did not remove the > match. It could have been it was a bit too casual and that I > misspelling the property. I will test this properly later. OK. I wait for your report. Regards,
Re: [O] Error Embedding SQL Source from code block into R Source of Another (noweb)
On Tue, Sep 30, 2014 at 3:05 AM, Rainer M Krug wrote: > Eric Brown writes: Like Rainier mentioned you might want to use [noweb] to tangle both for output tangling and execution. My system is set up to tangle for both eg: This ## ✂✂ #+name: query #+begin_src sql select * from table where x > 10 #+end_src #+begin_src R :tangle output.R input <- ' «query» ' #+end_src ## ✂✂ produces this ## ✂✂ input <- ' select * from table where x > 10 ' ## ✂✂ and this ## ✂✂ #+name: msg #+begin_src sql Hello, world. #+end_src #+begin_src R :eval yes print("«msg»") #+end_src #+NAME: #+begin_example [1] "Hello, world." #+end_example ## ✂✂ produces this ## ✂✂ ╭ │ Hello, world. ╰ ╭ │ print("«msg»") ╰ ╭ │ [1] "Hello, world." ╰ ## ✂✂ http://orgmode.org/manual/noweb.html#noweb
Re: [O] Image collisions (was Re: ox-odt doesn't honor :anchor "page")
hi, Am 30.09.2014 um 11:30 schrieb Christian Moe: > > Martin Gürtler writes: > >> Hi, >> >> thanks for the fast response. >> >> Am 30.09.2014 um 09:58 schrieb Christian Moe: >>> >>> Confirmed, but it seems to be a documentation error, not a bug. >>> It works if you leave out the quotation marks: >>> #+ATTR_ODT: :anchor page >> >> This indeed helped. Unfortunately, it turns out that the anchoring is of >> limited >> use, because I get collisions (images at same position). Well, org-mode >> export >> is not LateX - there is probably no way to control that within the org mode >> file.. > > Not currently, as far as I'm aware. LibreOffice lacks Latex's ability to > decide for itself where best to place an image on the page, and Org-mode > shouldn't even try. > > It's no doubt technically possible to add a feature to specify image > coordinates in the ATTR_ODT line, but I don't know if there would be a > point. In very many cases, it will probably be easier to fix stuff > manually in LibreOffice afterwards than specifying coordinates in Org. True. Probably the cleanest solution is to stick to paragraph anchors and move images physically. Should be stable enough if there are enough forced page breaks, eg for each chapter. Thanks again, Martin --
Re: [O] [patch, ox] #+INCLUDE resolves links
Nicolas Goaziou writes: >> Just out of curiosity, what is an example of a element that can be >> named and does not have a :contents-begin? > > #+name: empty-drawer > :DRAWER: > :END: Thanks. >> Okay, there's a lot of improvements in that suggestion. However, it >> misses this case which created using only "official" shortcuts >> >> * head >> SCHEDULED: <2014-09-28 sun> >> :LOGBOOK: >> - Note taken on [2014-09-28 sat 12:21] \\ >>a drawer >> :END: >> :PROPERTIES: >> :CUSTOM_ID: h >> :END: > > This was done on purpose, anticipating a patch I'm working on. Anyway, > it doesn't matter much. I'll revert it once my work is ready. Okay. If you discussed on the list I missed it. >> +elements.}. If the @code{:only-contents} property is non-nil, only the >> +contents of the requested element will be included, omitting any >> +property-drawers, planning-lines, attributes, captions etc. The > > properties (or property) drawer, planning line. > > Do you think it's worth specifying that captions and attributes will be > ignored? It seems pretty obvious to me as they do not belong to contents > (unlike to planning and properties drawers). It's two extra words and maybe it's helpful to make the concept clear to people unfamilar with org-element. The statement "contents of the requested element", while technically clear, is only barely comprehensible for the uninvited. However, it's only tweo extra words, so I'm happy to remove them if you have strong feeling about this. >> + (only-contents >> + (and (string-match ":only-contents +\\([^: \r\t\n]\\S-*\\)" value) >> + (prog1 (org-not-nil (match-string 1 value)) >> + (setq value (replace-match "" nil nil value) > > Why do you need to remove match from VALUE? AFAICT, the only match that > needs to be removed is the file name. Others are regular. I don't know what you mean with regular. Anyway, my reasoning is that this INCLUDE-command #+INCLUDE: "/tmp/test0.org" :my-random-prop "foo" Will give me something like: \#+\textsc{begin}\(_{\text{my}}\)-random-prop \section{test0} \label{sec-2} 1 \#+\textsc{end}\(_{\text{my}}\)-random-prop In casual testing similar stuff happened when I did not remove the match. It could have been it was a bit too casual and that I misspelling the property. I will test this properly later. > Mind the 80th column in your tests, and full stop at end of comments. OK, I'll fix it. > Besides the minor issues above, it looks good. Feel free to push it > whenever you want. Don't have push. —Rasmus -- Lasciate ogni speranza o voi che entrate: siete nella mani di'machellaio
[O] [patch] org-sbe doc
Hi, Cf. Charles Berry's post to a similarly named post there's a bug in the documentation of org-sbe. This patch corrects it. Thanks, Rasmus -- Together we'll stand, divided we'll fall >From 0f320a044cef4974be40b351da72729045a56ca6 Mon Sep 17 00:00:00 2001 From: rasmus Date: Tue, 30 Sep 2014 11:53:36 +0200 Subject: [PATCH] ob-table: Updated documentation. * ob-table.el (org-sbe): Updated documentation. --- lisp/ob-table.el | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lisp/ob-table.el b/lisp/ob-table.el index 6658313..46be551 100644 --- a/lisp/ob-table.el +++ b/lisp/ob-table.el @@ -47,7 +47,10 @@ ;; |7 || ;; |8 || ;; |9 || -;; #+TBLFM: $2='(org-sbe 'fibbd (n $1)) +;; #+TBLFM: $2='(org-sbe "fibbd" (n $1)) + +;; NOTE: The quotes around the function name, 'fibbd' in this case, +;; are optional. ;;; Code: (require 'ob-core) @@ -69,7 +72,7 @@ string of its value. So this `org-sbe' construct - (org-sbe 'source-block (n $2) (m 3)) + (org-sbe \"source-block\" (n $2) (m 3)) is the equivalent of the following source code block: @@ -77,6 +80,9 @@ is the equivalent of the following source code block: results #+end_src +NOTE: The quotes around 'source-block', the function name, are +optional. + NOTE: By default, string variable names are interpreted as references to source-code blocks, to force interpretation of a cell's value as a string, prefix the identifier a \"$\" (e.g., -- 2.1.1
Re: [O] org-export - was :input-buffer removed from the communication channel?
Nicolas Goaziou writes: Hello, > Thorsten Jolitz writes: > >> Hi Nicolas, >> >> for exporting a buffer w/o buffer-file, sometimes ago you added property >> :input-buffer to the communication channel (on my feature request), so >> this used to work (one of the two vars was always non-nil): >> >> #+BEGIN_SRC emacs-lisp >> (let ((input-file (plist-get info :input-file)) >> (input-buffer (plist-get info :input-buffer))) ...) >> #+END_SRC >> >> But now the :input-buffer property seems to have disappeared from the >> 'info' plist again. If so, its a real pity, since crucial info is missing >> whenever 'buffer-file-name' is nil. > > It should be back in 39f5f03. Thanks! -- cheers, Thorsten
Re: [O] Image collisions (was Re: ox-odt doesn't honor :anchor "page")
Martin Gürtler writes: > Hi, > > thanks for the fast response. > > Am 30.09.2014 um 09:58 schrieb Christian Moe: >> >> Confirmed, but it seems to be a documentation error, not a bug. >> It works if you leave out the quotation marks: >> #+ATTR_ODT: :anchor page > > This indeed helped. Unfortunately, it turns out that the anchoring is of > limited > use, because I get collisions (images at same position). Well, org-mode export > is not LateX - there is probably no way to control that within the org mode > file.. Not currently, as far as I'm aware. LibreOffice lacks Latex's ability to decide for itself where best to place an image on the page, and Org-mode shouldn't even try. It's no doubt technically possible to add a feature to specify image coordinates in the ATTR_ODT line, but I don't know if there would be a point. In very many cases, it will probably be easier to fix stuff manually in LibreOffice afterwards than specifying coordinates in Org. Yours, Christian
[O] Image collisions (was Re: ox-odt doesn't honor :anchor "page")
Hi, thanks for the fast response. Am 30.09.2014 um 09:58 schrieb Christian Moe: > > Confirmed, but it seems to be a documentation error, not a bug. > It works if you leave out the quotation marks: > #+ATTR_ODT: :anchor page This indeed helped. Unfortunately, it turns out that the anchoring is of limited use, because I get collisions (images at same position). Well, org-mode export is not LateX - there is probably no way to control that within the org mode file.. Regards, Martin -- Dr. Martin Gürtler Phone: +49-341-2254303 Mobile: +49-1578-4469069
Re: [O] [patch, ox] #+INCLUDE resolves links
Hello, Rasmus writes: > Thanks for the comments. I hope I addressed the previous comments and > did not introduce new reasons bugs. > I added tests. Great. > Just out of curiosity, what is an example of a element that can be > named and does not have a :contents-begin? #+name: empty-drawer :DRAWER: :END: > Okay, there's a lot of improvements in that suggestion. However, it > misses this case which created using only "official" shortcuts > > * head > SCHEDULED: <2014-09-28 sun> > :LOGBOOK: > - Note taken on [2014-09-28 sat 12:21] \\ >a drawer > :END: > :PROPERTIES: > :CUSTOM_ID: h > :END: This was done on purpose, anticipating a patch I'm working on. Anyway, it doesn't matter much. I'll revert it once my work is ready. > +elements.}. If the @code{:only-contents} property is non-nil, only the > +contents of the requested element will be included, omitting any > +property-drawers, planning-lines, attributes, captions etc. The properties (or property) drawer, planning line. Do you think it's worth specifying that captions and attributes will be ignored? It seems pretty obvious to me as they do not belong to contents (unlike to planning and properties drawers). > + (only-contents > + (and (string-match ":only-contents +\\([^: \r\t\n]\\S-*\\)" > value) > +(prog1 (org-not-nil (match-string 1 value)) > + (setq value (replace-match "" nil nil value) Why do you need to remove match from VALUE? AFAICT, the only match that needs to be removed is the file name. Others are regular. > + ;; skip planning line and property-drawer. If a normal drawer > + ;; precedes a property-drawer both will be included. > + ;; Remaining property-drawers are removed as needed in > + ;; `org-export--prepare-file-contents' ;; Skip planning line and properties drawer. > + ;; If only-contents is non-nil only include contents of element > + (should > + (equal > +"body\n" > +(org-test-with-temp-text > + (format "#+INCLUDE: \"%s/examples/include.org::*Heading\" > :only-contents t" org-test-dir) > + (org-export-expand-include-keyword) [...] > + ;; Properties should be dropped, drawers should not be > + (should > + (equal > +":LOGBOOK:\ndrawer\n:END:\ncontent\n" > +(org-test-with-temp-text > + (format "#+INCLUDE: \"%s/examples/include.org::#dh\" :only-contents t" > org-test-dir) > + (org-export-expand-include-keyword) > + (buffer-string) Mind the 80th column in your tests, and full stop at end of comments. Besides the minor issues above, it looks good. Feel free to push it whenever you want. Thank you for that work. Regards, -- Nicolas Goaziou
Re: [O] Error Embedding SQL Source from code block into R Source of Another (noweb)
Eric Brown writes: > Dear List: > > It is possible to embed SQL code as a string to be evaluated in R. I am > interested in formatting the SQL code in its own source code block, with > its own syntax highlighting and editing mode (C-c '). This sounds very interesting, and I would be interested in doing thia as well. Up to now, I was writing the sql statements in R, which is a pain (paste, paste0, ...). But editing them in org and passing them to an R source block as a variable sounds interestin, but I don't think this will work. What might work is using noweb expansion, but I never used it. Check out the worg [1] "Simple Literate Programming Example (Noweb syntax)" From the page: , | In the Org-mode file: | | #+name: hello-world-prefix | #+begin_src sh :exports none | echo "/---\\" | #+end_src | HTML export of code: In the Org-mode file | | #+name: hello-world-postfix #+begin_src sh :exports none echo | "\---/" | #+end_src | | HTML export of code: The third code block does have a tangle header | argument indicating the name of the file to which the tangled source | code will be written. It also has Noweb style references to the two | previous code blocks. These references will be expanded during | tangling to include them in the output file as well. | | In the Org-mode file: | | #+name: hello-world | #+begin_src sh :tangle hello :exports none :noweb yes | <> | echo "| hello world |" | <> | #+end_src | | HTML export of code: Calling org-babel-tangle will result in the following | shell source code being written to the hello.sh file: | | #!/usr/bin/env sh | | # [[file:~/org/temp/index.org::*Noweb%20test][hello-world]] | | echo "/---\\" | echo "| hello world |" | echo "\---/" | # hello-world ends here | | In addition, the following syntax can be used to insert the results of | evaluating a code block, in this case one named example-block. | | # <> ` I guess this should work - and I will try it out - learned something. Thanks for the question, Rainer > > The first time I run the code, I am prompted for R starting directory, > but I get an error: > > --- > load ESSR: + + + Error: unexpected string constant in: > source('~/.emacs.d/elpa/ess-20140913.1153/etc/ESSR/R/.load.R', > local=TRUE) #define load.ESSR > load.ESSR('" > --- > > and the console locks. I can C-g to get out of it, and then > re-evaluate, and the code prints what I expect -- the text of the SQL > command. > > Is this the right way to go about this? Have I discovered a bug, or > perhaps accidentally a wrong way to get the right answer? > > Is this an ESS problem, and not an orgmode problem, per se? My ESS > normally starts up fine, so I thought I would ask on this list first. > > A minimal example (first failing, second evaluation giving expected > output) follows. > > Best regards, > > Eric > > Debian GNU/Linux (jessie) > Emacs 24.3.93 > Org current from org repo > ESS from MELPA (ca. 14.09) > R 3.1.1 compiled from source > > > > - SESSION - > #+TITLE: Test SQL Code > #+AUTHOR: Eric Brown > #+EMAIL: br...@fastmail.fm > #+PROPERTY: session *R* > #+PROPERTY: cache no > > #+name: sqlsource > #+begin_src sql :engine postgresql :eval yes :noweb-ref sqlsrc :exports code > :results none > select > * > from > t > limit > 10 > #+end_src > > #+name: rsource > #+begin_src R :noweb yes :results output :exports both > input <- ' > <> > ' > cat(input) > # dbGetQuery(connectionHandle, input) > #+end_src > > #+RESULTS: rsource > : > : select > : * > : from > : t > : limit > : 10 > - > > > > Footnotes: [1] http://orgmode.org/worg/org-contrib/babel/intro.html -- Rainer M. Krug email: Rainerkrugsde PGP: 0x0F52F982 pgpXC643zqQEC.pgp Description: PGP signature
Re: [O] ox-odt doesn't honor :anchor "page"
Confirmed, but it seems to be a documentation error, not a bug. It works if you leave out the quotation marks: #+ATTR_ODT: :anchor page The docs do indeed unequivocally require quotation marks, but I don't think there is any need for them. Yours, Christian Martin Gürtler writes: > Hi, > > I'm using Org-mode version 8.2.7c (8.2.7c-74-gd2ecbe-elpa, org-plus-contrib > package). > > I am writing a documentation in org mode with the intent of exporting it to > libreoffice (using libreoffice 4.2.6.3 on ubuntu 12.04). > > This works in general very well. > > I have a minor problem with image anchors. > > I think I followed the docs when writing > > #+ATTR_ODT: :width 17 :anchor "page" > #+CAPTION: Some text. > #+LABEL: fig:figureLabel > [[file:someFig.png]] > > The :anchor statement seems to be ignored in the export process, I always > get images anchored to the paragraph. > > When using Jambunathan's version of ox-odt I get images anchored to the > page, but there seem to be problems if there are two images on one page, > images covering each other when both are anchored to the page.. > > One of the few cases where doc is ahead of implementation? > > > Regards > > Martin
[O] ox-odt doesn't honor :anchor "page"
Hi, I'm using Org-mode version 8.2.7c (8.2.7c-74-gd2ecbe-elpa, org-plus-contrib package). I am writing a documentation in org mode with the intent of exporting it to libreoffice (using libreoffice 4.2.6.3 on ubuntu 12.04). This works in general very well. I have a minor problem with image anchors. I think I followed the docs when writing #+ATTR_ODT: :width 17 :anchor "page" #+CAPTION: Some text. #+LABEL: fig:figureLabel [[file:someFig.png]] The :anchor statement seems to be ignored in the export process, I always get images anchored to the paragraph. When using Jambunathan's version of ox-odt I get images anchored to the page, but there seem to be problems if there are two images on one page, images covering each other when both are anchored to the page.. One of the few cases where doc is ahead of implementation? Regards Martin