Re: LaTeX export ignores caption if table is in a drawer

2023-05-26 Thread Richard Stanton
Thanks, Ihor.

":results raw replace" seems to do what I need.

Best,

Richard


> On May 25, 2023, at 11:33 PM, Ihor Radchenko  wrote:
> 
> "Richard H. Stanton"  writes:
> 
>> I often create tables programatically from within an org code block. To make 
>> sure I don’t produce multiple copies of the output, I like to enclose the 
>> results in a drawer. However, the exporter seems to ignore any caption I 
>> might assign if the table itself is inside a drawer. For example, if you 
>> export the sample org file below to LaTeX, the first table gets exported 
>> with caption, the second without. Would it be possible for the exporter to 
>> keep the caption in the second case as well? 
>> ...
>> #+caption: Small table
>> | C1 | C2 |
>> |+|
>> 
>> #+caption: Small table
>> :results:
>> | C1 | C2 |
>> |+|
>> :end:
> 
> The second example has a drawer with caption, not a table with caption.
> Captions in drawers are ignored (or rather it is undefined behaviour).
> 
> I recommend not wrapping tables into drawers in your use case - it is
> not necessary if you just have a table in the output. If you have
> multiple things, with table coming first, it would be unclear which part
> you want to assign the caption to; so you would need to arrange yourself
> to create table result with caption inside the drawer.
> 
> -- 
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 




Re: Modifying the parse tree

2023-05-26 Thread Ihor Radchenko
bvchg...@mail.com writes:

>> Yes, it is invalid.  You must always have :level.
>
> Ah! Thank you! Is there some documentation that explains which properties
> each element must have in order to be valid, please?

Just https://orgmode.org/worg/dev/org-element-api.html
And source code, of course.

> For example I'm now trying to create a deadline for the heading, and it's
> also not working.

That's because deadline is not a part of the heading object. It is just
kept there as property for convenience.

You need to explicitly create
 (heading (...) (section (...) (planning ...) ...))
AST to add a deadline.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Restricting files for caldav sync

2023-05-26 Thread Loris Bennett
Hi,

I have a lisp function for syncing my appointments from 'calendar.org'
to a Nextcloud instance via Caldav.  The variable org-caldav-inbox is
set to 'calendar.org' and org-caldav-files is set to 'nil'.

However, when I run the function, all the files which contain IDs are
considered, five files in total, including a large archive file.  This
makes the sync take rather a long time.

How do I restrict the sync to just a single file?

Cheers,

Loris

-- 
This signature is currently under constuction.



Re: Modifying the parse tree

2023-05-26 Thread bvchgvbt
> "Ihor Radchenko" wrote:

