Re: [bug?] org-link-set-parameters: when `:display 'full', link face is applied only in description part

2021-06-06 Thread Juan Manuel Macías
Juan Manuel Macías writes:

> To simplify what I mentioned in my previous message, the bug is simply
> reproducible with any link, when running `org-toggle-link-display'.
>
> I'm not sure, but I would say it was introduced in the commit:
>
> 8bdcf51ac lisp/org.el: Update previews correctly when color chnages

I correct myself. I think the commit where this problem was introduced is:

979e82fc3  Make sure that headline faces take precedence

Best regards,

Juan Manuel 



Re: [BUG] LaTeX: verbatim cannot be used in caption

2021-06-06 Thread Nicolas Goaziou
Hello,

Timothy  writes:

> In exactly the same vein as
> https://orgmode.org/list/87mtujfj8k@tecosaur.com/, verbatim text in
> captions is very problematic with LaTeX (breaks compilation).
>
> I'd like to be submitting a patch instead of a bug, but I'm not sure
> what the best method of addressing this within ox-latex.el is.
> Do share if you have any ideas :)

I guess the solution is like the problem you mentioned above. You can
create a temporary back-end that exports code and verbatim objects
as \textt, using `org-latex--protect-texttt' function.

The calls to `org-export-data' at the end of
`org-latex--caption/label-string' can use this back-end instead.

I think it would be better to derive current back-end instead of `latex'
like we did in `org-latex-headline'. You can get current back-end with
(plist-get info :back-end).

HTH,
-- 
Nicolas Goaziou



Re: [PATCH] Allow LaTeX reference command (\ref) to be customised

2021-06-06 Thread Bruce D'Arcus
+1

On Sun, Jun 6, 2021, 2:19 PM Timothy  wrote:

> Hi All,
>
> I've started doing some more cross-referencing in documents exported to
> LaTeX, and a hardcoded use of \ref has begun to stand out to me as a
> rather annoying thing. Hypperef provides \autoref for adding helpful
> prefixes (section, figure, etc.), and there are other packages which one
> may want to use to generate 'clever' references (like cleveref with
> \cref).
>
> As such, I think that the hardcoded \ref should actually be turned into
> a customisable format string, which is what the attached patch does.
>
> --
> Timothy
>
>


Re: [PATCH] Allow LaTeX reference command (\ref) to be customised

2021-06-06 Thread Juan Manuel Macías
Hi Timothy,

Timothy writes:

> I've started doing some more cross-referencing in documents exported to
> LaTeX, and a hardcoded use of \ref has begun to stand out to me as a
> rather annoying thing. Hypperef provides \autoref for adding helpful
> prefixes (section, figure, etc.), and there are other packages which one
> may want to use to generate 'clever' references (like cleveref with
> \cref).
>
> As such, I think that the hardcoded \ref should actually be turned into
> a customisable format string, which is what the attached patch does.

I think it's a great idea. There are many options in LaTeX to manage
cross references, beyond the standar \ref. I use the varioref package a
lot (https://www.ctan.org/pkg/varioref).

Best regards,

Juan Manuel 



[BUG] LaTeX: verbatim cannot be used in caption

2021-06-06 Thread Timothy
Hi All,

In exactly the same vein as
https://orgmode.org/list/87mtujfj8k@tecosaur.com/, verbatim text in
captions is very problematic with LaTeX (breaks compilation).

I'd like to be submitting a patch instead of a bug, but I'm not sure
what the best method of addressing this within ox-latex.el is.
Do share if you have any ideas :)

--
Timothy



[PATCH] Allow LaTeX reference command (\ref) to be customised

2021-06-06 Thread Timothy
Hi All,

I've started doing some more cross-referencing in documents exported to
LaTeX, and a hardcoded use of \ref has begun to stand out to me as a
rather annoying thing. Hypperef provides \autoref for adding helpful
prefixes (section, figure, etc.), and there are other packages which one
may want to use to generate 'clever' references (like cleveref with
\cref).

As such, I think that the hardcoded \ref should actually be turned into
a customisable format string, which is what the attached patch does.

--
Timothy

>From db01398de3a29043dbb545ee66006b0b7c0f1368 Mon Sep 17 00:00:00 2001
From: TEC 
Date: Mon, 7 Jun 2021 02:13:18 +0800
Subject: [PATCH] ox-latex: Allow reference command to be customised

* lisp/ox-latex.el (org-latex-reference-command): Create a new variable
so the user may modify the reference command used.
(org-latex-link): Make use of the new `org-latex-reference-command' when
generating references for labels without a description (previously using
\ref).
(org-latex-prefer-user-labels): Mention the new
`org-latex-reference-command' when describing the generated LaTeX
referencing labels.
---
 lisp/ox-latex.el | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index c761cfd7f..940800750 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -381,6 +381,9 @@ (defcustom org-latex-prefer-user-labels nil
   This is section \\ref{sec:foo}.
   And this is still section \\ref{sec:foo}.
 
+A non-default value of `org-latex-reference-command' will change the
+command (\\ref by default) used to create label references.
+
 Note, however, that setting this variable introduces a limitation
 on the possible values for CUSTOM_ID and NAME.  When this
 variable is non-nil, Org passes their value to \\label unchanged.
