Re: Bug: unexpected behavior of nesting braces when exporting to LaTeX

2021-08-22 Thread Jeremie Juste


Hello Yue,


On Friday, 20 Aug 2021 at 00:45, Chlo De wrote:

> \emph{{n+1}-a}
> \textit{a{b}c}
>
> will be translated as LaTeX expressions
>
> \emph\{\{n+1\}-a\}
> \textit\{a\{b\}c\}

I'm not sure it is a bug. Could you specify what do you expect in these
cases?


Note that there are native org-syntax for \emph and \textbf

*n+1 - a* 
/a{b}c/

(info "(org) Emphasis and Monospace")

HTH,
-- 
Jeremie Juste



Issues with the hanging package used by org-cite

2021-08-22 Thread Timothy
Hi All,

I’ve come across an issue with the `hanging' package we’re currently using for
LaTeX exports — it also affects punctuation, and makes `,.'"`?!:;' active
characters throughout the entire document. That means a LaTeX snippet like:
┌
│ \(f'(x)\)
└

Will now fail to compile ☹. See

for more information.

Looking at , I think it might be 
possible
to achieve the same effect just by using `\parshape'. This seems like a much 
safer
approach if it could work, and I’m also a fan of one less package being needed.

All the best,
Timothy


Testing if a scheduled date is prior to another date

2021-08-22 Thread Tim Landscheidt
Hi,

in a capture template, I want to test whether the scheduled
date for a specific task is prior to another, calculated
date (and depending on the answer, insert a checkbox or
not).

I can get the scheduled date for the task by:

| (with-current-buffer (find-file-noselect "/path/to/file.org")
|   (save-mark-and-excursion
| (goto-char
|  (org-find-entry-with-id "TASK_ID"))
| (org-element-property ':scheduled (org-element-at-point

which returns a structure like:

| (timestamp
|  (:type active
|   :raw-value "<2021-08-30 Mo 08:00 .+4d>"
|   :year-start 2021
|   :month-start 8
|   :day-start 30
|   :hour-start 8
|   :minute-start 0
|   :year-end 2021
|   :month-end 8
|   :day-end 30
|   :hour-end 8
|   :minute-end 0
|   :begin 436166
|   :end 436192
|   :post-blank 0
|   :repeater-type restart
|   :repeater-value 4
|   :repeater-unit day))

However, comparing this value with org-time< & Co. is futile
as org-2ft always returns 0.

Before I wade through the various functions to build a con-
version chain, what is the best practice to compare time-
stamp values with dates?  (And if there is an org-mode func-
tion that checks if the task at point is scheduled prior to
another date, I'd appreciate pointers as well :-).)

TIA,
Tim




Re: S-M-{,} on CLOCK timestamp

2021-08-22 Thread Jorge P . de Morais Neto
Hello Tim!

Em [2021-08-22 dom 11:21:47+1000], Tim Cross escreveu:

> I cannot reproduce this.
>
> When I do the same, I don't see any change in Task A's timestamp at all.
> There must be some other setting in play here which I don't have.

I am sorry, my description of the initial condition was incomplete.  To
reproduce the problem, you cannot simply copy the provided text to an
Org buffer.  You should create the clock timestamps with actual clocking
commands.  So please do the following:

1. In an Org buffer, create an outline containing ~Task A~ and ~Task B~:

   --8<---cut here---start->8---
   * Task A

   * Task B
   --8<---cut here---end--->8---

2. Clock into Task A by moving point to it and typing C-c C-x C-i.
3. Clock into Task B by moving point to it and typing C-c C-x C-i.
4. Increase the minutes part of task B's clock-in timestamp via C-u 42
   S-¹.  The ~42~ numeric prefix is just an example; please choose
   the numeric prefix argument so that:
   1. It is at least 5
   2. The resulting time in the timestamp is *not* a multiple of 5 min.
5. If the minutes part of task A's clock out time is not already a
   multiple of 5, then hit S-¹ (no prefix argument) to make it so.
6. Now you can reproduce the problem.

¹ When you are about to type S- to adjust the minutes part of a
clock timestamp, make sure point is in the minutes part you want to
adjust.  I usually place point right after the colon that separates HH
from MM.

Regards!

-- 
- Disinformation flourishes because many people care about injustice but
  very few check the facts.  Ask me about 
- Please adopt free/libre formats like PDF, ODF, Org, LaTeX, Opus, WebM and 7z.
- Free/libre software for Replicant, LineageOS and Android: https://f-droid.org
- https://www.gnu.org/philosophy/free-sw.html "What is free software?"



Re: Bug: unexpected behavior of nesting braces when exporting to LaTeX

2021-08-22 Thread Jeremie Juste
Hello Yue,

Posting your mail below back to the list where you have a better chance
of getting the right explanation. I totally understand that many times
copy directly latex chunk is a nice feature org-mode offers.

>From your example below, exporting the following script to latex would
work ok in org-mode.

#+BEGIN_SRC org
#+options: toc:nil
#+LATEX_HEADER: \usepackage{amsthm}
#+LATEX_HEADER:\theoremstyle{theorem}
#+LATEX_HEADER: \newtheorem{theorem}{Theorem}\usepackage{setspace}
#+end_src

* Theorem

 The longest word in this sentence is \emph{emphasized}.
 \begin{theorem}
   An emphasized a word looks \emph{distinguished}.
 \end{theorem}

Yes, for my part I usually wrap into a source block, if I need native
latex syntax

#+BEGIN_SRC latex
\emph{{n+1}-a}
\textit{a{b}c}
#+end_src

I don't know if it is the case by design or if it is a bug.

HTH,
Jeremie


On Sunday, 22 Aug 2021 at 09:03, Chlo De wrote:
> Hello Jeremie,
>
> Thank you for your reply. 
>
> As both \emph and \textit are commonly used LaTeX commands, I would
> expect everything inside the braces be interpreted in LaTeX way, i.e.,
> plain { }  are for semantic use only and are omitted in the output.
>
> I appreciate that you mentioned native org-syntax. There are two reasons
> that I prefer the LaTeX way. 
> - I sometimes need to copy large chunk of tex contents from my other
> notes or papers. It would be easier if I don’t need to convert them one
> by one, as it is hard to spot such a thing in a long document.
> - \emph is not exactly \textbf or \textit. With its default definition,
> in text, \emph behaves like \textit. However, in an environment where the
> text is italic by default, say, theorem, \emph will turn the text into
> normal font. Here is a minimal example.
> \documentclass{article}
> \usepackage{amsthm}
> \theoremstyle{theorem}
> \newtheorem{theorem}{Theorem}
>
> \begin{document}
>  The longest word in this sentence is \emph{emphasized}.
>  \begin{theorem}
>An emphasized a word looks \emph{distinguished}.
>  \end{theorem}
> \end{document}
>
> The output is
>
> [cid]
>
> Besides, this question seems related 
> https://emacs.stackexchange.com/questions/52510/not-scape-braces-in-latex-org-mode
>
> Best,
> Yue
>
> On Aug 22, 2021, at 03:27, Jeremie Juste 
> wrote:
>
> Hello Yue,
>
> On Friday, 20 Aug 2021 at 00:45, Chlo De wrote:
>
> \emph{{n+1}-a}
> \textit{a{b}c}
>
> will be translated as LaTeX expressions
>
> \emph\{\{n+1\}-a\}
> \textit\{a\{b\}c\}
>
> I'm not sure it is a bug. Could you specify what do you expect in
> these
> cases?
>
> Note that there are native org-syntax for \emph and \textbf
>
> *n+1 - a*
> /a{b}c/
>
> (info "(org) Emphasis and Monospace")
>
> HTH,
> --
> Jeremie Juste
>

-- 
Jeremie Juste



Bug: inconsistent handling of empty duration cells in table [9.4.6 (9.4.6-12-gdcc3a8-elpa @ /home/jet/.config/emacs/elpa/org-20210816/)]

2021-08-22 Thread Jeff Trull
When calc formulas producing empty strings are evaluated in the default
mode, an empty cell is produced. When evaluated in duration mode (U, T,
or t) a zero duration is produced. I feel the behavior should be
consistent with the number formats, producing a empty value instead of a
zero.

Test case:

| case |   result |
|--+--|
| default mode |  |
| default + E  |  |
| U + E|00:00 |
| T + E| 00:00:00 |
| t + E| 0.00 |
#+TBLFM: @2$2=string("")::@3$2=string("");E::@4$2=string("");EU::@5
$2=string("");ET::@6$2=string("");Et


Analysis: the problem (if it is a problem) is here:
https://code.orgmode.org/bzg/org-mode/src/master/lisp/org-table.el#L2616
The value produced for durations always comes from a call to
string-to-number, which returns 0 for empty strings.
org-table-time-seconds-to-string turns that into a zero duration
string in the requested format. An explicit test for an empty value here
fixes the issue.



Emacs  : GNU Emacs 27.1.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
2.24.32, cairo version 1.16.0)
 of 2020-09-01
Package: Org mode version 9.4.6 (9.4.6-12-gdcc3a8-elpa @
/home/jet/.config/emacs/elpa/org-20210816/)

current state:
==
(setq
 org-duration-format 'h:mm
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-latex-listings t
 org-link-shell-confirm-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-html-format-inlinetask-function
'org-html-format-inlinetask-default-function
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-export-creator-string "Emacs 27.1.50 (Org mode 9.4.5)"
 org-mode-hook '((closure
  (org--rds reftex-docstruct-symbol org-with-time
org-defdecode org-def
   org-read-date-inactive org-ans2 org-ans1
org-columns-current-fmt-compiled
   org-end-time-was-given org-time-was-given
org-blocked-by-checkboxes org-state
   org-agenda-headline-snapshot-before-repeat
org-struct-menu org-last-state
   org-id-track-globally texmathp-why remember-data-file
iswitchb-temp-buflist
   align-mode-rules-list org-id-overriding-file-name
   org-indent-indentation-per-level ffap-url-regexp
org-inlinetask-min-level t)
  nil (add-hook 'change-major-mode-hook 'org-show-all
'append 'local))
 (closure (*this* org-babel-confirm-evaluate-answer-no t)
nil
  (add-hook 'change-major-mode-hook
'org-babel-show-result-all 'append 'local))
 (closure (org-table-tab-recognizes-table\.el t) nil
  (setq imenu-create-index-function 'org-imenu-get-tree))
 #[0 "\301\211 \207" [imenu-create-index-function
org-imenu-get-tree] 2]
 org-bullets-mode org-tempo-setup (lambda nil
(electric-indent-local-mode -1))
 #[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-show-all append
local] 5]
 #[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook
org-babel-show-result-all append local] 5]
 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-bibtex-headline-format-function #[257 "\300 \236A\207" [:title] 3
"\n\n(fn ENTRY)"]
 org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
 org-babel-pre-tangle-hook '(save-buffer)
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
 org-babel-load-languages '((emacs-lisp . t) (dot . t) (ditaa . t))
 org-export-backends '(ascii html icalendar latex md confluence re-reveal)
 org-html-creator-string "https://www.gnu.org/software/emacs/\";>Emacs
27.1.50 (https://orgmode.org\";>Org mode 9.4.5)"
 org-ascii-format-drawer-function #[771 " \207" [] 4 "\n\n(fn NAME CONTENTS
WIDTH)"]
 org-agenda-loop-over-headlines-in-active-region nil
 org-occur-hook '(org-first-headline-recenter)
 org-ditaa-jar-path "/usr/share/ditaa/ditaa.jar"
 org-structure-template-alist '(("n" . "notes") ("a" . "export ascii") ("c"
. "center")
("C" . "comment") ("e" . "example") ("E" .
"export")
("h" . "export html") ("l" . "export
latex") ("q" . "quote")
("s" . "src") ("v" . "verse"))
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
  org-cycle-show-empty-lines
org-optimize-window-after-visibility-change)
 org-speed-command-hook '(org-speed-command-activate
org-babel-speed-command-activate)
 org-export-before-parsing-hook '(org-attach-expand-link

Re: Bug: File variable no longer on first line when running org-id-get-create [9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/)]

2021-08-22 Thread Tim Cross


I would argue this is an org-roam bug rather than an org bug and so
needs to be reported to the org-roam maintainers.

org-roam is not part of org mode.

Peter Prevos  writes:

> Hi, I use file variables on the first line of some Org mode files to indicate
> the local Flyspell dictionary, e.g.:
>
> -*- mode: org; ispell-local-dictionary: "nederlands" -*-
>
> This line sets the dictionary to Dutch for this file only.
>
> This is useful functionality that allows me to indicate the language of files
> other than my default language.
>
> It works great, except when I need to add an ID for use in Org-Roam using the
> org-id-get-create function.
>
> The new drawer is placed on the first line of the buffer, so the local 
> variable
> declaration moves down and is as such no longer recognised as it is expected 
> on
> line 1. (File variable documentation: 
> https://www.gnu.org/software/emacs/manual/html_node/emacs/Specifying-File-Variables.html)
>
> There is an ugly workaround by placing file variables at the end of the file, 
> as
> documented in the linked page.
>
> Regards
>
> P:)




Re: Internal link broken when publishing (was org-id with ox-html)

2021-08-22 Thread inkbottle
Links between two different files, like 
`[[id:e54113f9-2ad7-4a86-94be-68ffc696de0b][hello]]`, get broken when 
publishing. (whatever the settings).

I haven't found any workaround.

Being able to move around entries, functionality provided by `org-id-link-to-
org-use-id`, is pivotal, IMO.






Re: Bug: File variable no longer on first line when running org-id-get-create [9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/)]

2021-08-22 Thread Ihor Radchenko
Peter Prevos  writes:

> -*- mode: org; ispell-local-dictionary: "nederlands" -*-
>
> It works great, except when I need to add an ID for use in 
> Org-Roam using the org-id-get-create function.

To make it work, convert the local-var line into proper comment. Just as
you would do in any other source code file:

# -*- mode: org; ispell-local-dictionary: "nederlands" -*-
:PROPERTIES:
:ID:   a60f6a47-9db9-49d6-ac00-307c7a84e43d
:END:

When you just have the line below, it is treated as ordinary paragraph
by Org, thus the property drawer is indeed inserted before:

:PROPERTIES:
:ID:   a60f6a47-9db9-49d6-ac00-307c7a84e43d
:END:
-*- mode: org; ispell-local-dictionary: "nederlands" -*-

Best,
Ihor