Search and replace excluding code blocks?

2024-01-29 Thread Vikas Rawal
Hi all,

Is it possible to search and replace a regex/string in an org file
excluding the code blocks from its scope?

Say, I want to replace all opening quotes (") by backticks(``) in the text
but not in the code blocks. Is there a way one could achieve that?

Thanks,

Vikas


Re: Regression in latex export of tables?

2023-11-02 Thread Vikas Rawal
On 03/11/2023 07:58, Vikas Rawal wrote:
> Earlier version gives me this:
> \begin{center}
> \begin{tabular}{ll}
> (a,b) & open interval\\\empty
> [0,1] & closed interval\\\empty

It was changed to avoid your inconvenience:
https://list.orgmode.org/874jw2conh@posteo.net/T/#uOh, wow! Thank you all 
for having been so considerate of needs of even individual users like this. I 
did not notice this.
Org mode community does not cease to amaze me. 
> (defun org-export-midrule-filter-latex (row backend info)
>   (replace-regexp-in-string
> "\\(\\([[:blank:]]+\\&\\)+\\)[[:blank:]]" "midrule" row))
>
> Now my \midrule becomes \midrule[0pt].

Sorry, but your have to adjust the pattern and the replacement string to
allow either optional \empty or [0pt].Done

Thank you once again.

Vikas
 


Re: Regression in latex export of tables?

2023-11-02 Thread Vikas Rawal

On Thursday, November 02, 2023 14:59 IST, "Fraga, Eric"  
wrote:
 On Wednesday, 1 Nov 2023 at 19:04, Vikas Rawal wrote:
> I am sorry, but I do not understand what are you pointing at. This is
> what I get:
>
> 
> \begin{center}
> \begin{tabular}{ll}
> (a,b) & open interval\\[0pt]
> [0,1] & closed interval\\[0pt]
> \end{tabular}
> \end{center}
> \end{document}
> 

I think the point is that without the [0pt], the following line's [0,1]
gets interpreted as a length parameter for the line break, \\.

--
: Eric S Fraga, with org release_9.6.6-418-g294a4d in Emacs 30.0.50Earlier 
version gives me this:
\begin{center}
\begin{tabular}{ll}
(a,b) & open interval\\\empty
[0,1] & closed interval\\\empty
\end{tabular}
\end{center}
\end{document}

I have several export filters that break because of this [0pt]. For example, I 
use  in a table row (created by an R source code) to mark wherever I want 
a midrule using this:

(defun org-export-midrule-filter-latex (row backend info)
  (replace-regexp-in-string 
"\\(\\([[:blank:]]+\\&\\)+\\)[[:blank:]]" "midrule" row))

Now my \midrule becomes \midrule[0pt].

Vikas
 


Re: Regression in latex export of tables?

2023-11-01 Thread Vikas Rawal

On 01/11/2023 10:43, Vikas Rawal wrote:
> Both give this strage [0pt] at the end of every line of the table.
>
> ​​Is this by design? This seems to be something recent. Am I missing
> something.

If you believe that it is a regression then try to export something like

| (a,b) | open interval |
| [0,1] | closed interval |

https://list.orgmode.org/?q=%5B0pt%5D

 
I am sorry, but I do not understand what are you pointing at. This is what I 
get:


\begin{center}
\begin{tabular}{ll}
(a,b) & open interval\\[0pt]
[0,1] & closed interval\\[0pt]
\end{tabular}
\end{center}
\end{document}


What is this [0pt] at the end?

 


Re: Regression in latex export of tables?

2023-11-01 Thread Vikas Rawal
I am seeing a peculiar problem, and I would appreciate if somebody could check 
whether this is a bug or I am missing something.

The following table exports with a [0pt] at the end of each line.I can confirm 
that the problem disappears if I move to the following version of org-mode:

commit bed47b437d8cde7a98bafdb07996e248b40f70e6 (HEAD -> main, origin/main)
Author: Rudolf Adamkovič 
Date:   Fri Oct 21 14:48:56 2022 +0200

Clearly, the problem has appeared more recently than this.

Vikas
 


Regression in latex export of tables?

2023-10-31 Thread Vikas Rawal

Hi all,

I am seeing a peculiar problem, and I would appreciate if somebody could check 
whether this is a bug or I am missing something.

The following table exports with a [0pt] at the end of each line.

* Test
| A | B | C |
|---+---+---|
| 1 | 2 | 3 |
|   |   |   |


\section{Test}
\label{sec:orgb720d02}
\begin{center}
\begin{tabular}{rrr}
A & B & C\\[0pt]
\hline
1 & 2 & 3\\[0pt]
 &  & \\[0pt]
\end{tabular}
\end{center}
\end{document}

I have tried this by running emacs -q (to check if something in my config was 
messing up). With emacs -q, my org-version is: Org mode version 9.6.7 
(release_9.6.7-13-g99cc96)
​​​If I use my .emacs.d, my org-version is: Org mode version 9.7-pre 
(release_9.6.10-906-gee0961

Both give this strage [0pt] at the end of every line of the table.

​​Is this by design? This seems to be something recent. Am I missing 
something.

Thanks,

Vikas


Re: LaTeX export for Org Mode Documents written in Indic Languages

2023-01-07 Thread Vikas Rawal
>
>
> I have an Org file with some of my
> transcriptions (because of Emacs's awesome language support) but I am
> unable to org-export these files to pdf. I suppose I must install some
> latex packages, but I have not been able to find any documentation for
> the same. I dont really know latex, I mainly just use it for Org pdf
> export.
>
>
I had once written a blog post (from 2012) describing steps for writing and
exporting devanagari which is still available at:
https://web.archive.org/web/20131201063324/http://agrarianresearch.org/blog/?p=563
Since this is old, you may have to see how much of it still works.

Key excerpt from a recent org file which combined english and devanagari:

#+LATEX_HEADER: \usepackage{fontspec,xltxtra}
#+LATEX_HEADER: \usepackage{polyglossia}
#+LATEX_HEADER: \usepackage[Latin,Devanagari]{ucharclasses}
#+LATEX_HEADER: \setmainfont[Ligatures=TeX,Scale=1.0454]{Minion Pro}
#+LATEX_HEADER:
\newfontfamily{\defaultfont}[Ligatures=TeX,Scale=1.0454]{Minion Pro}
#+LATEX_HEADER: \newfontfamily{\devanagarifont}[Scale=0.9]{Lohit Devanagari}
#+LATEX_HEADER: \setdefaultlanguage{english}
#+LATEX_HEADER: \setotherlanguage{devanagari}
#+LATEX_HEADER: \setDefaultTransitions{\defaultfont}{}
#+LATEX_HEADER: \setTransitionTo{devanagari}{\devanagarifont}
#+LATEX_HEADER: \setTransitionFrom{devanagari}{\defaultfont}
#+LATEX_HEADER: \setTransitionsForLatin{\defaultfont}{}
#+LATEX_HEADER: \setTransitionTo{Devanagari}{\devanagarifont}
#+LATEX_HEADER: \setTransitionsForDevanagari{\devanagarifont}{}

Note that I used Minion Pro for English and Lohit Devanagari for Hindi. You
may have to check what fonts are installed on your system, and modify these
accordingly.

And I have this in my emacs config, which allows me to use arabic numbers
with devanagari script (since I don't want to use devanagari numbers even
when I am writing devanagari):

;; Function to mix Devanagari with Arabic numbers

(require 'ind-util)

;; based on:
;;
https://github.com/emacs-mirror/emacs/blob/30c09955f64815201ae9b86215fed8ea2af0ba66/lisp/language/ind-util.el#L464
(defun indian-make-hash-without-digits (table trans-table)
  "Indian Transliteration Hash for decode/encode"
  (let* ((encode-hash (make-hash-table :test 'equal))
 (decode-hash (make-hash-table :test 'equal))
 (hashtbls (cons encode-hash decode-hash))
 (vowels (elt table 0))
 (consonants (elt table 1))
 (misc   (elt table 2))
 (digits (elt table 3))
 (halant (char-to-string (elt misc  4)))
 (trans-vowels (elt trans-table 0))
 (trans-consonants (elt trans-table 1))
 (trans-misc   (elt trans-table 2))
 (trans-digits  '("0" "1" "2" "3" "4" "5" "6" "7" "8" "9")))
(indian--puthash-v vowels trans-vowels hashtbls)
(indian--puthash-c consonants trans-consonants halant hashtbls)
(indian--puthash-cv consonants trans-consonants
  vowels trans-vowels hashtbls)
(indian--puthash-m misc trans-misc hashtbls)
;;(indian--puthash-m digits trans-digits hashtbls)
hashtbls))


;; based on:
;;
https://github.com/emacs-mirror/emacs/blob/30c09955f64815201ae9b86215fed8ea2af0ba66/lisp/language/ind-util.el#L486
(setq indian-dev-itrans-v5-hash-without-digits
  (indian-make-hash-without-digits indian-dev-base-table
indian-itrans-v5-table))

;; needed for the quail-define-indian-trans-package function:
;;(add-to-list 'load-path "~/emacs/lisp/leim/")
(load "leim/quail/indian.elc")
;; (load "quail/indian.el.gz")


;; based on:
;;
https://github.com/emacs-mirror/emacs/blob/30c09955f64815201ae9b86215fed8ea2af0ba66/lisp/leim/quail/indian.el#L56
(quail-define-indian-trans-package
 indian-dev-itrans-v5-hash-without-digits
"devanagari-itrans-without-digits" "Devanagari" "DevIT"
 "Devanagari transliteration by ITRANS method, with Arabic numerals.")


Table refresh very slow

2022-12-22 Thread Vikas Rawal
Org mode version 9.6 (release_9.6-126-gf731d4
GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.35,
cairo version 1.17.6) of 2022-11-18

I have noticed a new problem: tables take a long time to refresh if I
change the structure (move columns, remove columns or resize them). It is
clearly a new phenomenon (I am a heavy org user) and seems to affect files
with many tables.

Is this a known problem?

Vikas


Re: Displaying macros differently

2022-12-05 Thread Vikas Rawal
This is perfect, thank you!

On Mon, 5 Dec 2022 at 09:13, William Denton  wrote:

> On 4 December 2022, Vikas Rawal wrote:
>
> > I frequently use orgmode macros -- like {{{M(Year 1998--99)}}} -- in
> tables
> > designed for latex export. I find that the macro syntax occupies many
> > character spaces. At the very least, 9 spaces are taken up even if my
> macro
> > shortcut is just one character long. This is very difficult with wide
> > tables as often the tables go off the screen just because of this.
> >
> > I was wondering if there is a simple way of making org display the macros
> > differently. That is, use some kind of overlay, and display the above
> macro
> > may be like M:Year 1998--99. Or some special character could be used to
> > denote that there is a macro underlying what is visible here.
>
> Is this close enough?
>
> (setq org-hide-macro-markers t)
>
> That hides the {{{macro}}} curly brackets (if there's no leading space).
>
> I also have this to toggle macro visibility in the document so I can see
> them
> when I want to:
>
> #+begin_src emacs-lisp
> (defun wtd/toggle-org-macro-markers ()
>"Toggle visibility of {{{macro}}} markers"
>(interactive)
>(setq org-hide-macro-markers (not org-hide-macro-markers))
>(font-lock-mode)
>(font-lock-mode))
> #+end_src
>
> I think there's been some discussion about evaluating the macros and
> showing the
> result, but I don't think that's possible.
>
> Bill
>
> --
> William Denton
> https://www.miskatonic.org/
> Librarian, artist and licensed private investigator.
> Toronto, Canada
>


Displaying macros differently

2022-12-04 Thread Vikas Rawal
Hi everyone,

I frequently use orgmode macros -- like {{{M(Year 1998--99)}}} -- in tables
designed for latex export. I find that the macro syntax occupies many
character spaces. At the very least, 9 spaces are taken up even if my macro
shortcut is just one character long. This is very difficult with wide
tables as often the tables go off the screen just because of this.

I was wondering if there is a simple way of making org display the macros
differently. That is, use some kind of overlay, and display the above macro
may be like M:Year 1998--99. Or some special character could be used to
denote that there is a macro underlying what is visible here.

I am aware of things like org-bullets which do something like this with
headlines. But I was wondering if anyone has done this with macros.

My apologies if I have not been able to express my problem clearly.

Best wishes,

Vikas


Re: [RFC] Re: Headings and Headlines

2022-11-19 Thread Vikas Rawal
>
>
>
> I think we are needlessly complicating this. We are talking about the
> use of a term in an internal code base. While I would agree heading is
> more correct, I don't think it is such a big issue to use headline if
> that make the transition to a consistent usage easier. When it comes to
> code, I think consistency trumps correctness.
>
>
I agree. I think the original post was about inconsistency in the
documentation. We should just correct the documentation, use the word
heading consistently throughout, and mention at a prominent place that the
headline symbol is used in the code to parse headings. There is nothing
wrong with that.


Re: [RFC] Re: Headings and Headlines

2022-11-19 Thread Vikas Rawal
On Sat, 19 Nov 2022 at 19:17, Bastien Guerry  wrote:

> Ihor Radchenko  writes:
>
> > I came to the conclusion that it will, in fact, be easier to change all
> > things to use "headline"
>
> FWIW, I'm fine with such a change.  I'm not a native english speaker,
> but a "headline" sounds like it's a one-line heading, so it's okay.
>
>
I think, from a linguistic perspective, "heading" and "subheading" are more
appropriate than "headline" and "subheadline".

Vikas


Re: Tutorials on creating pdfs with org-babel and sqlite

2022-11-12 Thread Vikas Rawal
> interested in publishing use cases. Has anybody wrote a book or a report
> with org-mode, org-babel and sqlite?

Many years ago, I wrote this book with orgmode: 
https://www.fao.org/3/a-i4921e.pdf

The source files are here: https://github.com/vikasrawal/endingmalnutrition

Much has changed in orgmode since then though.

Over the years, all these documents have also been published using orgmode: 
http://indianstatistics.org/ssermonographs.html

The source files for most of these are not public. But if you are looking for a 
recent sample, I would be happy to share it.

Vikas



Re: Tutorials on creating pdfs with org-babel and sqlite

2022-11-12 Thread Vikas Rawal
> interested in publishing use cases. Has anybody wrote a book or a report
> with org-mode, org-babel and sqlite?

Many years ago, I wrote this book with orgmode: 
https://www.fao.org/3/a-i4921e.pdf

The source files are here: https://github.com/vikasrawal/endingmalnutrition

Much has changed in orgmode since then though.

Over the years, all these documents have also been published using orgmode: 
http://indianstatistics.org/ssermonographs.html

The source files for most of these are not public. But if you are looking for a 
recent sample, I would be happy to share it.

Vikas



Re: Efficiently reuse code in org babel with R

2022-07-06 Thread Vikas Rawal
Why not specify a :session so that data created by one block would remain
available to subsequent blocks?

V.

On Thu, 7 Jul 2022 at 09:10, Naresh Gurbuxani 
wrote:

> I want to source some data from databases, then use this data in various
> blocks.  I am looking for the most efficient way to achieve this.  In below
> blocks, is the code in block ``connection'' executed thrice (economy of
> code but no saving of time) or is it only executed once then used twice?
> If the code is run thrice, is there another way to create code blocks so
> that the code is executed only once?
>
> Thanks,
> Naresh
>
> #+name: connection
> #+begin_src R :exports results :results output
>   ## my code here
> #+end_src
>
> #+begin_src R :exports results :results output graphics file :file
> figures/fig1.png
> <>
> ## my code here
> #+end_src
>
> #+begin_src R :exports results output graphics file :file figures/fig2.png
> <>
> ## my code here
> #+end_src
>


Re: Links to javascript-based websites from orgmode.org: Paypal and Github

2022-07-02 Thread Vikas Rawal
>   > Bank uses free software on their system?
>
> I suppose that would depend on the bank.  It's the bank's affair.
> If the bank's software is free, the bank enjoys freedom.
> Otherwise, the nonfree software denies the bank freedom.
>
> Either way, it has no effect on us.  We are not running that software,
> so it does not deny us our freedom.
>
> I would advise any bank to insist on free software, but if it doesn't
> listen, that is the bank's loss, not ours.  I feel sorry for the bank
> for this error, but that is not a reason to boycott it.
>
>
It is amusing that you talk of a bank as if it was a person. I don't know
what it even means when you say that a bank may or may not enjoy freedom.

More seriously, it is peculiar that you do not see anything problematic in
promoting businesses of entities who rely on non-free software for their
business. Are you, in turn, not promoting non-free software then? A part of
profit the bank makes by doing business with you is shared with companies
making non-free software.



>   > Or are we to merely shift to services where nonfree software runs on
>   > somebody else's computer?
>
> Who is morally responsible for running the nonfree software is the
> most important question, but you dismiss that as an insignificant
> detail.
>

I have done no such thing, and I don't see why you should ascribe
indifference to moral issues to me. That said, I could argue quite the
opposite: that by your argument, your moral responsibility seems to end at
what software runs on your computer. There is no moral responsibility for
anything else.


>   > Go to an internet kiosk and make the payment?
>
> That is a fune way way.  However, I usually mail a check instead.  It
> doesn't require me to run any nonfree software (it doesn't use
> software at all), and I can do it from home.
>

I find this absurd. You are welcome to do what you like, and to believe
that this is somehow morally superior.

I don't see this discussion leading to anything if it is only about
personal preferences and views.

V.


Re: Links to javascript-based websites from orgmode.org: Paypal and Github

2022-06-27 Thread Vikas Rawal
>
>
>   > AFAIU, there are no nonfree payment services, except some crypto
>   > payments.
>
> In Europe, at least, there is bank transfer.  If you go to a bank
> branch, I think, you can do transfers to someone else's account without
> running any particular software.


Bank uses free software on their system?

Or are we to merely shift to services where nonfree software runs on
somebody else's computer?

Go to an internet kiosk and make the payment?

VR


Re: caption lost

2022-06-11 Thread Vikas Rawal
>
>
> #+caption: My caption
> #+label: fig:MyFigure
> #+begin_src R :exports results :results output graphics :file MyFigure.pdf
> :width 4.8 :height 6.5 :pointsize 7
> plot(1:5,1:5)
>  #+end_src
>
>
The figure is produced and integrated in the text but
>

#+CAPTION: line should be added to the output and not to the code block. As
follows.

#+CAPTION: My caption.
[[file:MyFigure.pdf]]

That is, you evaluate the code block, and once the output is created, add
caption to it.

Vikas


Re: org-fold documentation

2022-05-07 Thread Vikas Rawal
>
> These are native-comp warnings. They are not uncommon when
> native-compiling Org (not only org-fold.el) and generally harmless.
> If you are sufficiently annoyed with them, most of these warnings can be
> "fixed" by declaring the missing functions. The functions are available
> at runtime, but not during native-compilation.
>
>
I am not sure I understand fully, but are you suggesting that the problem
is because I forgot to compile org and therefore these files were being
compiled during runtime? Would running "make" solve it then? I have  done
that anyway since I was not sure if I did it earlier.

Thanks,

Vikas


>


org-fold documentation

2022-05-05 Thread Vikas Rawal
After upgrading to 9.5.3, I am getting warnings such as this, which I
suspect are due to org-fold.et.

Warning (comp): org-fold.el:834:27: Warning: Unused lexical variable
`org-hide-macro-markers' Disable showing Disable logging
Warning (comp): org.el:76:30: Warning: Package cl is deprecated Disable
showing Disable logging
Warning (comp): ox.el:79:1: Warning: the function ‘org-back-to-heading’
might not be defined at runtime. Disable showing Disable logging
Warning (comp): ox.el:79:1: Warning: the function
‘org-next-visible-heading’ might not be defined at runtime. Disable showing
Disable logging
Warning (comp): ox.el:79:1: Warning: the function ‘org-at-heading-p’ might
not be defined at runtime. Disable showing Disable logging

Is org-fold.el documented already? Any pointers to what might be causing
the above?

Thanks,

V.


Re: #+latex_header blocks, or, managing lots of LaTeX headers

2022-04-11 Thread Vikas Rawal
For a major project like this, I would just put these in a separate file,
and include it using #+INCLUDE:

Vikas


On Tue, 12 Apr 2022 at 06:37, William Denton  wrote:

> I have another question related to managing a book I'm doing building for
> export
> to LaTeX:  what do people do for managing all of the headers?
>
> I have about 30 #+latex_header lines in the project I'm working on, and
> I'm
> still just working on it as a basic article.  When I'm ready to do more
> formatting I'll use the memoir class and then there will be more
> commands.  I
> imagine some of you have huge headers with custom commands and more.
>
> It would be great if there was a way to manage these lines as LaTeX, for
> example
> in a "#+begin_export latex" block, but as far as I can tell, there isn't a
> way
> (unless once again I overlooked something).
>
> The idea came up about seven years ago, and Nicolas mentioned the
> possibility of
> a "#+begin_export latex :header t" implementation.
>
> https://lists.gnu.org/archive/html/emacs-orgmode/2015-05/msg00538.html
>
> It's possible to add a new class to the org-latex-classes variable, and in
> the
> documentation on it I see there are options ([NO-DEFAULT-PACKAGES],
> [NO-PACKAGES], [NO-EXTRA]) that allow one to trim away all the default
> headers.
> That makes it easy to take away, but not to add in lines I want, short of
> managing them in my init file.
>
> What sorts of practices do people have for managing lots of LaTeX headers?
> Juan Manuel Macías, you mentioned something like this---literate
> programming in
> Org to export LaTeX source---may I ask how you do it?
>
> Thanks,
>
> Bill
>
> --
> William Denton
> https://www.miskatonic.org/
> Librarian, artist and licensed private investigator.
> Toronto, Canada


Re: citations: org-cite vs org-ref 3.0

2022-03-27 Thread Vikas Rawal
I have updated the readme in org-ref to indicate you can use both
> packages.
>
> Thanks.


Re: [oc] provide style/citation preview?

2022-03-24 Thread Vikas Rawal
>
>
> >
> > Some kind of overlay that shows citations as they would (at least as
> close as possible) look in the export?
>
> Something like this?
>
> https://github.com/andras-simonyi/org-cite-csl-activate
>
> I think he was hoping to incorporate that into the oc-csl processor at
> some point, and that would indeed be another approach to in-buffer
> previewing.
>
> This is very nice. I hope someday somebody will also do something like
this for biblatex/bibtex.

Vikas

>
>


Fwd: [oc] provide style/citation preview?

2022-03-24 Thread Vikas Rawal
> So I'm just wondering how best to dynamically generate those previews,
> perhaps even just using a pre-selected reference*, and if maybe oc
> could make that easier?
>
>
Some kind of overlay that shows citations as they would (at least as close
as possible) look in the export?

Vikas


Re: citations: org-cite vs org-ref 3.0

2022-03-21 Thread Vikas Rawal
>
>
>
> I don't think you have to choose. You can use org-cite for
> citations, and org-ref for cross-references. The citation syntax is
> orthogonal, you just should not mix them.


That is excellent then.

Thanks for clarifications.

Best,

Vikas


Re: citations: org-cite vs org-ref 3.0

2022-03-20 Thread Vikas Rawal
Dear John,

Thanks very much for taking time to write a detailed reply.

I do not think it is productive for the community to say or consider it
> is a sad situation.


>From the perspective of a user, this was only meant to express a sentiment
that one finds oneself in a situation of having to choose between two good
things, and that we have not been able to find a way to make both
compatible with each other. It was in not meant as a disrespect in any way.

My use case is very similar to yours and I have been an org-ref user for a
long time (I was surely one of the earliest beneficiaries of your work),
having written two books and innumerable research papers with org-ref
citation syntax. Being able to export to LaTeX has been my primary use but
the fact that citations were not exported easily to other formats thus far
was a problem I had to struggle with every now and then.


> There are more than 8 years of legacy org-ref documents. I have written
> 40+ scientific papers with it, and countless technical documents with
> more than 8000 cite links among them. org-ref has exceeded 190K
> downloads from MELPA, so I feel obligated to maintain org-ref for
> myself, and those users.


Given that it is not very difficult to convert a document from old org-ref
citation syntax to the org-cite syntax, at least as far as citation is
concerned, this should not be a big problem. Do these documents use
citation commands that are not available in org-cite? Can those not be
added to org-cite?


> I think org-ref and org-cite have different priorities, they solve
> different problems with different approaches, and they have different
> pros and cons.


It might be useful to discuss specific gaps (such as citenum) that need to
be plugged in org-cite for it to be usable. In fact, making org-cite usable
for a heavyweight user like you is a useful goalpost.

I understand that you do not particularly like the modularity and
complexity of org-cite way of specifying styles and variants. But if one is
able to make the two compatible, filling the gaps, they could have a
friendly co-existence with some way of being able to convert a document
between the two styles. And if there are some incompatibilities that cannot
be resolved, it would be good to know exactly what all those are. If
somebody was to write functions to convert from one format to the other,
they could choose how they want to deal with those incompatibilities.


> Cross-references are critical for me; without them, there is no path
> forward for me with org-cite. I did work on a cross-reference approach
> that leveraged org-cite syntax
> (https://github.com/jkitchin/org-ref-cite/issues/16), but there was not
> much appetite for the approach so I abandoned that.


What org-ref seems to do with cross-references is very nice. Unfortunately
this would not be available if a user chooses to use org-cite. Do the
capabilities of cross-referencing have to be wedded to the citation system?

Can this not be resolved?


> I am content to agree to disagree on these points and move forward with
> both packages because they solve different problems, are suitable for
> different communities, and they continue to benefit each other.


Friendly co-existence should be our goal. But can that be a situation in
which one is able to choose between the best of both and, as far as
possible, switch from one to the other.

Thanks again for your time and effort,

Vikas


Re: citations: org-cite vs org-ref 3.0

2022-03-20 Thread Vikas Rawal
>
>
>
> For what it’s worth, I use `org-ref` because fine-grained citation export
> with
> LaTeX (using BibTeX or BibLaTeX) only works with `org-ref`, and not with
> `org-cite`.
>

 It would help if you can explain what you mean.

If I remember correctly, `org-cite` exports the formatted citations into the
> LaTeX file, which is a no-go for me (let me know if I am wrong).


This is not correct. org-cite exports citation commands to LaTeX, and LaTeX
does rest of the processing. I do not think there is any difference in the
approach between org-cite and org-ref.


> Then, for
> example, it is really difficult to use different style files, etc. With
> `org-ref`, I can use BibLaTeX with specific style files. (Journal require
> different style files). I can even use my personal LaTeX classes (with
> specific
> bibliography styles) for Org export.
>
>
Surely org-cite allows you to do all of this.

Vikas


Re: citations: org-cite vs org-ref 3.0

2022-03-20 Thread Vikas Rawal
>
> > What is the general view of the community about this?
>
> I don't know about the general view of the community, but, as a data
> point, I find it very sad.
>

Exactly how I feel. Particularly so because org-cite was indeed inspired
from org-ref and all the great work John has done on this over the years. I
do not see any substantive discussion of the limitations that John has
pointed out with org-cite in the archives of the mailing list. We should
have a conversation about those.

If I understand correctly, the main limitation according to him is that
org-cite does not handle cross-references. Is that the only problem? What
do others think about it? Do we want the citation system to be able to
handle cross-references? If not, do we need a separate system that handles
cross-references beyond what is available in org-mode already? Can that
system not be created in a manner that would not break the org-cite syntax?

I think we should have a conversation and collectively think of what is the
best way forward.

Vikas


citations: org-cite vs org-ref 3.0

2022-03-20 Thread Vikas Rawal
I am sorry I have not followed the discussions recently. I had
happily settled on org-cite but I find that much has changed again.

In particular, John Kitchin has given up the work on org-ref-cite and
switched back to org-ref. There is a new org-ref version 3.0 which is not
compatible with org-cite.

This obviously creates many problems including that two people using
different citation systems cannot share org files.

What is the general view of the community about this? Is there a
comprehensive discussion of pros and cons of each?

What is everyone doing? I was an org-ref user for long before I switched to
org-cite. I can now shift to citar but since I am an ivy user, the switch
is not trivial. Also, I like many helper functions that John has created,
and would have to miss those if I do not use org-ref/org-ref-cite.

This seems messy.

Vikas


LaTeX export of a file with some accented characters

2022-03-15 Thread Vikas Rawal
I have an org file with some names (not all) that have accented characters. But 
when I try to export, I get errors such as this:

Sāṅkr - 65190: word not found

What do I do to make Org export these correctly? Is there a way to make Org 
export even if it does not recognise the characters?

Vikas



Re: org-sort random

2021-11-23 Thread Vikas Rawal
>
>
> I think that depends on the completion framework.  With the default
> completion, yes, I think RET should do it.  With ivy, it's instead
> ivy-immediate-done (C-M-j).  I'm not sure offhand about other
> frameworks.
>
>
That's what it needed. Thanks.

I wonder if there would be a better way to document this somewhere so that
people using different completion frameworks could figure out how to do it.
It seems to be something that would be useful to others.

Thanks again

Vikas


org-sort random

2021-11-21 Thread Vikas Rawal
I am trying to sort a sub-tree of headings randomly. But `C-c ^ f random RET` 
asks for a "function for comparing keys". What am I supposed to do?

Reference: 
https://lists.gnu.org/archive/html/emacs-orgmode/2011-02/msg00089.html

I have also tried the custom function proposed in the previous mail in
this thread (which was also proposed on another thread) but I face the
same problem with this as well.

Thanks for help.

Vikas



Re: [patch] ox-latex.el: add `:options' LaTeX attribute to tables

2021-10-28 Thread Vikas Rawal
>
> Do you still keep this line in your init:
>
> (advice-add 'org-latex--org-table :override #'my/org-latex--org-table) ?

You were right. My bad.

I confirm, the new function works and is a significant improvement.

Vikas



Re: [patch] ox-latex.el: add `:options' LaTeX attribute to tables

2021-10-28 Thread Vikas Rawal
> > \begin{longtblr}[options 1 options 2 options 3 options 4]{align}
>
> PS: I think the options should be separated by commas. In this
> case, it's necessary to replace the line:
>
> (mapconcat (lambda (x) (mapconcat 'identity x "")) options-list " ")))
>
> by this line:
>
> (mapconcat (lambda (x) (mapconcat 'identity x "")) options-list ",")))

I think the user can just write the comma in the option lines. It
might be more flexible to leave it to the user. I am just thinking of
a possibility that some other package may require a different
delimiter between options.

But others may have a different view.

I think this modification is useful and an improvement, and should be 
incorporated in orgmode itself.

I expect Nicholas would have a sense of whether this is likely to conflict with 
anything, or if there are some other considerations. Would be great to know 
from him and others in the know.

Thank you very much.

Vikas



Re: [patch] ox-latex.el: add `:options' LaTeX attribute to tables

2021-10-28 Thread Vikas Rawal
> Do you still keep this line in your init:
>
> (advice-add 'org-latex--org-table :override #'my/org-latex--org-table) ?
>
> If so, rename the function from my previous email as
> `my/org-latex-org-table' and re-evaluate it. And comment the old
> `my/org-latex-org-table'.
>

You were right. My bad. I should have been more careful.

I confirm, the new function works and is a significant improvement.

Vikas



Re: [patch] ox-latex.el: add `:options' LaTeX attribute to tables

2021-10-28 Thread Vikas Rawal



>
> First, you need to convert a plist to an alist (source:
> https://caiorss.github.io/Emacs-Elisp-Programming/Elisp_Programming.html#sec-1-8-4):
>
>
> And this would be the modified function:
>


This still seems to exporting the second "options" value only.

Vikas



Re: [patch] ox-latex.el: add `:options' LaTeX attribute to tables

2021-10-26 Thread Vikas Rawal


>
> Example:
>
> #+ATTR_LATEX: :environment longtblr
> #+ATTR_LATEX: :align colspec = {XXX}, width = 0.85\linewidth
> #+ATTR_LATEX: :options remark{Note} = {Lorem ipsum dolor sit amet}
>
> ==> \begin{longtblr}[remark{Note} = {Lorem ipsum dolor sit amet}]{colspec = 
> {XXX}, width = 0.85\linewidth}

This is excellent. There is only one improvement that I would like you to 
consider. Is it possible to allow multiple ":options " lines that are appended 
when exported to
+latex? Something like this:

#+ATTR_LATEX: :environment longtblr
#+ATTR_LATEX: :align colspec = {XXX}, width = 0.85\linewidth
#+ATTR_LATEX: :options remark{Note} = {Lorem ipsum dolor sit amet}
#+ATTR_LATEX: :options remark{Source} = {The source of data}

 ==> \begin{longtblr}[remark{Note} = {Lorem ipsum dolor sit amet},
  remark{Source} = {The source of data}]{colspec = {XXX}, 
width = 0.85\linewidth}

This would be more elegant since table notes can be elaborate and putting them 
all in one line would make them unwieldy.

At the moment, only the last ":options" line is considered.

Thanks a lot.

Vikas



Re: Support for tabularray in LaTeX export

2021-10-25 Thread Vikas Rawal


>
> Hi Vikas,
>
> You can define a modified version of `org-latex--org-table',
> adding a new LaTeX attribute `:options'. Something like this:

Is there a case for incorporating this in orgmode itself? There is some general 
utility for this in my view.


Vikas



A minor suggestion about formatting citations

2021-10-10 Thread Vikas Rawal
Date: Mon, 11 Oct 2021 04:36:56 +0530
From: Vikas Rawal 
To: org-mode mailing list 
Subject: A minor suggestion about formatting citations
Organisation: CESP, Jawaharlal Nehru University, New Delhi

I find it works better for me if I insert spaces between multiple
citations. For example: [cite: @john56; @john35; @bruce2021] rather
than [cite:@john56;@john35;@bruce2021].

The of advantage is that if I am citing many references in one place,
and use fill-paragraph/auto-fill, they wrap nicely. As far as I can
see, having spaces in between works just fine.

If this does not break anything, should this be the recommended
practice for the org-cite-insert-processors?

Vikas



Re: org-collector.el does not deal with inherited properties well

2021-09-26 Thread Vikas Rawal




>
> By the way, org-collector.el is now part of org-contrib and in
> lack of a maintainer.
>
> If you feel like you can maintain it or can help looking for a
> maintainer, please go wild.

I am not a big user of org-collector.el. I was only trying it for an
exercise, which I have abandoned because of lack of much interest
among others in my research group.

In any case, I hardly know lisp, and would not be able to either fix
things or review code contributed by others. I can contribute by way
of helping with documentation, if you need that for any part of org.

Vikas



Re: Support for tabularray in LaTeX export

2021-09-02 Thread Vikas Rawal
This is perfect. Thank you, Juan Manuel.

Vikas

On Thu, 2 Sept 2021 at 14:06, Juan Manuel Macías 
wrote:

> Hi Vikas,
>
> You can define a modified version of `org-latex--org-table',
> adding a new LaTeX attribute `:options'. Something like this:
>
> #+begin_src emacs-lisp
> (defun my/org-latex--org-table (table contents info)
>   "Return appropriate LaTeX code for an Org table.
>
> TABLE is the table type element to transcode.  CONTENTS is its
> contents, as a string.  INFO is a plist used as a communication
> channel.
>
> This function assumes TABLE has `org' as its `:type' property and
> `table' as its `:mode' attribute."
>   (let* ((attr (org-export-read-attribute :attr_latex table))
>  (alignment (org-latex--align-string table info))
>  (opt (org-export-read-attribute :attr_latex table :options))
>  (table-env (or (plist-get attr :environment)
> (plist-get info :latex-default-table-environment)))
>  (width
>   (let ((w (plist-get attr :width)))
> (cond ((not w) "")
>   ((member table-env '("tabular" "longtable")) "")
>   ((member table-env '("tabu" "longtabu"))
>(format (if (plist-get attr :spread) " spread %s "
>  " to %s ")
>w))
>   (t (format "{%s}" w)
>  (caption (org-latex--caption/label-string table info))
>  (above? (org-latex--caption-above-p table info)))
> (cond
>  ((member table-env '("longtable" "longtabu"))
>   (let ((fontsize (let ((font (plist-get attr :font)))
> (and font (concat font "\n")
> (concat (and fontsize (concat "{" fontsize))
> (format "\\begin{%s}%s{%s}\n" table-env width alignment)
> (and above?
>  (org-string-nw-p caption)
>  (concat caption "\n"))
> contents
> (and (not above?)
>  (org-string-nw-p caption)
>  (concat caption "\n"))
> (format "\\end{%s}" table-env)
> (and fontsize "}"
>  (t
>   (let ((output (format "\\begin{%s}%s%s{%s}\n%s\\end{%s}"
> table-env
> (if opt opt "")
> width
> alignment
> contents
>     table-env)))
> (org-latex--decorate-table output attr caption above? info))
>
> (advice-add 'org-latex--org-table :override #'my/org-latex--org-table)
> #+end_src
>
> and then:
>
> #+ATTR_LATEX: :environment longtblr
> #+ATTR_LATEX: :align 
> #+ATTR_LATEX: :booktabs t
> #+ATTR_LaTeX: :options []
>
> Best regards,
>
> Juan Manuel
>
> Vikas Rawal writes:
>
> > tabularray (CTAN: Package tabularray) provides longtblr environment
> > that is called as
> >
> > ---
> > \begin{longtblr}[various-table-options]{column and row specifications}
> >
> > \end{longtblr}
> > ---
> >
> > Adding something like the following to orgmode tables makes them
> > export nicely as longtblr
> >
> > ---
> > #+ATTR_LATEX: :environment longtblr
> > #+ATTR_LATEX: :align width=0.8\textwidth,colspec={lX[2,r]X[3,r]X
> > [r,bg=gray9]}
> > #+ATTR_LATEX: :booktabs t
> > ---
> >
> > Everything seems to work very well with orgmode except that I cannot
> > figure out how to pass [various table options] from orgmode. These
> > table options include, most importantly, table notes.
> >
> > I normally use threeparttable for table notes, but longtblr does not
> > seem to work with threeparttable and has its own syntax for table
> > notes.
> >
> > Any advice on how to pass [table-options] to longtblr environment?
> >
> > Vikas
> >
>


Support for tabularray in LaTeX export

2021-09-01 Thread Vikas Rawal
tabularray (CTAN: Package tabularray )
provides longtblr environment that is called as

---
\begin{longtblr}[various-table-options]{column and row specifications}

\end{longtblr}
---

Adding something like the following to orgmode tables makes them export
nicely as longtblr

---
#+ATTR_LATEX: :environment longtblr
#+ATTR_LATEX: :align
width=0.8\textwidth,colspec={lX[2,r]X[3,r]X[r,bg=gray9]}
#+ATTR_LATEX: :booktabs t
---

Everything seems to work very well with orgmode except that I cannot figure
out how to pass [various table options] from orgmode. These table options
include, most importantly, table notes.

I normally use threeparttable for table notes, but longtblr does not seem
to work with threeparttable and has its own syntax for table notes.

Any advice on how to pass [table-options] to longtblr environment?

Vikas


Re: should a BIBLIOGRAPHY keyword supercede org-cite-global-bibliography?

2021-07-19 Thread Vikas Rawal
> It seems like that should not be the case, i.e. if you define BIBLIOGRAPHY
> keywords it means you do not want to use the ones
> in org-cite-global-bibliography. Is there a scenario where the union of those
> makes sense?

I second this. The local bibliographies should supercede the global.

Vikas



Re: Put #+print_bibliography in an org source code block?

2021-07-19 Thread Vikas Rawal
>
> I don't know if that works, but what about exporting to org?
>

Exporting to org works.

Vikas



Put #+print_bibliography in an org source code block?

2021-07-17 Thread Vikas Rawal
I don't know if this is crazy. But I was wondering if it is possible
(or worth exploring as an idea) to turn #+print_bibliography into
something that can be evaluated to throw the bibliography as results
in the org file itself.

This would then allow playing with the bibliography using org, and
exporting it to any format.

I tried to put #+print_bibliograph in an org source code block, but I
guess it would need some way of picking up citations from the document
outside the code block.

Vikas



Re: org-cite citation commands

2021-07-17 Thread Vikas Rawal
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: org-cite citation commands

2021-07-17 Thread Vikas Rawal
Thanks. This is very useful.

Vikas

On Sat, Jul 17, 2021 at 03:55:18PM +0200, András Simonyi wrote:
> Dear Vikas,
>
> the CSL-based processor is in a bit of a flux in this respect, but as
> for the natbib and biblatex processors I've extracted these
> correspondences from the oc source code, which you might find useful.
> (With the exception of the first, "fully nil" styles, one always has
> to use the "/" separator between "cite" and the listed combinations,
> for the default styles this means a double slash, e.g.,  [cite//b@key]
> leads to  \citealp{key} using the natbib processor.
>
> * Natbib
>
> ;; default style.
> --> \citep
> / [bare|b]  --> \citealp
> / [caps|c]  --> \Citep
> / [full|f]  --> \citep*
> / [bare-caps|bc]--> \Citealp
> / [bare-full|bf]--> \citealp*
> / [caps-full|cf]--> \Citep*
> / [bare-caps-full|bcf]  --> \Citealp*
>
> ;; author style.
> [author|a] / [caps|c]   --> \Citeauthor
> [author|a] / [full|f]   --> \citeauthor*
> [author|a]  --> \citeauthor
>
> ;; noauthor style
> [noauthor|na] / [bare|b]--> \citeyear
> [noauthor|na]   --> \citeyearpar
>
> ;; nocite style.
> [nocite|n]  --> \nocite
>
> ;; text style.
> [text|t] / [bare|b] --> \citealt
> [text|t] / [caps|c] --> \Citet
> [text|t] / [full|f] --> \citet*
> [text|t] / [bare-caps|bc]   --> \Citealt
> [text|t] / [bare-full|bf]   --> \citealt*
> [text|t] / [caps-full|cf]   --> \Citet*
> [text|t] / [bare-caps-full|bcf] --> \Citealt*
> [text|t]--> \citet
>
> * biblatex
>
> ;; Default nil style.
>   --> autocite
> / [bare|b]--> cite
> / [caps|c]--> Autocite
> / [bare-caps|b]   --> Cite
>
> ;; author style.
> [author|a] / [caps|c])--> Citeauthor*
> [author|a] / [full|f])--> citeauthor
> [author|a] / [caps-full|cf]   --> Citeauthor
> [author|a]--> citeauthor*
>
> ;; locators style.
> [locators|l] / [bare|b]   --> notecite
> [locators|l] / [caps|c]   --> Pnotecite
> [locators|l] / [bare-caps|bc] --> Notecite
> [locators|l]  --> pnotecite
>
> ;; noauthor style.
> [noauthor|na] --> autocite*
>
> ;; nocite style.
> [nocite|n]--> nocite
>
> ;; text style.
> [text|t] / [caps|c])  --> Textcite
> [text|t]  --> textcite
>
> best regards,
> András
>
>
> On Sat, 17 Jul 2021 at 13:41, Vikas Rawal  wrote:
> >
> > I have been a long time user of org-ref and am excited to see the
> > development of org-cite. Thanks a lot for this, Nicholas and others
> > who have been working on this. I have been wanting to give it a spin
> > for the last few days and finally got down to doing it.
> >
> > I am aware that the documentation is still in the works and therefore
> > my apologies in advance if asking these questions is premature. I have
> > looked at Nicholas' mails which provide basic documentation and have
> > been trying to follow these.
> >
> > What is the equivalent here of the various citation commands that something 
> > like biblatex or bibtex provide? The two most common citation commands I 
> > use are citet and citep (or parencite). These are used to produce the 
> > following kind of output using org-ref/biblatex:
> >
> >
> > -
> > * citet
> >
> > citet:john is an excellent resource.
> >
> > will be exported as:
> >
> > John (1990) is an excellent resource.
> >
> > * citep
> >
> > This is an excellent resource citep:john.
> >
> > will be exported as
> >
> > This is an excellent resource (John, 1990).
> >
> > 
> >
> > How does one achieve this using org-cite?
> >
> > I am a bit lost with the citation styles that are inbuilt in 
> > oc-biblatex.el. Is it expected that we will have to write additional 
> > citation styles for getting these kinds of output?
> >
> > Apologies if this is a naive or a premature question.
> >
> > Many thanks to everyone.
> >
> > Vikas
> >
>



Re: org-cite citation commands

2021-07-17 Thread Vikas Rawal
Thanks, Bruce and John. Indeed, I used biblatex with natbib=true
option, which gives me citet and citep in biblatex. But using
\autocite and \textcite is perfect.

I am noticing a few other issues at this stage.

I have a large biblatex database, and loading it using C-c C-x @ to
insert citations seems very slow (have not managed to load it thus
far). Org-ref used to be much faster in this. org-cite works fine with
a smaller biblatex database. I don't know if others have had the same
experience.

I understand that oc-biblatex.el loads biblatex in the background,
produces the citations and the bibliography, and inserts them in the
exported output. In that case, what are the possibilities of using
biblatex commands to configure the output? I realise that these will
not work since most of it would be LaTeX specific. Does that mean the
users will have to work with CSL styles to format the output even if
they are using oc-biblatex.el? I am still somewhat confused about how
this is going to work.

I notice that there is an option org-cite-biblatex-options which can
be customized to load biblatex with specific options. I have not yet
managed to test it. If somebody has already played around with it, it
would be useful to know what they could manage to do.

In my experience, biblatex and bibtex uniformly process the author
names whether they are written in the database file as "John Kitchin"
or "Kitchin, John". This does not seem to work with oc-biblatex.el at
least out of the box and the two are formatted differently.

Thanks again,

Vikas



org-cite citation commands

2021-07-17 Thread Vikas Rawal
I have been a long time user of org-ref and am excited to see the
development of org-cite. Thanks a lot for this, Nicholas and others
who have been working on this. I have been wanting to give it a spin
for the last few days and finally got down to doing it.

I am aware that the documentation is still in the works and therefore
my apologies in advance if asking these questions is premature. I have
looked at Nicholas' mails which provide basic documentation and have
been trying to follow these.

What is the equivalent here of the various citation commands that something 
like biblatex or bibtex provide? The two most common citation commands I use 
are citet and citep (or parencite). These are used to produce the following 
kind of output using org-ref/biblatex:


-
* citet

citet:john is an excellent resource.

will be exported as:

John (1990) is an excellent resource.

* citep

This is an excellent resource citep:john.

will be exported as

This is an excellent resource (John, 1990).



How does one achieve this using org-cite?

I am a bit lost with the citation styles that are inbuilt in oc-biblatex.el. Is 
it expected that we will have to write additional citation styles for getting 
these kinds of output?

Apologies if this is a naive or a premature question.

Many thanks to everyone.

Vikas



The git repo for contrib packages

2021-06-29 Thread Vikas Rawal
I am aware of the proposal to separately package the contrib libraries. I
find that the org-mode git repo at https://code.orgmode.org/explore/repos
does not have contrib packages any more. But I can't find the repository
for those packages.

I would like to compile my own orgmode packages (core and contrib) from git
rather than use the elpa packages. How does one get the contrib repo though?

Also, while this page (https://orgmode.org/elpa.html) already says that the
instructions are deprecated (not yet exactly), it would be useful to
provide the new set of instructions somewhere. I am unable to figure out
how to use the development versions of org and contrib packages.

Best wishes,

Vikas


Re: org-collector.el does not deal with inherited properties well

2021-06-20 Thread Vikas Rawal
Found the answer here:
https://lists.gnu.org/archive/html/emacs-orgmode/2011-01/msg00292.html

Sorry for writing before looking through the archives carefully.

Best wishes for everyone.

Vikas


On Sun, 20 Jun 2021 at 16:26, Vikas Rawal  wrote:

> Hello,
>
> org-collector.el seems to fill "0" for properties that are inherited just
> as it does for properties that are not defined for a particular headline
> (for which also, 0 is poor choice; nil would have been better). This should
> not be the correct behaviour. Or is it intentional, and I am missing
> something?
>
> Thanks and best wishes,
>
> Vikas
>
> Org-mode version: 9.4.5 (9.4.5-29-gc43041-elpaplus)
>
>


org-collector.el does not deal with inherited properties well

2021-06-20 Thread Vikas Rawal
Hello,

org-collector.el seems to fill "0" for properties that are inherited just
as it does for properties that are not defined for a particular headline
(for which also, 0 is poor choice; nil would have been better). This should
not be the correct behaviour. Or is it intentional, and I am missing
something?

Thanks and best wishes,

Vikas

Org-mode version: 9.4.5 (9.4.5-29-gc43041-elpaplus)


Re: Org as a book publisher

2021-03-07 Thread Vikas Rawal
A few years ago, I had produced this book entirely on orgmode: 
https://cup.columbia.edu/book/ending-malnutrition/9789382381648. The source 
files of the book are here: https://github.com/vikasrawal/endingmalnutrition.

This was some years back, and there has been some change in the org mode syntax 
since then and the files would need some fixing before they could be compiled 
with the current versions of orgmode.

Vikas


On Sun, Mar 07, 2021 at 01:08:20PM +0100, Diego Zamboni wrote:
> Hi Juan Manuel,
>
> Thanks for sharing this - the output looks very nice.
>
> I think with Org and a setup like you describe, we are one step closer to
> separating content (what) from form (how) in a document. This was one of
> the original goals of LaTeX, but of course in a LaTeX document much of the
> "how" is still visible through the "what". With Org the separation becomes
> clearer, by hiding the LaTeX structures (almost) completely, and by
> allowing to produce multiple formats from the same source document.
>
> I have done something similar with my books, which I publish through
> Leanpub. I keep the source of each book in Org, and from there the exporter
> takes care of producing the Leanpub markup and format, which in turn takes
> care of converting it to PDF, ePub or other formats.
>
> Best,
> --Diego
>
>
>
> On Sat, Mar 6, 2021 at 8:35 PM Juan Manuel Macías 
> wrote:
>
> > Hi,
> >
> > I would like to share here two samples of one of the most intense uses
> > that I give Org Mode: for typesetting, layout and editorial design. In
> > other words, I use Org (and Org-Publish) where publishers today use DTP
> > proprietary software like InDesign or QuarkXpress (a type of software,
> > on the other hand, that was never intended to compose books but rather
> > magazines, posters, brochures and so on). The samples are from a book
> > on classical philology, recently published here in Spain, and from a
> > fairly extensive dictionary, still work in progress:
> >
> > https://imgur.com/gallery/yxAVkrY
> >
> > Naturally, what acts in the background here is TeX and LaTeX
> > (specifically Lua(La)TeX), so what I really do is use Org and
> > Org-Publish as a sort of high-level interface for LaTeX. But I don't
> > mean to avoid LaTeX: in fact, I've been working with LaTeX for a long
> > time. I like LaTeX and behind these jobs there is a lot of LaTeX code.
> > But Org gives me a much more light and productive workflow, allowing me
> > to work at two levels.
> >
> > The main advantages that I see for this workflow with Org/Org-Publish
> > are:
> >
> > 1. Lightness: LaTeX is too verbose.
> > 2. Control of the composition process at various points. One of the
> >qualities of LuaTeX is the possibility to control TeX primitives
> >through scripts in Lua, and to act at various points in the pre- or
> >post-process. But I have realized that with the happy fusion of Elisp
> >and Org we can be much more precise and "surgical" ;-). Here,
> >Org/LaTeX is much more powerful than LuaLaTeX.
> > 3. Org's synaptic and org-anizational ability to control and manage the
> >entire process of the creation of a book, from when the originals are
> >received until everything is prepared to send to the printer.
> > 4. An unique origin. The book can be produced on paper from a single
> >source, but you can also export, from that source consistently, to
> >other formats (HTML or Epub).
> >
> > Best regards,
> >
> > Juan Manuel
> >
> >



Re: Macro replacement inside +attr_latex line

2020-08-04 Thread Vikas Rawal
Found the answer in the mailing list archives
(https://lists.gnu.org/archive/html/emacs-orgmode/2013-09/msg00234.html).
Not allowed.

Vikas

On Tue, 4 Aug 2020 at 18:33, Vikas Rawal  wrote:
>
> Does orgmode macro replacement not work in an +attr_latex line? I was
> thinking of using shortcuts for some complex latex syntax.
>
> Vikas



Macro replacement inside +attr_latex line

2020-08-04 Thread Vikas Rawal
Does orgmode macro replacement not work in an +attr_latex line? I was
thinking of using shortcuts for some complex latex syntax.

Vikas



Re: Exploring properties

2020-02-24 Thread Vikas Rawal
I don't know if this is useful. But this is what I could come up with. This 
might at least motivate somebody to think of other possible advantages/uses of 
building org-mode capabilities to interact with databases.

Vikas

---

Feature request: To build tools to facilitate using org-mode as a front-end for 
interacting with a database.

The idea would be to use org-mode to select, insert and update records in a 
database. It is natural to think of recutils, a plain text database, as the 
database backend. But a more generalised solution may allow other choices of 
databases. With a text-based database backend like recutils, we could harness a 
version control system like git to semi-automate collaboraion.

Why would one use org-mode for creating a database application? One can think 
of many advantages. But the biggest advantage (to me) would be that, in this 
setup, a multi-user database application can work without constant internet 
connectivity. You can query recutils files, insert/update records, and then let 
git deal with synchronisation across the team members.

There are other advantages as well. We do not yet have a text-based, 
easy-to-deploy database application system. Recutils provides the 
infrastructure for a backend. But we do not have a fully-developed front-end 
system to interact with recutils. Org-mode is clearly best placed to provide 
the frontend for working with recutils.

Needless to say, this would be particularly interesting to members of the 
org-mode/emacs fan-club. Over the last few years, org-mode has come to be used 
for many tasks that go way beyond what Carsten had in mind when he first built 
org-mode. From web-publishing to writing books, org-mode provides excellent 
tools. Being able to create and use databases from within org-mode would be a 
very useful addition to this toolkit.

We already have tools that can be used to read data from recutils (and other 
databases) and create reports in org-mode. The missing feature is to be able to 
use org-mode to create/update records systemmatically.

There are two possibilities here: to use org-mode tables or org-mode properties 
to interact with the database. The advantage of doing this using the org-mode 
properties is that the column-view of properties provides an easy to use 
interface for entering data. There is already a mechanism for defining 
"Allowed" values for any field which speeds up data entry and helps avoid 
typing errors.

There are several challenges. Some of these are:

1. Extending "Allowed" values to specify type of data that can be recorded 
(numeric, char) or range of values.
2. How to deal with relationships/foreign keys. Can property inheritance be 
used to deal with at least simple foreign key constraints?
3. Org-mode macros provide {{{property(PROPERTYNAME)}}} syntax for macro 
replacement during export. But nothing as simple as this is available for use 
in source code blocks. Something like this would allow using some code to 
add/update records in a database. We should perhaps build on the property API 
or org-ql for creating something like this.

If we can resolve some of these and creating a simple application for 
demonstration, it might help in showing the potential and identifying other 
challenges.

On Mon, Feb 24, 2020 at 09:39:51AM +0100, Bastien wrote:
> Hi Vikas,
>
> Vikas Rawal  writes:
>
> > I am essentially thinking of org-mode providing an
> > interface for feeding data to recutils.
>
> Yes, that would probably be useful.
>
> If you want to write a feature request, please write it as if the
> reader does not know recutils and you precise use-case, so that we
> understand all implication and motivate possible contributors.
>
> Thanks,
>
> --
>  Bastien
>



Re: Exploring properties

2020-02-23 Thread Vikas Rawal
Thanks Bastien for advice and for connecting with Jose. It would be useful
to write some lisp for inserting and adding data from org into rec files.
It could either be from org-mode tables or from properties. I am
essentially thinking of org-mode providing an interface for feeding data to
recutils.

Vikas

On Sun, 23 Feb 2020 at 19:10, Bastien  wrote:

> Hi Vikas,
>
> Vikas Rawal  writes:
>
> > Would you think that an extension of org-collector is the direction to
> > look at? Doesn't look like org-collector has seen any updates in a
> > long time.
>
> You might want to look at recutils instead.
>
> It was announced on org-mode mailing list here 10 years ago:
> https://lists.gnu.org/archive/html/emacs-orgmode/2010-12/msg00219.html
>
> Jose is still developing it actively - it made the news on HN
> recently: https://news.ycombinator.com/item?id=22153665
>
> There is *some* integration with org-mode, although I have not tested
> it. I've also found this, but this seems outdated and not maintained:
> https://github.com/millarc/ob-rec.el
>
> I'm cc'ing Jose as he may be able to share his own wishlist on how Org
> could better interact with recutils.
>
> HTH,
>
> --
>  Bastien
>


Re: Limiting properties and property values

2020-02-23 Thread Vikas Rawal
Dear Eric, Bastien and John,

Thanks for references to recutils and org-ql. These are very interesting,
and I am looking at those.

A recutils database with a possibility of selecting, inserting and updating
records from org is one possibility.

Let me play around with these tools a bit and see what they are like.

Thanks again,

Vikas


On Sun, 23 Feb 2020 at 22:20, Fraga, Eric  wrote:

> On Sunday, 23 Feb 2020 at 15:10, Vikas Rawal wrote:
> > I am thinking of using org-mode to compile a small database.
>
> Although org is fantastic, it is sometimes worth considering other tools
> (and with babel, these can often be brought into the org sphere of
> activity easily).  For instance, GNU recutils [1] might suit you
> better.  There's even an emacs mode [2].
>
> Just my 2¢.
>
>
> Footnotes:
> [1]  https://www.gnu.org/software/recutils/
>
> [2]  https://www.gnu.org/software/recutils/rec-mode-manual/rec-mode.html
>
> --
> : Eric S Fraga via Emacs 28.0.50, Org release_9.3.6-354-g9d5880
>


Re: Exploring properties

2020-02-23 Thread Vikas Rawal


>
> > I don't know if I have missed something obvious. But I am trying to
> > read all the properties data (key-value pairs) into an R source code
> > block (essentially to gather into a data.frame before further
> > processing).
>
> You might want to look at `org-map-entries'.

Thanks. It seems it will take more lisp than I can handle. But let me try.

I think there is a potential to combine orgmode tags and properties, with a 
little more lisp may be, along with version control to create small database 
applications.

It would be good to design something as a proof-of-concept.

Vikas



Re: Exploring properties

2020-02-23 Thread Vikas Rawal


>
> You might want to look at `org-map-entries'.
>
Would you think that an extension of org-collector is the direction to look at? 
Doesn't look like org-collector has seen any updates in a long time.

Vikas



Re: Limiting properties and property values

2020-02-23 Thread Vikas Rawal
On Sun, 23 Feb 2020 at 15:02, Bastien  wrote:

> Hi Vikas,
>
> Vikas Rawal  writes:
>
> > 1. Is it possible to restrict the sub-tree of a headline to have only
> > properties specified in the column property of the parent? That is,
> > no additional property can be specified.
>
> No, it is currently not possible.  What would be the use-case?
>


I am thinking of using org-mode to compile a small database. I would like
to use properties to add data, and some restrictions of this kind to limit
what properties a particular kind of headline could have.

It might seem like an over-kill, but then for org-mode, almost nothing is
an over-kill.

I am missing a few nuts and bolts, but would really like to see how it
works to use org-mode for a small org-mode-skilled team to use it as a data
platform.

Warmest greetings and regards,

Vikas


Exploring properties

2020-02-22 Thread Vikas Rawal
I don't know if I have missed something obvious. But I am trying to read
all the properties data (key-value pairs) into an R source code block
(essentially to gather into a data.frame before further processing).

I thought properties would be a neat way to put together a small database,
and then process it in R.

Would appreciate a clue.

Warmly,

Vikas


Limiting properties and property values

2020-02-22 Thread Vikas Rawal
Dear all,

I have two queries regarding use of properties in org mode.

1. Is it possible to restrict the sub-tree of a headline to have only
properties specified in the column property of the parent? That is, no
additional property can be specified.

2. Is it possible to limit the allowed values of a property to say only
numeric values or to a specific range of numeric values?

Thanks in advance, and with best wishes to everyone.

Vikas


Re: R code block produces no output

2019-12-17 Thread Vikas Rawal
>> That should be ":results file graphics".
>>
>>
> Thanks very much. This works. I guess this has recently changed. I have
> always used ":results output graphics"
>
>
>
I see that the behaviour changed with 9.3. Release notes (
https://www.orgmode.org/Changes.html) have this:
:file header argument no longer assume "file" :results

The "file" :results value is now mandatory for a code block returning a
link to a file. The :file or :file-ext header arguments no longer imply a
"file" result is expected.

--

Thanks a lot for your help.

Vikas


Re: R code block produces no output

2019-12-17 Thread Vikas Rawal
On Tue, 17 Dec 2019 at 18:13, William Denton  wrote:

> On 17 December 2019, Vikas Rawal wrote:
>
> > A simple code block like the following does not create the graph.
> >
> > #+NAME: test
> > #+BEGIN_SRC R :results output graphics :exports results :file temp.jpg
> :width 2400 :height 1200  :res 300 :session temp
>
> That should be ":results file graphics".
>
>
Thanks very much. This works. I guess this has recently changed. I have
always used ":results output graphics"

Vikas


R code block produces no output

2019-12-17 Thread Vikas Rawal
I have a strange problem and I wonder if there is a new bug. Would
appreciate for any help in identifying the problem.

A simple code block like the following does not create the graph.

#+NAME: test
#+BEGIN_SRC R :results output graphics :exports results :file temp.jpg
:width 2400 :height 1200  :res 300 :session temp
   library(ggplot2)
data.frame(date=c(1:10),ifpa=c(11:20))->t
ggplot(t,aes(x=date,y=ifpa))->p
p+geom_point()
#+end_src

When I compile this using C-c C-c, I get the following message:

executing R code block (test)...
Code block produced no output.

The code produces the right graph when I do C-c ' to go into an ESS buffer
and execute these commands.

I am on following versions of Org and Emacs:

Org mode version 9.3 (9.3-8-geab7c4-elpaplus @
/home/vikas/.emacs.d/elpa/org-plus-contrib-20191209/)
GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.10) of
2019-08-30


Thanking you and with best wishes,

Vikas


Re: [O] Tables in HTML export

2018-12-07 Thread Vikas Rawal
> My specific use case is that I have a multi-row table header created in an
> > R code block. I do not have a way of creating a horizontal line, and
> > without that the header is not being recognised as the header in html
> > export.
>

I defined the following macro.

#+MACRO: hlmacro (eval (org-table-insert-hline))

Then, inserting {{{hlmacro}}} in a table cell (I can do that in a table
generated by a code block) results in insertion of an hline below the cell
at the beginning of export. The header is then correctly identified.

Thanks,

Vikas


Re: [O] Feature request: :colnames and :hlines in ob-R.el

2018-12-07 Thread Vikas Rawal
> > At the moment, ob-R.el does not support :colnames to have a list of
> column
> > names as an argument. This seems to have been raised on the list many
> years
> > ago [1], but it does not look like it was implemented. Is there a
> > possibility that this could be implemented?
>
> Patches are welcome. :)
>
>
My knowledge of lisp is too limited for me to be able to do this. How much
I wish to be able to hack this kind of thing myself...

:(

Vikas


[O] Feature request: :colnames and :hlines in ob-R.el

2018-12-06 Thread Vikas Rawal
At the moment, ob-R.el does not support :colnames to have a list of column
names as an argument. This seems to have been raised on the list many years
ago [1], but it does not look like it was implemented. Is there a
possibility that this could be implemented?

Also, is it possible to allow :hlines to have a list of row numbers as
arguments after which horizontal lines are drawn in the results? Could we
support a syntax such as the following

:hlines '(2 5 8)

Or something of this kind, which could then be used to draw lines after
these row numbers?

I think these two features would make it much easier to customise tables
created using R code blocks.

Would appreciate any comments and suggests.

Thanks very much and best wishes,

Vikas

[1] https://lists.gnu.org/archive/html/emacs-orgmode/2013-04/msg00499.html


[O] Tables in HTML export

2018-12-06 Thread Vikas Rawal
How does org identify which table rows should be exported with header tags?
It seems rows above a horizontal line are automatically converted using
 tags. Is there a way of controlling this?

My specific use case is that I have a multi-row table header created in an
R code block. I do not have a way of creating a horizontal line, and
without that the header is not being recognised as the header in html
export.

Would be grateful for any pointers.

Vikas


Re: [O] visual-line-mode [was: Re: Clean up org-faces.el]

2018-04-09 Thread Vikas Rawal


> On 10-Apr-2018, at 5:12 AM, Samuel Wales  wrote:
> 
> On 4/9/18, Eric S Fraga  wrote:
>> What I do, when I want distraction free writing, is expand the fringes
>> to take up whatever amount of screen space I wish.  cf set-fringe-mode
> 
> interesting idea, but not useful here as i need org headers and tables
> to extend as far as possible, while paragraphs are filled to a narrow
> column.
> 

Neither visual-line-mode nor visual-fill-column-mode do this. Would be very 
nice if this were possible.

Vikas


Re: [O] Clean up org-faces.el

2018-04-08 Thread Vikas Rawal
> 
> off topic here, but the problem with visual-line-mode for me is that
> at least in 24.4 it does not respect fill column.  this is a
> dealbreaker.  i stick with m-q.

There is a visual-fill-column-mode. Have you tried that?

Vikas



[O] git clone org mode

2018-04-08 Thread Vikas Rawal
Fellow orgers,

The following two pages on worg both recommend using "git clone 
g...@code.orgmode.org:bzg/org-mode.git” to clone the org repo.

https://orgmode.org/worg/dev/index.html 

https://orgmode.org/worg/org-faq.html#keeping-current-with-Org-mode-development 


When I tried this today, it asked me for a password. I was puzzled. I then 
created an account on https://code.orgmode.org/ , 
added my ssh public key in the settings, and was able to clone the repo without 
being bothered with the password.

If this is the expected method, may be the above two pages should mention this.

Thanks,

Vikas





Re: [O] NA in R source code block

2018-03-31 Thread Vikas Rawal

> 
> ### Solution 1
> 
> You could use an elisp function to clear the nil. It is not automatic
> and you would have to write a formula for every column but it might
> still be better changing them manually.
> 
> I don't know how to implement it automatically though. 
> 
> #+BEGIN_SRC_elisp
> (defun removenil (x)
> (interactive)
> (replace-regexp-in-string "nil" "" x))
> #+END_SRC
> 


I created this export filter which uses something similar but automatically 
replaces nil with --- on all my documents:

(defun org-export-blanks-filter-latex (row backend info)
  "Replace nil in table with --- in LaTeX export."
  (when (org-export-derived-backend-p backend 'latex)
(replace-regexp-in-string "nil" "---" row)))

(add-to-list 'org-export-filter-table-row-functions
 'org-export-blanks-filter-latex)


> #+NAME: test2
> #+BEGIN_SRC R :results value  :exports results :colnames yes :hline yes :dir 
> /tmp  :session R-test1
> NA_rep <- function(dt,rep="") {
> dt[is.na(dt)] <- rep
> return(dt)
> }
> NA_rep(data.frame(a=c(1,2,NA),b=c("john","dan","marco")))
> #+END_SRC
> 

This gets more painful if I want to use something like “—“ in numeric columns.

The first approach/export filter is less painful than this.

Thanks,

Vikas




Re: [O] NA in R source code block

2018-03-31 Thread Vikas Rawal

> 
>> NAs in a data frame that is created by an R source code block show up in the 
>> results as nil. Can I change it to something else (say, “—“)?
> 
> Could you elaborate on your issue? Can you give a minimal example of
> your block? It is very difficult to help with the information you gave.
> 

Hi and Greetings! And apologies if my previous mail sounded rude. That was 
surely not my intent.

Here is an example. The NA in column a shows up in the results as nil. Why does 
that happen? Is there a way of changing this behaviour? I can manually replace 
NA with something else, but doing that in each code block is a pain. Since I 
wrote my first mail, I have written an export filter that filters out each 
“nil” at the time of export and replaces it with a “---“. But that is not 
perhaps the most efficient way of doing it.

Warmly,

Vikas

---

#+NAME: test
#+BEGIN_SRC R :results value :exports results :colnames yes :hline yes

data.frame(a=c(1,2,NA),b=c("john","dan","marco"))

#+END_SRC

#+RESULTS: test
|   a | b |
|-+---|
|   1 | john  |
|   2 | dan   |
| nil | marco |






[O] NA in R source code block

2018-03-29 Thread Vikas Rawal
NAs in a data frame that is created by an R source code block show up in the 
results as nil. Can I change it to something else (say, “—“)?

Vikas




Re: [O] LaTeX export filter

2018-03-27 Thread Vikas Rawal
> 
> 
> 
>> 
>>> (while (string-match
>>> "\\(<\\([0-9]+\\)cid\\([0-9]+\\)?>[[:blank:]]*\\([^&]+\\)\\)" row)
>> 
>> Could it be that you need to change the last + to *?
>> Haven't tried it, mind you.
>> -- 
> 
> That does not change the result. Still pick only two.
> 
> Vikas
> 




Re: [O] LaTeX export filter

2018-03-27 Thread Vikas Rawal
> 
>> 
>> 
>>> 
 (while (string-match
"\\(<\\([0-9]+\\)cid\\([0-9]+\\)?>[[:blank:]]*\\([^&]+\\)\\)" row)
>>> 
>>> Could it be that you need to change the last + to *?
>>> Haven't tried it, mind you.
>>> -- 
>> 
> 
> The problem is in this part of the code:
> 
> (while (string-match "& \\| " row 0)
>   (setq row (replace-match "" nil nil row))
>   (decf start))
> 
> If I comment it, I get three \cmidrule latex commands, but with  and \\
> 
> Somehow, the above lines replace more than just  and \\.
> 
> Vikas
> 




[O] LaTeX export filter

2018-03-24 Thread Vikas Rawal
Let me start by confessing my limited knowledge of lisp.

I am trying to write a LaTeX export filter that should replace all table rows 
with cells having entries such as <3cid4> by \cmidrule{lr}{3-4}

The idea is to have a table row of this kind

| <2cid3> |   <4cid5> |<6cid7> |   
|   |   |   
|

Which should be exported to 

\cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7}

This is as far as I have gone.

--

(defun org-export-cmidrule-filter-latex (row backend info)
  (while (string-match
  "\\(<\\([0-9]+\\)cid\\([0-9]+\\)?>[[:blank:]]*\\([^&]+\\)\\)" row)
(let ((start (string-to-number (match-string 2 row)))
  (end (or (match-string 3 row) "l")))
  (setq row (replace-match
 (format "cmidrule(lr){%s-%s}" start end)
 nil nil row 1))
  (while (string-match "& \\| " row 0)
(setq row (replace-match "" nil nil row))
(decf start))
  )
)
  row)

--

The above filter works if I have only one or two <[0-9]cid[0-9]> strings in a 
row. It does not pick up the third <[0-9]cid[0-9]> string.

I would greatly appreciate if anyone could help improve this filter.

Vikas




Re: [O] Generating sitemap: ‘org-publish-cache-get’ called, but no cache present

2018-01-18 Thread Vikas Rawal

> 
>> I have been using the following code block to generate a sitemap for my 
>> org-jkyll based blog.
>> 
>> #+begin_src emacs-lisp :results output silent :exports none :cache yes
>>  (org-publish-sitemap
>>   (assoc "indblog" org-publish-project-alist)
>>   "sitemap.org")
>> #+end_src
>> 
>> I had not generated the sitemap for a while, and now I find that it
>> ends with the following message, and sitemap.org 
>> is not recreated.
> 
> `org-publish-sitemap' is not meant to be called directly. It assumes
> project is properly set-up, which is done in its caller,
> `org-publish-projects'.
> 
> So, why don't you simply publish "indblog" project?

I use this to avoid having to publish the whole project each time I add a post. 
I would like to just publish the current file, and update the sitemap by 
running the above code block. Is that not okay?

Vikas




[O] Generating sitemap: ‘org-publish-cache-get’ called, but no cache present

2018-01-14 Thread Vikas Rawal
I have been using the following code block to generate a sitemap for my 
org-jkyll based blog.

#+begin_src emacs-lisp :results output silent :exports none :cache yes
  (org-publish-sitemap
   (assoc "indblog" org-publish-project-alist)
   "sitemap.org")
#+end_src

I had not generated the sitemap for a while, and now I find that it ends with 
the following message, and sitemap.org  is not recreated.


Generating sitemap for Sitemap for www.indianstatistics.org
org-publish-cache-get: ‘org-publish-cache-get’ called, but no cache present
——

Any pointers?

Vikas

Org version: Org mode version 9.1.4 (release_9.1.4-218-g993f76 @ 
/Users/vikas/.emacs.d/personal/org-mode/lisp/)
Emacs: GNU Emacs 25.3.1 (x86_64-apple-darwin16.3.0, Carbon Version 157 AppKit 
1504.76) of 2017-09-30

Re: [O] [RFC] Dog food, anyone?

2017-12-17 Thread Vikas Rawal

> 
>> BTW, I wasn't able to export manual.org using Org mode version 9.1.4
>> (9.1.4-elpaplus @ /Users/dk/.emacs.d/elpa/org-plus-contrib-20171205/).
>> It fails with this message:
>> 
>> format: Symbol’s value as variable is void: M-x
>> 
>> Does it depend on a more recent Org mode?
> 
> The file is in master branch. You need to use that to export it.
> 

Why do I have orgmanual.org  and not manual.org 
? My git repo is up to date with origin/master.

V.

Re: [O] [RFC] Dog food, anyone?

2017-12-17 Thread Vikas Rawal
> 
> The task started by Thomas S. Dye a couple years ago is now complete.
> The "manual.org" file in "contrib/" directory is an up-to-date,
> sometimes enhanced, version of the Org manual. Org can now eat its own
> dog food.
> 

This gives us a complex org file written by some of the finest orgers. Much to 
learn from this file.

Thanks to everyone who contributed to this.

Vikas




Re: [O] "header-args :eval inline-only" not working

2017-08-20 Thread Vikas Rawal

> 
>> I am on the latest version on org mode ELPA. It is dated August 18,
>> 2017, so should include the commit you mention.
> 
> `org-export-use-babel' is from "master" branch. ELPA provides "maint”.

Got it.

>> But this would prevent exporting all code blocks including inline blocks.
>> 
>> Isn’t it?
>> 
>> There seems no way of separately controlling inline and other blocks.
> 
> There is. You put :eval never-export on all src blocks and :eval t on
> inline code. Note, however, that inline code might call indirectly src
> blocks, so this can lead to odd situations.
> 
> What you are missing, probably, is some way to set this globally.

Right.

> Alas,
> `org-export-use-babel' or `org-export-babel-evaluate' is not the answer.
> As suggested in the thread you mentioned earlier, we might as well get
> rid of `org-export-use-babel' altogether. It seems to confuse many users
> and isn't very useful.
> 
> WDYT?
> 

I see no use for org-export-use-babel. But I can only speak for myself here.

In my own case, the src blocks are all R, and inline code is emacs-lisp. So, I 
can use "header-args:R :eval never-export” to turn off evaluation of R code at 
export time.

Vikas


Re: [O] "header-args :eval inline-only" not working

2017-08-19 Thread Vikas Rawal

>> 
>> I don’t see org-export-use-babel in available options. I cannot customise it.
>> 
>> '(org-export-use-babel (quote inline-only))
>> 
>> Seems to have no effect. Is that so because, as you say later, users are not 
>> supposed to touch this option?
> 
> No.  You must have an older version of org than
> 
> commit 3b5ce449c4b16291ad56e23d5be1e480e57d906f
> Author: Charles Berry >
> Date:   Sat Nov 12 18:54:20 2016 -0800
> 
>Replace `org-export-babel-evaluate' with `org-export-use-babel'
> 
> Did you try `C-h v org-export-use-babel RET', click `customize', etc?

I am on the latest version on org mode ELPA. It is dated August 18, 2017, so 
should include the commit you mention.

> C-h v org-export-use-babel RET’

Does not work (there is no such variable).

> Try
> 
> #+PROPERTY: header-args :eval never-export
> 
> and don't forget C-c C-c to update when you add this.

But this would prevent exporting all code blocks including inline blocks.

Isn’t it?

There seems no way of separately controlling inline and other blocks.

I guess I have to live with that.

Vikas



Re: [O] "header-args :eval inline-only" not working

2017-08-19 Thread Vikas Rawal

> 
> There is a bug in the documentation  -- `org-export-babel-evaluate' is 
> obsolete. It should say `org-export-use-babel’.

I don’t see org-export-use-babel in available options. I cannot customise it.

'(org-export-use-babel (quote inline-only))

Seems to have no effect. Is that so because, as you say later, users are not 
supposed to touch this option?

> But that part of the manual is irrelevant to what the `:eval' header does.  
> There is no `inline-only' value in either the documentation or in the lisp 
> code.  So, `inline-only' acts like `yes' for the reason I stated earlier.
> 
> 
>> With current org, I get this behaviour only if I globally set the option. 
>> But that somehow disables ":results”.
>> 
> 
> Right. `:results' is a babel header.  When babel is off, the babel headers 
> are not acted upon.
> 
> Setting `org-export-use-babel' to `nil' or `inline-only' turns off babel for 
> src blocks.
> 
> 
> The behavior was purposely changed. With `inline-only' none of the babel 
> operations will be executed for src blocks  -- i.e. the src blocks and 
> existing results (if any) will be exported as is.  
> 
> Users should avoid touching `org-export-use-babel' for almost all purposes.  
> It does not do the equivalent of setting `:eval' globally.
> 


I just saw this thread: 
https://lists.gnu.org/archive/html/emacs-orgmode/2017-02/msg00443.html 


I certainly feel that the current behaviour is a regression. The user should 
have the possibility of controlling globally or buffer-wide whether the source 
codes are evaluated at the time of export or not. org-export-use-babel does not 
do that. It turns off babel completely, exporting codes and existing results as 
is.

This is clearly a regression as far as my use case is concerned.

Vikas





Re: [O] "header-args :eval inline-only" not working

2017-08-19 Thread Vikas Rawal
> 
> 
> The first problem is that you have babel code *inside* a macro.  Since macros 
> are run after babel executes, nothing will happen.

From the manual: "Org expands macros at the very beginning of the export 
process.”

These macros run fine if I allow code evaluation. Macro replacement happens 
first, and then the code evaluation. That is not the problem.

> 
> Next, there is no `:eval inline-only'.  That seem to work only because only 
> the negative cases are checked. i.e. it is the same as `:eval yes' or even  
> `:eval yes-please-and-thank-you’.

Again, from the manual:

"To evaluate just the inline code blocks, set org-export-babel-evaluate to 
inline-only. Isolating the option to allow inline evaluations separate from 
‘src’ code block evaluations during exports is not for security but for 
avoiding any delays due to recalculations, such as calls to a remote database.”

With current org, I get this behaviour only if I globally set the option. But 
that somehow disables ":results”.

With older org, everything works as it should.

Vikas



Re: [O] "header-args :eval inline-only" not working

2017-08-19 Thread Vikas Rawal

> On 20-Aug-2017, at 12:57 AM, Nicolas Goaziou <m...@nicolasgoaziou.fr> wrote:
> 
> Hello,
> 
> Vikas Rawal <vikasli...@agrarianresearch.org> writes:
> 
>> My org-version (latest on org ELPA) is: Org mode version 9.0.9 
>> (9.0.9-82-gb862c2-elpa @ /Users/vikas/.emacs.d/elpa/org-20170814/)
>> 
>> The following is not working: 
>> 
>> #+PROPERTY: header-args :eval inline-only
>> 
>> ":eval never-export” works; but ":eval inline-only" does not.
> 
> What is "not working”?

":eval inline-only" has no effect. It still tries to evaluate all code blocks.


>> I can deal with this by globally changing the option using:
>> 
>> (org-export-babel-evaluate (quote inline-only))
>> 
>> But this creates another problem. After this, org does not respect “:exports 
>> results” and exports both the code and results.
> 
> Could you provide an ECM?

Please see the attached file.

When I export this, it still tries to evaluate the code block ind1_t2_hhd_code. 
If I use (org-export-babel-evaluate (quote inline-only)), it does not evaluate  
ind1_t2_hhd_code code block but it exports both the code and the output.

Vikas



testecm.org
Description: Binary data




[O] "header-args :eval inline-only" not working

2017-08-19 Thread Vikas Rawal
My org-version (latest on org ELPA) is: Org mode version 9.0.9 
(9.0.9-82-gb862c2-elpa @ /Users/vikas/.emacs.d/elpa/org-20170814/)

The following is not working: 

#+PROPERTY: header-args :eval inline-only

":eval never-export” works; but ":eval inline-only" does not.

I can deal with this by globally changing the option using:

(org-export-babel-evaluate (quote inline-only))


But this creates another problem. After this, org does not respect “:exports 
results” and exports both the code and results.

Has anyone else faced this?

If I start my emacs with a -q, emacs picks up the org version that came with my 
version of emacs (25.2.1):

Org-mode version 8.2.10 (release_8.2.10 @ 
/usr/local/Cellar/emacs-mac/emacs-25.2-z-mac-6.5/share/emacs/25.2/lisp/org/)

With this, everything works!  “:eval inline-only” is respected and so is 
“:exports results”.

Have I stumbled on a bug in the current version?

Vikas


[O] org-table.el

2017-08-19 Thread Vikas Rawal
Is it by choice that org-table.el is part of both org and org-plus-contrib? 
Does it have to be explicitly loaded?

Vikas


Re: [O] Table formula reference and macro replacement

2017-08-17 Thread Vikas Rawal
> 
> You could try:
> 
> --8<---cut here---start->8---
> #+macro: remote src_emacs-lisp{(org-table-get-remote-range "$1" "$2")}
> 
> Example:
> 
> #+name: foo
> | 1 | 2 |
> | 3 | 4 |
> 
> The macro call: {{{remote(foo, @1$2)}}}
> --8<---cut here---end--->8—
> 

Beautiful!

Vikas





[O] Table formula reference and macro replacement

2017-08-16 Thread Vikas Rawal
The idea is to pick contents of a table cell and use it in a paragraph.

Is it possible to have a macro like {{{remote(NAME-OR-ID,REF)}}} ?

The above does not work, but am I missing something?

Vikas



Re: [O] org babel, ess, R

2017-07-05 Thread Vikas Rawal
>> 
>> "... I'd like Org to pick up the fact that there's a :session
>> argument with a custom name and use that for C-RET in the edit buffer;
>> otherwise it generates the default *R* session there, but if you C-c
>> C-c the block later it puts it into the custom session name."
> 
> This is what `org-babel-switch-to-session-with-code' does.  BTW, it also 
> handles Vikas' original issue of displaying both the edit buffer and the 
> process buffer during editing src blocks.
> 
> So you might want is to use `org-babel-switch-to-session-with-code' rather 
> than `org-edit-src-code’.

Indeed this does what I was originally looking for. How does one exit from this 
neatly? What is the equivalent of org-edit-src-exit to use with this? Using 
org-edit-src-exit after org-babel-switch-to-session-with-code does not close 
the session window.

> I do not think I'd want to replace `org-edit-src-code' in `org-edit-special' 
> with that function by default, since it forces a session to start and 
> displays the process buffer which is kind of annoying when all I want to do 
> is browse code in an edit buffer.  It fails with an error when applied to a 
> src block with no session, so that would need to be handled if 
> `o-b-s-t-session-w-code' is supplied as an option.
> 

Yes, that makes sense.

Thanks,

Vikas




Re: [O] org babel, ess, R

2017-07-04 Thread Vikas Rawal

>> possibility of evaluating the code to test and see what happens?
> 
> Often, but not always.  And it would be seriously annoying to have the 
> session buffer pop up every time I wanted to browse the code in a src block 
> while simultaneously viewing the results of a previous invocation in the org 
> buffer.
> 
> As noted by others C-RET (or C-c C-n) on an empty line will make the session 
> buffer visible.
> 
> So will C-c C-z C-c C-z if you are in an ESS[S] mode buffer (and it will do 
> that without trying to eval anything).

This is neat. Solves my problem.

Thanks.

Vikas


Re: [O] org babel, ess, R

2017-07-03 Thread Vikas Rawal

> On 04-Jul-2017, at 1:22 AM, John Hendy <jw.he...@gmail.com> wrote:
> 
> On Sun, Jul 2, 2017 at 7:17 PM, Vikas Rawal
> <vikasli...@agrarianresearch.org> wrote:
>>> 
>>> Vikas Rawal <vikasli...@agrarianresearch.org> writes:
>>> 
>>>> Isn’t is what most users need while editing the code block? The
>>>> possibility of evaluating the code to test and see what happens?
>>> 
>>> 
>>> Many languages do not support sessions. So, the only possibility to
>>> evaluate the code is to evaluate the code block in the source buffer.
>>> 
>> 
>> Yes, what I am talking about is relevant only when a session is defined. 
>> What I would like is that if in a file the session is defined, C-c’ creates
>> a window configuration that shows the edit buffer and the session. In other 
>> cases, the two windows could show the edit buffer and the original org 
>> buffer.
> 
> As a frequent R user, I completely relate to this. As soon as one
> evaluates code in the session buffer (C-c ') with C-RET, this is the
> setup you get.
> 

Oh! C-RET: I didn’t know this. And this itself is a big help. It is so much 
easier than having to change the buffer manually!

> I'd add to your wish that upon first visiting a file, if I go into
> edit mode, I'd like Org to pick up the fact that there's a :session
> argument with a custom name and use that for C-RET in the edit buffer;

C-RET seems to be picking up the custom session name if it is already there. 
But otherwise it generates the default *R* session there,

This should surely be fixed.
> 
> Anyway, it's easy enough to run one line with C-RET once editing and
> get the session buffer, but just getting it right away is also what I
> would prefer.
> 

I agree and echo.

Thanks a ton for C-RET :)

Vikas




Re: [O] org babel, ess, R

2017-07-02 Thread Vikas Rawal
> 
> for what it's worth, I usually run two windows (in the same frame), 
> side-by-side, with emacs maximised.
> On the left I have my org file and on the right I have an R session, which I 
> start immediately after I open my org file.
> When I use C-c ' on an R source block, the org buffer (on the left) is 
> replaced by by the source code edit buffer - leaving the R-session on the 
> right untouched.
> That way I can either evaluate a whole code block (from org using C-c C-c) or 
> go through the source code line-by-line (using ESS).
> Seems like that's what you want to do, too.
> Anyway, just my two cents worth, in case it helps.

Thanks Andreas. I am perhaps being to finicky. The problem with your approach 
is that you would end up permanently losing screen space for the R session. I 
don’t want the R session obstructing my writing when I am not working on code 
blocks. Ideally, the R session should appear only when I am editing the code 
blocks in an edit buffer.

Vikas



Re: [O] org babel, ess, R

2017-07-02 Thread Vikas Rawal
> 
> Vikas Rawal <vikasli...@agrarianresearch.org> writes:
> 
>> Isn’t is what most users need while editing the code block? The
>> possibility of evaluating the code to test and see what happens? 
> 
> 
> Many languages do not support sessions. So, the only possibility to
> evaluate the code is to evaluate the code block in the source buffer.
> 

Yes, what I am talking about is relevant only when a session is defined. What I 
would like is that if in a file the session is defined, C-c’ creates
a window configuration that shows the edit buffer and the session. In other 
cases, the two windows could show the edit buffer and the original org buffer.


Vikas


Re: [O] org babel, ess, R

2017-07-01 Thread Vikas Rawal
> 
>> When I press C-c' in an R code block to open an edit buffer with ess, on my
>> computer, it splits the screen into two side-by-side windows, with the new
>> window on the right showing the edit buffer, and the window on the left
>> showing the original file.
>> 
>> I would like to change this behaviour in two ways.
>> 
>> 1. I would like the window that continues to show the original file to
>> instead show the R session in which lines from the edit buffer can be
>> evaluated. I can manually change the buffer in this window to show me the R
>> session but I was wondering if this can be the default behaviour.
> 
> I fail to see how this could be a default behaviour since this is very
> specific to R source blocks.
> 

Isn’t is what most users need while editing the code block? The possibility of 
evaluating the code to test and see what happens? At present, one window shows 
the original buffer, which is, at least in my case, not needed while I am 
editing the code.

Is this an R specific need? Do people working with other languages not need 
this?


> I suggest to implement your own `org-edit-special' wrapper, and bind it
> to C-c ' (or advise the function).
> 


Thanks for the pointer. Let me look at this.

Thanks and best wishes,

Vikas




Re: [O] org babel, ess, R

2017-06-30 Thread Vikas Rawal

> 
> When I press C-c' in an R code block to open an edit buffer with ess, on my 
> computer, it splits the screen into two side-by-side windows, with the new 
> window on the right showing the edit buffer, and the window on the left 
> showing the original file.
> 
> I would like to change this behaviour in two ways.
> 
> 1. I would like the window that continues to show the original file to 
> instead show the R session in which lines from the edit buffer can be 
> evaluated. I can manually change the buffer in this window to show me the R 
> session but I was wondering if this can be the default behaviour.
> 
> 2. Split the screen horizontally rather than vertically, so that the new 
> window (with edit buffer) is on the top and the second window is below. I 
> could live with the edit buffer being at the bottom also but would certainly 
> prefer seeing it above so that I have the R session in the window below to 
> which I send the evaluated lines one by one.
> 

I can change the direction of split by adjusting split-width-threshold

So, item 2 is more or less resolved (the edit buffer is at the bottom, but that 
is okay).

Vikas


[O] org babel, ess, R

2017-06-30 Thread Vikas Rawal
When I press C-c' in an R code block to open an edit buffer with ess, on my
computer, it splits the screen into two side-by-side windows, with the new
window on the right showing the edit buffer, and the window on the left
showing the original file.

I would like to change this behaviour in two ways.

1. I would like the window that continues to show the original file to
instead show the R session in which lines from the edit buffer can be
evaluated. I can manually change the buffer in this window to show me the R
session but I was wondering if this can be the default behaviour.

2. Split the screen horizontally rather than vertically, so that the new
window (with edit buffer) is on the top and the second window is below. I
could live with the edit buffer being at the bottom also but would
certainly prefer seeing it above so that I have the R session in the window
below to which I send the evaluated lines one by one.

Does anyone know if it may already be possible to achieve this? Or am I
making a feature request?

Vikas


  1   2   3   4   5   >