@@ -400,6 +403,18 @@ (defcustom org-latex-prefer-user-labels nil
   :version "26.1"
   :package-version '(Org . "8.3"))
 
+(defcustom org-latex-reference-command "\\ref{%s}"
+  "Format string that takes a reference to produce a LaTeX reference command.
+
+The reference is a label such as sec:intro.  A format string of \"\\ref{%s}\"
+produces numbered references and will always work.  It may be desirable to make
+use of a package such as hyperref or cleveref and then change the format string
+to \"\\autoref{%s}\" or \"\\cref{%s}\" for example."
+  :group 'org-export-latex
+  :type 'string
+  :version "28.1"
+  :package-version '(Org . "9.5"))
+
  Preamble
 
 (defcustom org-latex-default-class "article"
@@ -2608,7 +2623,7 @@ (defun org-latex-link (link desc info)
 	   (let ((label (org-latex--label destination info t)))
 	 (if (and (not desc)
 		  (org-export-numbered-headline-p destination info))
-		 (format "\\ref{%s}" label)
+		 (format org-latex-reference-command label)
 	   (format "\\hyperref[%s]{%s}" label
 		   (or desc
 			   (org-export-data
@@ -2616,7 +2631,7 @@ (defun org-latex-link (link desc info)
   ;; Fuzzy link points to a target.  Do as above.
 	  (otherwise
 	   (let ((ref (org-latex--label destination info t)))
-	 (if (not desc) (format "\\ref{%s}" ref)
+	 (if (not desc) (format org-latex-reference-command ref)
 	   (format "\\hyperref[%s]{%s}" ref desc)))
  ;; Coderef: replace link with the reference name or the
  ;; equivalent line number.
-- 
2.31.1



[PATCH] html export: remove W3C warning, improve accessibility

2021-06-06 Thread Timothy
Hi All,

Following on from my comments /ages/ ago, I have done some more work to
improve the HTML export. I intend to push it if I don't hear any
complaints. Please let me know if anything looks dodgy, or if anything
should also be improved with this patch :)

This patch:
- Resolves a W3C warning about type="text/css" in 

[PATCH] Change default latex compiler to latexmk

2021-06-06 Thread Timothy
Hey all,

>From the earlier discussion on this, I got feeling a consensus had
reached that this is a good idea, as long as we check that latexmk is
available first.
As such, here is a patch changing the default LaTeX compiler to latexmk
--- as long as it's available. For what it's worth I've been using this
exact command in my personal config for months now, and it's worked
excellently.

--
Timothy

>From 95806243e40d5f9f19a8db71e2b8b0cd0c5fdb68 Mon Sep 17 00:00:00 2001
From: TEC 
Date: Mon, 7 Jun 2021 00:46:09 +0800
Subject: [PATCH] ox-latex: Change default compiler to latexmk

* lisp/ox-latex.el (org-latex-pdf-process): Check for the presence of
latexmk when setting the default, and use it when available.  Fall back
to the current default.  This is important for the incoming citation
support, as PDF generation will now need to involve bibliography
generation.  By using latexmk this is taken care of for us.  The -%latex
part of the command is slightly hacky, but allows latexmk to behave more
intelligently for non-pdflatex options.  Note that latexmk also seems to
care about the order of the arguments.
---
 lisp/ox-latex.el | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 9724b0d87..c761cfd7f 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1165,9 +1165,11 @@ (defcustom org-latex-bib-compiler "bibtex"
   :package-version '(Org . "9.0"))
 
 (defcustom org-latex-pdf-process
-  '("%latex -interaction nonstopmode -output-directory %o %f"
-"%latex -interaction nonstopmode -output-directory %o %f"
-"%latex -interaction nonstopmode -output-directory %o %f")
+  (if (executable-find "latexmk")
+  '("latexmk -f -pdf -%latex -interaction=nonstopmode -output-directory=%o %f")
+'("%latex -interaction nonstopmode -output-directory %o %f"
+  "%latex -interaction nonstopmode -output-directory %o %f"
+  "%latex -interaction nonstopmode -output-directory %o %f"))
   "Commands to process a LaTeX file to a PDF file.
 
 This is a list of strings, each of them will be given to the
@@ -1211,7 +1213,7 @@ (defcustom org-latex-pdf-process
 	  (const :tag "texi2dvi"
 		 ("cd %o; LATEX=\"%latex\" texi2dvi -p -b -V %b.tex"))
 	  (const :tag "latexmk"
-		 ("latexmk -g -pdf -pdflatex=\"%latex\" -outdir=%o %f"))
+		 ("latexmk -f -pdf -%latex -interaction=nonstopmode -output-directory=%o %f"))
 	  (function)))
 
 (defcustom org-latex-logfiles-extensions
-- 
2.31.1



Re: [org-cite] request for coding help on a capf to insert citation key

2021-06-06 Thread Bruce D'Arcus
One other idea, Nicolas:

Is there room to include a org-cite somehow, so that one had a defcustom like:

(setq org-cite-complete-key-candidates my-candidates)
;; here override default with results from my package
(setq my-candidates (bibtex-actions--get-candidates))

... and default could be some simple thing in oc-basic?

If not, totally fine of course, but I thought I'd mention it as I'm
trying to figure this out.

Bruce

On Sat, Jun 5, 2021 at 5:14 PM Bruce D'Arcus  wrote:
>
> Round 2, which should address the "regex" todo.
>
> --8<---cut here---start->8---
> (defun bibtex-actions-complete-key-at-point-oc ()
> "Complete org-cite citation key at point.
>
> When inserting '@' in a buffer the capf UI will present user with
> a list of entries, from which they can narrow against a string
> which includes title, author, etc., and then select one.  This
> function will then return the key 'key', resulting in '@key' at
> point."
> ;; FIX exit-function is wrong; results in "no match"
>   (when (and (eq major-mode 'org-mode)
>  (eq (car (org-element-context)) 'citation))
> (let* ((candidates (bibtex-actions--get-candidates))
>(begin (save-excursion (backward-word) (point)))
>(end (point)))
>   (list begin end candidates :exclusive 'no
> :exit-function
> (lambda (chosen status)
>   (when (eq status 'finished)
> (cdr (assoc chosen candidates
> --8<---cut here---end--->8---



Re: [org-cite, oc-basic] Citation disambiguation

2021-06-06 Thread András Simonyi
Thanks, this was the case, now the basic processor disambiguates the citations.

On Sun, 6 Jun 2021 at 14:19, Bruce D'Arcus  wrote:
>
> I believe he rebased it and modified the history? So same branch.
>
> On Sun, Jun 6, 2021, 7:36 AM András Simonyi  wrote:
>>
>> Dear All,
>>
>> On Fri, 4 Jun 2021 at 23:06, Nicolas Goaziou  wrote:
>>
>> > > I think some kind of disambiguation strategy should be implemented for
>> > > the basic citation backend to be really usable with the author-year
>> > > style. WDYT?
>> >
>> > Implemented in latest wip-cite-new branch.
>> >
>> > Regards,
>>
>> Thanks, this is amazing! I was trying to look into it, but the latest
>> commit I see at
>> https://code.orgmode.org/bzg/org-mode/commits/wip-cite-new is from a
>> week ago. Is there a different location from which I can pull this
>> update?
>>
>> thanks again,
>> András
>>



Re: [org-cite, oc-basic] Citation disambiguation

2021-06-06 Thread Bruce D'Arcus
I believe he rebased it and modified the history? So same branch.

On Sun, Jun 6, 2021, 7:36 AM András Simonyi 
wrote:

> Dear All,
>
> On Fri, 4 Jun 2021 at 23:06, Nicolas Goaziou 
> wrote:
>
> > > I think some kind of disambiguation strategy should be implemented for
> > > the basic citation backend to be really usable with the author-year
> > > style. WDYT?
> >
> > Implemented in latest wip-cite-new branch.
> >
> > Regards,
>
> Thanks, this is amazing! I was trying to look into it, but the latest
> commit I see at
> https://code.orgmode.org/bzg/org-mode/commits/wip-cite-new is from a
> week ago. Is there a different location from which I can pull this
> update?
>
> thanks again,
> András
>
>


Re: [org-cite, oc-basic] Citation disambiguation

2021-06-06 Thread András Simonyi
Dear All,

On Fri, 4 Jun 2021 at 23:06, Nicolas Goaziou  wrote:

> > I think some kind of disambiguation strategy should be implemented for
> > the basic citation backend to be really usable with the author-year
> > style. WDYT?
>
> Implemented in latest wip-cite-new branch.
>
> Regards,

Thanks, this is amazing! I was trying to look into it, but the latest
commit I see at
https://code.orgmode.org/bzg/org-mode/commits/wip-cite-new is from a
week ago. Is there a different location from which I can pull this
update?

thanks again,
András