Re: [emacs-humanities] Paper Zettelkasten safety [was: Why Emacs-humanities?]

2021-07-18 Thread Jean Louis
* Ihor Radchenko  [2021-07-18 17:51]:
> Jean Louis  writes:
> 
> > How do I display the list of tags in Org mode?
> 
> There is nothing like dashboard of tags in Org mode. However, you can
> get a list of all the tags using (org-global-tags-completion-table).

I will move the email to org mode mailing list. Here I am showing
the concept on how to show the tags create buttons. I am using
this in Hyperscope as to list all the tags. But I am not using
Org mode to display it, though that would be better for Org
mode. I did not delete those not necessary variables and
functions below as it is only to show the concept. 

When you run M-x rcd-org-tags you would get a new pop up window
with the list of tags, you can then use Enter or Mouse to invoke
Org agenda on the tag.

Having tags index is useful. Something like this should be in Org mode.

(defun rcd-org-tags (&optional prefix)
  (interactive "p")
  "Report ordered Org tags"
  (let* ((tags (flatten-list (org-global-tags-completion-table)))
 (tags (seq-sort 'string< (seq-uniq tags
(rcd-pop-to-report
 (with-temp-buffer
   (rcd-org-insert-buttons tags)
   (buffer-string))
 nil)))

(defun rcd-org-insert-button (tag)
  (insert-text-button tag
  'action
  `(lambda (_) 
 (org-tags-view nil ,tag)))
  'follow-link t)

(defun rcd-org-insert-buttons (tags)
  (insert "TAGS:  ")
  (while tags
(let* ((tag (pop tags)))
  (rcd-org-insert-button tag)
  (insert " ")
(when (> (current-column) 70) (insert "\n")

(defun rcd-pop-to-report (string &optional buffer-name map place refresh 
truncate)
  "Pop the new buffer and inserts STRING.
Quits with `q' if necessary.
BUFFER-NAME is optional.

It will destroy the buffer before display of report."
  (let ((buffer (or buffer-name "*RCD Report*")))
(when (buffer-live-p (get-buffer buffer))
  (kill-buffer (get-buffer buffer)))
(save-excursion
  (pop-to-buffer buffer)
  (let ((word-wrap truncate))
(when word-wrap (toggle-truncate-lines 1))
(setq rcd-current-table (when (listp place) (cdr (assoc "table" 
place
(setq rcd-current-column (when (listp place) (cdr (assoc "column" 
place
(setq rcd-current-table-id (when (listp place) (cdr (assoc "table-id" 
place
(setq rcd-tabulated-refresh-function refresh)
(insert string)
(goto-char 1)
(if map 
(use-local-map map)
  (local-set-key (kbd "q") 'delete-window)
  (read-only-mode 1))

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



Re: [BUG] Citations in tables are not exported

2021-07-18 Thread John Kitchin
I also see this behavior. I think this should be considered a bug, it is
pretty common to see citations in a table cell.

Additionally, I cannot insert a citation in a caption that is above a
table (or a figure), I get
"user-error: Cannot insert a citation here". That should be considered a
bug in org-cite--allowed-p  I think. It fails because in the caption the
context is a table, and it has :post-affiliated item which causes
org-cite--allowed-p  to return nil.

If I put a citation in the caption anyway, it does seem to get exported
correctly.

I am not sure why the cites don't export inside the table cell though.

Thanks,

Timothy  writes:

> Hi,
>
> I've just started playing with citations, but it seems that I've
> stumbled across a bug where if the citation is in a table cell it will
> be left "raw". See the following example
>
> #+begin_org
> ,#+begin_src bibtex :tangle activedoc.bib
> @article{SchulteActiveOrg,
>  author={Schulte, Eric and Davison, Dan},
>  journal={Computing in Science Engineering},
>  title={Active Documents with Org-Mode},
>  year={2011},
>  volume={13},
>  number={3},
>  pages={66-73},
>  doi={10.1109/MCSE.2011.41}}
> ,#+end_src
>
> ,#+bibliography: activedoc.bib
> ,#+print_bibliography:
>
> [cite/a:@SchulteActiveOrg]
>
> | [cite/a:@SchulteActiveOrg] |
> #+end_org
>
> When exporting to ASCII, I see this:
>
> #+begin_example
> Schulte, Eric, and Dan Davison. 2011. “Active Documents with Org-Mode.”
> /Computing in Science Engineering/ 13 (3):66–73.
>
> (Schulte and Davison 2011)
>
> 
>  [cite/a:@SchulteActiveOrg]
> 
> #+end_example
>
> I hope that's enough to go off.


--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu
Pronouns: he/him/his



Re: Suggestion : Option enabling LaTeX blocks to non-latex exporters.

2021-07-18 Thread Emmanuel Charpentier
Well... this :


#+begin_src sage :exports both :results output raw
  a, b = var("a, b");
  
print("\\begin{equation*}\n%s\n\\end{equation*}"%latex(sin(a+b)==sin(a+b).trig_expand()))
  # print("\\(%s\n\\)"%latex(sin(a+b)==sin(a+b).trig_expand()))
#+end_src

#+RESULTS:
\begin{equation*}
\sin\left(a + b\right) = \cos\left(b\right) \sin\left(a\right) + 
\cos\left(a\right) \sin\left(b\right)
\end{equation*}

will get you the expected result, in ODT as in PDF. But this might be
happenstance : the slightly simpler

#+begin_src sage :exports both :results output raw
  a, b = var("a, b");
 #  
print("\\begin{equation*}\n%s\n\\end{equation*}"%latex(sin(a+b)==sin(a+b).trig_expand()))
  print("\\(%s\n\\)"%latex(sin(a+b)==sin(a+b).trig_expand()))
#+end_src

#+RESULTS:
\(\sin\left(a + b\right) = \cos\left(b\right) \sin\left(a\right) + 
\cos\left(a\right) \sin\left(b\right)
\)

will print the expected results *twice* (in ODT and in PDF).

The more straightforward) 

#+begin_src sage :exports both :results value latex
  var("a, b")
  latex(cos(a+b)==cos(a+b).trig_expand())
#+end_src

#+RESULTS:
#+begin_export latex
\cos\left(a + b\right) = \cos\left(a\right) \cos\left(b\right) - 
\sin\left(a\right) \sin\left(b\right)
#+end_export

gives the expected result in PDF (i. e. results *once*,whether the code
has #+results: or not), but not in ODT.

The "Kitchin's workaround" :


#+begin_src sage :exports both :results drawer
  print("\\(\\displaystyle{%s}\\)"%latex(tan(a+b)==tan(a+b).trig_expand()))
#+end_src

#+RESULTS:
:results:
\(\displaystyle{\tan\left(a + b\right) = -\frac{\tan\left(a\right) + 
\tan\left(b\right)}{\tan\left(a\right) \tan\left(b\right) - 1}}\)
:end:

works as (un)expected, but is still less straightforward. I'd rather
have a documented, understood way to export LaTeX snippets/ blocks
marked as such explicitly exported to ODT...

Hope this is clearer,

--
Emmanuel Charpentier

 
Le dimanche 18 juillet 2021 à 22:25 +0800, Timothy a écrit :
> 
> Hi Emmanuel,
> 
> It may interest you to hear that I submitted a patch a month or two
> ago
> (which was merged) to support LaTeX environments as results.
> 
> That means that this is now possible:
> 
> 
> #+begin_src something
> ...stuff...
> #+end_src
> 
> #+results:
> \begin{equation*}
>   some latex which will be exported nicely
> \end{equation*}
> 
> 
> All the best,
> 
> Timothy



Re: org-cite citation commands

2021-07-18 Thread Bruce D'Arcus
Unlike John, I don't have a working demo of this particular smaller idea,
but as it relates to the styles/commands question, I thought I'd mention it.

So the idea is to use the style completion UI to show the user what the
options are, by including the export preview; for the tex export
processors, it would be the latex commands, and for CSL, would be the
rendered output.

While I don't have it running, this should definitely be doable.

I put an initial mockup here.

https://github.com/bdarcus/bibtex-actions/issues/168

Probably something like this should be added to oc-basic at some point.

On Sun, Jul 18, 2021, 12:10 AM Vikas Rawal  wrote:

> This is very helpful already. Keenly looking forward to how this develops.
>
> Vikas
>
> On Sat, Jul 17, 2021 at 04:52:33PM -0400, John Kitchin wrote:
> > I made a video of my current org-cite setup at
> https://www.youtube.com/watch?v=
> > 4ta4J20kpmM. You can also find a link to the code to run it in the
> description
> > there.
> >
> > I don't intend this to be a final video (it is still a little rough!),
> it is
> > just to help people see what I am thinking about for the future of
> org-ref, at
> > least as far as the citations go.
> >
> > John
> >
> > ---
> > Professor John Kitchin (he/him/his)
> > Doherty Hall A207F
> > Department of Chemical Engineering
> > Carnegie Mellon University
> > Pittsburgh, PA 15213
> > 412-268-7803
> > @johnkitchin
> > http://kitchingroup.cheme.cmu.edu
>


Re: Suggestion : Option enabling LaTeX blocks to non-latex exporters.

2021-07-18 Thread Timothy


Hi Emmanuel,

It may interest you to hear that I submitted a patch a month or two ago
(which was merged) to support LaTeX environments as results.

That means that this is now possible:


#+begin_src something
...stuff...
#+end_src

#+results:
\begin{equation*}
  some latex which will be exported nicely
\end{equation*}


All the best,

Timothy



Suggestion : Option enabling LaTeX blocks to non-latex exporters.

2021-07-18 Thread Emmanuel Charpentier
Dear list,

"raw" LaTeX can already be successfully exported by some exporters :
both html and odt exporters can translate (a limited subset of) such
latex expressions in something palatable to their respective targets
(Mathjax and representation MathML respectively).

This does *not* apply to LaTeX marked as such. To be clear :

babble babble $\int_a^b f(x) dx$ noise noise

will export the math expression to  html and odt (if tex:t or
tex:dvipng or tex:dvisvgm) ; on the other hand

babble babble @@latex:$\int_a^b f(x) dx$@@ noise noise

will not. Neither will :

#+latex: \[\Phi_{\mu, \sigma}(x) = 
\frac{e^-{\frac{(x-\mu)^2}{2\sigma^2}}}{\sigma\sqrt{2\pi}}\,.\]

nor :

#+begin_export latex
\[\Phi_{\mu, \sigma}(x) = 
\frac{e^-{\frac{(x-\mu)^2}{2\sigma^2}}}{\sigma\sqrt{2\pi}}\,.\]
#+end_export

This has an annoying consequence : a function cannot (easily) return a
LaTeX block. One can return a raw result, but this loses the link
between the function and its result(s).

John Kitchin has suggested
(https://lists.gnu.org/archive/html/emacs-orgmode/2021-07/msg00099.html)
 to wrap raw latex code in a drawer ; this works, but I am unable to
understand how, and I do not know what are the consequences.

Having an option allowing latex code marked as such to be passed to
other exporters (possibly with conversion) would allow a "cleaner"
solution.

What do you think ?

--
Emmanuel Charpentier



org.texi and po4a

2021-07-18 Thread Jean-Christophe Helary
It looks like po4a can't convert org.texi to the PO format.

$ po4a-gettextize -f texinfo -M utf8 -m org.texi -p org.texi.fr.po

→ Complex regular subexpression recursion limit (32766) exceeded at 
/opt/local/lib/perl5/5.26/Locale/Po4a/TeX.pm line 697.

I don't suppose that there are issues with the texi itself, it looks like the 
texi conversion in po4a is a bit weak, but it would be awesome if somebody 
could check if there is something that could be simplified (org.texi is the 
*only* manual in the whole emacs distribution that faults at the conversion).

-- 
Jean-Christophe Helary @brandelune
https://mac4translators.blogspot.com
https://sr.ht/~brandelune/omegat-as-a-book/




Re: Comments break up a paragraph when writing one-setence-per-line

2021-07-18 Thread Maxim Nikulin

On 16/07/2021 23:06, William Denton wrote:

#+begin_src org

In this paragraph I introduce an idea.
# Here is something I'm not sure about yet.
But I am sure about this.
And here is my conclusion.

#+end_src org

When this is exported, it becomes two paragraphs, as though the 
commented line was a blank line.  This was unexpected, because to me 
this is one paragraph with one sentence hidden.


People who write one-sentence-per-line, have you had this problem, and 
if so how did you handle it?


This is unexpected and inconvenient for me as well. However it may be 
considered consistent with


https://orgmode.org/worg/dev/org-syntax.html#Paragraphs

Empty lines and other elements end paragraphs.


I do not write one-sentence-per-line, but I do not think it matters at 
all. As a workaround I can suggest the following hack


#+macro: comment

Another test
{{{comment(some text
)}}} with macro comment.