> >> Which implies that you added invalid headline element to the tree.
> >
> > Hmm. Does
> > headline (:title hello :todo-keyword TODO :todo-type todo)
> > look valid to you as a minimal TODO-type headline? Created via:
> >
> >   (let ((todo (org-element-create 'headline)))
> > (org-element-put-property todo :title todo-title)
> > (org-element-put-property todo :todo-keyword "TODO")
> > (org-element-put-property todo :todo-type "todo"))
>
> Yes, it is invalid.  You must always have :level.

Ah! Thank you! Is there some documentation that explains which properties
each element must have in order to be valid, please?

For example I'm now trying to create a deadline for the heading, and it's
also not working.

> You might try https://github.com/ndwarshuis/org-ml, though I plan some
> breaking changes affecting org-ml soon.

Thanks, I'll look into that. From first glance it looks useful. I'll
probaby continue as I am until I get something that works, and then maybe
refactor to use org-ml.



Re: [Pre-PATCH] Overhaul of the LaTeX preview system

2023-05-26 Thread Rudolf Adamkovič
Timothy  writes:

> If you do come across any issues, please let me know either in a reply
> here or the org-mode matrix room.

First of all, thank you for working on this!

Here are some issues, after using your patch-set for 1 day:

ISSUE 1: CLIPPING

On my HiDPI screen, the new previews are clipped slightly at the edges.
I had this issue before and fixed it in [1][2].  Has the same bug crept
back?

[1] https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=52ebf6b45
[2] https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=5337a49f3

ISSUE 2: TIKZ

I use LaTeX Babel blocks for TikZ, and these stopped working.  From the
*Messages* buffer:

Executing Latex unknown at position 846...
Processing LaTeX file 
/var/folders/ky/8r5j3qz55hb94lpg1jr9vl1cgn/T/babel-ntjCLq/latex-aGIYEN.tex...
Compiling 
/var/folders/ky/8r5j3qz55hb94lpg1jr9vl1cgn/T/babel-ntjCLq/latex-aGIYEN.tex...
org-compile-file: File 
"/var/folders/ky/8r5j3qz55hb94lpg1jr9vl1cgn/T/babel-ntjCLq/latex-aGIYEN.svg"
 wasn’t producedorg babel latex failed
PDF file produced.

The linked LaTeX file compiles without errors, and a PDF file with
correct content sits next to it.  Perhaps the preview system needs to
wait longer?

[Also notice the missing space in "producedorg".]

It would be *FABULOUS* if this patch-set could also make 'ob-babel' use
the same mechanism as the new previews, 'dvisvgm' (TeX to DVI to SVG)
instead of Inkscape (TeX to PDF to SVG).  It would fix, for example,
scaling.  On my system, LaTeX Babel outputs everything at half of the
correct size, and I cannot convince Inkscape to scale up to save my
life.  The previews and 'dvisvgm' work as expected, conversely.

It would be *SUPER-FABULOUS* if the new previews worked with TikZ out of
the box, as per the Org manual saying "any LaTeX environment is handled"
[1] when not using MathJax.  Currently, PGF plots show as "blobs of
letters" and the simplest TikZ pictures, such as

\begin{tikzpicture}
  \filldraw (0, 0) circle[radius = 1cm];
\end{tikzpicture}

make the preview system choke with

error in process filter: org-latex-preview--svg-make-fg-currentColor: Wrong 
type argument: stringp, nil
error in process filter: Wrong type argument: stringp, nil

[1] https://orgmode.org/manual/LaTeX-fragments.html

Rudy
-- 
"One can begin to reason only when a clear picture has been formed in
the imagination."
-- Walter Warwick Sawyer, Mathematician's Delight, 1943

Rudolf Adamkovič  [he/him]
Studenohorská 25
84103 Bratislava
Slovakia



Re: [FR] Enhancing footnote managment (via indirect buffer)?

2023-05-26 Thread Ihor Radchenko
Andrea Lazzarini  writes:

> I've tried to use org-edit-special with a src block with 2+ blank lines and 
> the second #+end_src is not seen as part of the footnote.
> Is this the edge problem you were addressing? I get the same result with the 
> indirect buffer.

Yup, it is one of the edge problems that org-edit-special could (though
currently does not) address. Indirect buffer cannot easily address such
problems.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Fwd: [FR] Enhancing footnote managment (via indirect buffer)?

2023-05-26 Thread Andrea Lazzarini
Il giorno 24 mag 2023, alle ore 11:03, Ihor Radchenko  ha 
scritto:
> 
> Payas Relekar  writes:
> 
>> I've been playing with org-footnote-assistance, and this is again just
>> another opinion, but I'm also preferring the indirect buffer. It just
>> puts things in better perspective.
> 
> I'd prefer to integrate things with `org-edit-special', if possible.
> Possibly extending `org-edit-special' functionality.
> 
> The pros for `org-edit-special' are that we can escape certain edge
> cases. In particular, there is a known edge case when footnote
> definition contains an src block with 2+ blank lines. The blank lines
> are treated as the end of the footnote definition and src block is not
> recognized. Also, `org-edit-footnote-reference' takes care about
> removing common indentation.
> 

I've tried to use org-edit-special with a src block with 2+ blank lines and the 
second #+end_src is not seen as part of the footnote.
Is this the edge problem you were addressing? I get the same result with the 
indirect buffer.

I'll try to implement at least footnote previewing functionalities with eldoc!

> -- 
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 





Re: Unable to install from elpa

2023-05-26 Thread Ihor Radchenko
Max Nikulin  writes:

> I have realized that the command is specified in the README.org file, so 
> it is mentioned twice on https://elpa.gnu.org/packages/org.html

> However prior to Emacs-29.1 built-in packages are filtered-out from 
> completion list and ignored by non-interactive command
>
> ...
> Should `list-packages' recipe be used in the README.org file instead?

The first instance of M-x package-install  org  comes from
ELPA itself. Considering that ELPA is targeting various Emacs versions,
it should probably be corrected there first.

The second instance in README.org may then be altered according to what
ELPA devs do.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: LaTeX export ignores caption if table is in a drawer

2023-05-26 Thread Ihor Radchenko
"Richard H. Stanton"  writes:

> I often create tables programatically from within an org code block. To make 
> sure I don’t produce multiple copies of the output, I like to enclose the 
> results in a drawer. However, the exporter seems to ignore any caption I 
> might assign if the table itself is inside a drawer. For example, if you 
> export the sample org file below to LaTeX, the first table gets exported with 
> caption, the second without. Would it be possible for the exporter to keep 
> the caption in the second case as well? 
> ...
> #+caption: Small table
> | C1 | C2 |
> |+|
>
> #+caption: Small table
> :results:
> | C1 | C2 |
> |+|
> :end:

The second example has a drawer with caption, not a table with caption.
Captions in drawers are ignored (or rather it is undefined behaviour).

I recommend not wrapping tables into drawers in your use case - it is
not necessary if you just have a table in the output. If you have
multiple things, with table coming first, it would be unclear which part
you want to assign the caption to; so you would need to arrange yourself
to create table result with caption inside the drawer.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at