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


Re: [O] Bug: begin_src org :results replace does not work

2017-05-29 Thread Vikas Rawal
>
>>
> The problem is that the results you generate is a table with affiliated
> keywords NAME and CAPTION and ATTR_[backend].
>
> `org-at-table-p' does not recognize that the keywords are followed by a
> table.  Altering this function might be asking for trouble as it is used
> outside babel.
>
> So maybe the cond test should refer to `org-element-context' to better
> sort this out and correctly identify the table end.
>
>
Thanks for the explanation.

Since this was meant for use in a tutorial, I wanted #+NAME, etc to be
there.

I will have to use some other work around. :wrap does not work for me, as
it does not remove the , escape characters.

Thanks again,

Vikas


[O] Bug: begin_src org :results replace does not work

2017-05-28 Thread Vikas Rawal
Why does the replace keyword not work? It prepends the results. I have
tried both ":results value replace" and ":results output replace".

I am on org-version 9.0.7

Vikas




#+NAME: one
#+BEGIN_SRC org :results value replace export both
,#+NAME: table-yield
,#+CAPTION: Simple table created using latex tabular environment
,#+attr_latex: :environment tabular :width \textwidth :align lrr
| State  | Variable one | Varia two |
|+---+|
| MP |   672 |  13000 |
| Har|   300 |  25000 |
| Pun|   260 |  35000 |
#+End_SRC


[O] multicolumn cells in latex export

2016-11-05 Thread Vikas Rawal
Two years ago, Eric Schulte had shared some most useful code snippets 
(https://lists.gnu.org/archive/html/emacs-orgmode/2014-08/msg00113.html 
). This 
included an export filter (code pasted below) that provided a very useful way 
of introducing multicolumn cells in latex export.

I have been using this since then without any trouble. But today I tried using 
it to centre-align column headings in the top row by using <1colc>. While it 
works for other columns, it does not work on the last column. 

The last column gets exported as 
\multicolumn{1}{c}{Australia (2015)\\
}\hline

rather than as

\multicolumn{1}{c}{Australia (2015)}\\
\hline

Can anyone help debug what is wrong with this code?

Vikas

---

;;; Multi-column Table Cells
;;
;; Export table cells with multiple columns using Latex-like syntax.
;; For example in the following the "<3colc>Backends" cell spans 3
;; columns with it's text centered.
;;
;; |   | <3colc>Backends |   |   |
;; |   |   LaTeX |  HTML |  Text |
;; |---+-+---+---|
;; | extension |.tex | .html | .txt  |
;;
;; The `org-export-multicolumn-filter-latex' function is taken from
;; the following.
;; 
http://thread.gmane.org/gmane.emacs.orgmode/66332/match=latex+table+multicolumn+cell
(defun org-export-multicolumn-filter (row backend info)
  (cond
   ((org-export-derived-backend-p backend 'latex)
(org-export-multicolumn-filter-latex row backend info))
   ((org-export-derived-backend-p backend 'html)
(org-export-multicolumn-filter-html row backend info

(defun org-export-multicolumn-filter-latex (row backend info)
  (while (string-match
  "\\(<\\([0-9]+\\)col\\([lrc]\\)?>[[:blank:]]*\\([^&]+\\)\\)" row)
(let ((columns (string-to-number (match-string 2 row)))
  (start (match-end 0))
  (contents (replace-regexp-in-string
 "" ""
 (replace-regexp-in-string "[[:blank:]]*$" ""
   (match-string 4 row
  (algn (or (match-string 3 row) "l")))
  (setq row (replace-match
 (format "multicolumn{%d}{%s}{%s}" columns algn contents)
 nil nil row 1))
  (while (and (> columns 1) (string-match "&" row start))
(setq row (replace-match "" nil nil row))
(decf columns
  row)

(defun org-export-multicolumn-filter-html (row backend info)
  (while (string-match "class=\".*\" *>\\([0-9]+\\)col\\([lrc]\\)?" row)
(let ((columns (string-to-number (match-string 1 row)))
  (start (match-end 0))
  (algn (case (intern (or (match-string 2 row) "l"))
  (c "center")
  (r "right")
  (l "left"
  (setq row (replace-match
 (format " class=\"%s\" colspan=\"%s\">" algn columns)
 nil nil row))
  (while (and (> columns 1)
  (string-match "" row start))
(setq row (replace-match "" nil nil row))
(decf columns
  row)

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



Re: [O] member-ignore-case: Wrong type argument: stringp, nil

2016-10-18 Thread Vikas Rawal
> 
>>> On 12-Oct-2016, at 9:10 am, Vikas Rawal <vikasli...@agrarianresearch.org> 
>>> wrote:
>>> 
>>> Wrong type argument: stringp, nil
>> 
>> 
>> Debug gives me this:
>> 
>> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
> 
> I guess this is a cache bug. Try M-x org-element-cache-reset in a buffer
> where the error happens. Does it disappear?
> 

You are perhaps right. M-x org-element-cache-reset did not solve the problem 
but restarting emacs did.

Thanks.

Vikas




Re: [O] member-ignore-case: Wrong type argument: stringp, nil

2016-10-11 Thread Vikas Rawal

> On 12-Oct-2016, at 9:10 am, Vikas Rawal <vikasli...@agrarianresearch.org> 
> wrote:
> 
> Wrong type argument: stringp, nil


Debug gives me this:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  compare-strings(nil 0 nil "CAPTION" 0 nil t)
  member-ignore-case(nil ("CAPTION"))
  #[0 "\212\214~\210`\300\206\306 
\211\211:\204\211;\205$\307\262\202&\211@9\205$\211@\262\310\211;\2037\311\312#\266\202\202?\313A@\"\266\202\211\203\233W\203\233\314
 
\210\315\316\n!\210)\317\320\321!\"\204d\322\323\"\210\202\225\312\225W\203t\312\225\324
 
}\210\202\225\325\224\203\220\325\224Y\203\220\325\225W\203\220\325\224\325\225}\210\202\225\322\323\"\210\326\262\202=\327=\203\370\330\211;\203\262\311\312#\266\202\202\272\313A@\"\266\202\211\203\305\331
 U\204\315\322\323\"\210\202\364\314 \210\332\324 
\"\210\312\224b\210`Y\203\357\312\225W\203\357`\312\225}\210\202\364\322\323\"\210\210\202=\333>\203R\334\211;\203\311\312#\266\202\202\313A@\"\266\202b\210\316\f!\210\335\225\211\204+\322\323\"\210\202N\335\224b\210\336\316
!)\203<\312\225b\210`Y\203J\322\323\"\210\202N`}\210\210\202=\337>\203\272\340\211;\203i\311\312#\266\202\202q\313A@\"\266\202\341\211;\203\202\311\312#\266\202\202\212\313A@\"\266\202\203\257\211\203\257Y\203\257W\204\250U\203\257m\203\257}\210\202\265\322\323\"\210\266\202=\342=\2038\343\211\203/\211@\211\211;\203\330\311\312#\266\202\202\340\313A@\"\266\202\211\203'\334\211;\203\365\311\312#\266\202\202\375\313A@\"\266\202X\203'\344\211;\203\311\312#\266\202\202\313A@\"\266\202V\203'\322\323\"\210\210A\266\202\202\301\210\322\323\"\210\202=\322\323\"\210eb\210\2119\203J\211\202e\211\211:\204[\211;\205c\307\262\202e\211@9\205c\211@\2623\236A\262CC4\203~5\203~\345\346!\204\202\336\202\2236\203\217\3476\"\202\223\350
 \210\336C\336C\336C\336C\351\352\353\312\354\355\356





&\357\"\360\361%D\215\362\n\242\"\210\266\206\266\204*\207" [nil 
case-fold-search org-element--affiliated-re org-element-parsed-keywords 
org-complex-heading-regexp org-comment-string org-element-at-point plain-text 
:post-affiliated get-text-property 0 plist-get beginning-of-line t looking-at 
member-ignore-case match-string 1 throw objects-forbidden line-end-position 2 
keyword item :tag line-beginning-position search-forward (headline inlinetask) 
:begin 4 nil (paragraph table-row verse-block) :contents-begin :contents-end 
planning (:closed :deadline :scheduled) :end derived-mode-p org-mode gethash 
org-element-cache-reset exit funcall make-byte-code 
"\304\242\204\"\302\242\303\242\236\211\203\305\240\210\202!\303\305\302\242\307D\240\303\242B\240\210\210\310\311\312\313\314\315\316\300\301\302\304\305%\317\"\320\321%D\215\210\304\242\203[\322\304\242\211;\203N\323\313#\266\202\202V\324A@\"\266\202\300V\203i\325\326\306\242\206d\302\242\"\210\202\327\304\242\211;\203{\323\313#\266\202\202\203\324A@\"\266\202\330\304\242\211;\203\225\323\313#\266\202\202\235\324A@\"\266\202\331\304\242\211;\203\257\323\313#\266\202\202\267\324A@\"\266\202\300X\203\334dU\204\334b\210\300U\203T`Sf\332>\204T\306\304\242\240\210\202T\203N\211\203N\300Y\203N\300W\204\300U\203Nd\300U\204\300\206`Sf\333>\204Nb\210`}\210\302\304\242\240\210\301\304\242\2119\203
 
\211\202;\211\211:\2041\211;\2059\334\262\202;\211@9\2059\211@\262\236A\262\240\210\304\307\240\210\305\307\240\210\202T\325\326\304\242\"\210\266\202"
 vconcat vector [nil found funcall make-byte-code 0 
"\303\242\203\303\305\301\242!\240\210\202\312\304\242\211AA\262\304\242A@\204+\211\203+\306\307\302\242\"\210\202\310\2049\303\305\301\242!\240\210\202\310\310@\211;\203K\311\312#\266\202\202S\313A@\"\266\202\211\300Y\203\275\211\203\263\211@\314\211;\203q\311\312#\266\202\202y\313A@\"\266\202\300X\203\254\310\211;\203\217\311\312#\266\202\202\227\313A@\"\266\202\300Y\203\246\306\315\303\240\"\210\202\254\306\307\302\242\"\210A\266\202\202Z\306\307\302\242\"\266\202\307\211b\210\303\305\301\242!\240\210\210\266\303\242\203\303\242\316\302\242;\203\344\317\320$\266\203\202\362A\321A@#\240\210\266\203\210\304\242\211A\303\242\211AA\262B\241\207\304\242A\322\240\207"
 vconcat vector [org-element--object-lex throw exit :end get-text-property 0 
plist-get :begin found :parent org-add-props nil plist-put t] 11 "\n\n(fn)" 
:begin get-text-property plist-get throw exit :end :contents-begin 
:contents-end (32 9) (32 9) plain-text org-element-object-restrictions] 12 
"\

[O] member-ignore-case: Wrong type argument: stringp, nil

2016-10-11 Thread Vikas Rawal
I get this message when trying to export an org file (with embedded source code 
blocks) to latex:

member-ignore-case: Wrong type argument: stringp, nil

How do I go about figuring out what exactly is going wrong?

I have tried to isolate the problem by removing stuff from the file, to see 
when does the problem go away. Some source code blocks seem to cause it. If I 
remove them, the problem goes. But there is nothing in those code blocks.. For 
example, the one below is giving me trouble. 

#+NAME: australiafabainst
#+BEGIN_SRC R :results output graphics :exports results :file 
australia-faba-instability.png :width 1200 :height 700  :type cairo :family 
serif :session pulses

## Some R code here to make a graph

#+END_SRC

But there are many others like this, which are not giving any error.

Vikas




Re: [O] latex_class_options

2016-09-15 Thread Vikas Rawal
Sorry, please ignore. I did something dumb.

My apologies.

Vikas


> On 15-Sep-2016, at 5:59 pm, Vikas Rawal <vikasli...@agrarianresearch.org> 
> wrote:
> 
> I have a latex class defined as follows
> 
>  (add-to-list 'org-latex-classes
>   '(("pulsememoir" "\\documentclass{memoir}"
> ("\\chapter{%s}" . "\\chapter*{%s}")
> ("\\section{%s}" . "\\section*{%s}")
> ("\\subsection{%s}" . "\\subsection*{%s}")
> ("\\subsubsection{%s}" . "\\subsubsection*{%s}"
> 
> In my org file, I have the following:
> 
> #+LATEX_CLASS: pulsememoir
> #+LaTeX_CLASS_OPTIONS: 
> [a4paper,11pt,twoside,openany,strict,extrafontsizes,twocolumn]
> 
> But when I export, I get:
> 
> \documentclass[8pt]{memoir}
> 
> Why is #+LATEX_CLASS_OPTIONS ignored? Has the syntax changed?
> 
> This is my org-version:
> Org-mode version 8.3.5 (release_8.3.5-1026-g096f42 @ 
> /Users/vikas/.emacs.d/src/org-mode/lisp/)
> 
> 
> 




[O] latex_class_options

2016-09-15 Thread Vikas Rawal
I have a latex class defined as follows

  (add-to-list 'org-latex-classes
   '(("pulsememoir" "\\documentclass{memoir}"
 ("\\chapter{%s}" . "\\chapter*{%s}")
 ("\\section{%s}" . "\\section*{%s}")
 ("\\subsection{%s}" . "\\subsection*{%s}")
 ("\\subsubsection{%s}" . "\\subsubsection*{%s}"

In my org file, I have the following:

#+LATEX_CLASS: pulsememoir
#+LaTeX_CLASS_OPTIONS: 
[a4paper,11pt,twoside,openany,strict,extrafontsizes,twocolumn]

But when I export, I get:

\documentclass[8pt]{memoir}

Why is #+LATEX_CLASS_OPTIONS ignored? Has the syntax changed?

This is my org-version:
Org-mode version 8.3.5 (release_8.3.5-1026-g096f42 @ 
/Users/vikas/.emacs.d/src/org-mode/lisp/)






Re: [O] Emacs movement keys

2016-08-29 Thread Vikas Rawal

> On 29-Aug-2016, at 6:55 pm, John Kitchin  wrote:
> 
>> You know you're an Emacs user when...
> 
> You select some text in MS Word and Type C-w to cut it... and are very
> unhappy when Word closes...

Story of emacs users on OS X...

Vikas



[O] :exports not being respected

2016-08-09 Thread Vikas Rawal
I have a with just the following header, and it is not respecting :exports in 
my R source blocks. The pdf file created has source code as well as the results.

What is wrong? Has the syntax changed again? I have not done anything with 
org-export-babel-evaluate.

#+TITLE: Title of this document
#+TODO: NOTES EXERCISE | DONE
#+OPTIONS: toc:nil
#+LATEX_CLASS: article
#+PROPERTY: header-args :eval never-export
#+PROPERTY: header-args :session ec404


I am on Org-mode version 8.3.5 (release_8.3.5-1026-g096f42)

Vikas




Re: [O] error while upgrading to 8.3.5

2016-07-25 Thread Vikas Rawal

* I cleaned up permissions to some directories and did a make install, which 
went fine.

* Now when I do a “make up2”, I get two errors.

   FAILED  test-ob/indented-cached-org-bracket-link
   FAILED  test-org-colview/columns-summary

* Output of BTEST_RE=columns-summary make test

Test test-org-colview/columns-summary condition:
(ert-test-failed
 ((should
   (equal "705d 01h 0m 0s"
  (cl-letf ... ...)))
  :form
  (equal "705d 01h 0m 0s" "705d 00h 0m 0s")
  :value nil :explanation
  (array-elt 6
 (different-atoms
  (49 "#x31" "?1")
  (48 "#x30" "?0")
   FAILED  1/1  test-org-colview/columns-summary

Ran 1 tests, 0 results as expected, 1 unexpected (2016-07-26 05:03:52+0530)

1 unexpected results:
   FAILED  test-org-colview/columns-summary

mk/targets.mk:103: recipe for target 'test' failed
make: *** [test] Error 1

* Output of BTEST_RE=indented-cached-org-bracket-link make test

Test test-ob/indented-cached-org-bracket-link condition:
(ert-test-failed
 ((should
   (let
   (...)
 (org-test-with-temp-text "\n* Test\n  #+BEGIN_SRC emacs-lisp 
:file test.txt :cache yes\n(message \"test\")\n  #+END_SRC" ... ...)))
  :form
  (let
  ((default-directory temporary-file-directory))
(org-test-with-temp-text "\n* Test\n  #+BEGIN_SRC emacs-lisp 
:file test.txt :cache yes\n(message \"test\")\n  #+END_SRC"
  (org-babel-execute-src-block)
  (string= ... ...)))
  :value nil))
   FAILED  1/1  test-ob/indented-cached-org-bracket-link

Ran 1 tests, 0 results as expected, 1 unexpected (2016-07-26 05:06:12+0530)

1 unexpected results:
   FAILED  test-ob/indented-cached-org-bracket-link

* (org-parse-time-string "<2014-03-04 Tue>”)
(apply #'encode-time (org-parse-time-string "<2014-03-04 Tue>"))

Evaluating these in emacs does not seem to do anything. No message.

> 
> What is the result of evaluating both
> 
>  (org-parse-time-string "<2014-03-04 Tue>")
> 
> and
> 
>  (apply #'encode-time (org-parse-time-string "<2014-03-04 Tue>"))
> 
> ?
> 
> Regards,




Re: [O] error while upgrading to 8.3.5

2016-07-25 Thread Vikas Rawal
> 
>> I did the usual "make up2" in my git repository but got the following
>> error (just pasting the tail of the log):
> 
> Note that "make up2" doesn't upgrade to 8.3.5, as subject suggests, but
> moves to the head of the development version, i.e., something like
> 9.0-alpha.

hmm. Let me deal with that once I figure out what is wrong with “make up2”.

>> 
>> What do I do? Re-install?
> 
> Could you run the failing test again using, e.g.,
> 
>  BTEST_RE=columns-summary make test
> 
> and paste the exact failure?

This is what I get:

Test test-org-colview/columns-summary backtrace:
  (if (unwind-protect (setq value-2 (apply fn-0 args-1)) (
  (let (form-description-4) (if (unwind-protect (setq value-2
  (let ((value-2 (quote ert-form-evaluation-aborted-3))) (let
  (let ((fn-0 (function equal)) (args-1 (list "705d 01h 0m 0s"
  (closure (t) nil (let ((fn-44355 (function equal)) (args-44356 (list
  #[0 "\306\307!r\211q\210\310\311\312\313\314\315!\316\"\317\320%DC
  funcall(#[0 "\306\307!r\211q\210\310\311\312\313\314\315!\316\"\31
  ert--run-test-internal([cl-struct-ert--test-execution-info [cl-struc
  #[0 "r\304 q\210\305 )\306\307\310\311\312\313!\314\"\315\316%DC\2
  funcall(#[0 "r\304 q\210\305 )\306\307\310\311\312\313!\314\"\315\
  ert-run-test([cl-struct-ert-test test-org-colview/columns-summary "T
  ert-run-or-rerun-test([cl-struct-ert--stats "columns-summary" [[cl-s
  ert-run-tests("columns-summary" #[385 "\306\307\"\203D\211\211G\31
  ert-run-tests-batch("columns-summary")
  ert-run-tests-batch-and-exit("columns-summary")
  (let ((org-id-track-globally t) (org-test-selector (if org-test-sele
  org-test-run-batch-tests("columns-summary")
  eval((org-test-run-batch-tests org-test-select-re))
  command-line-1(("--eval" "(setq vc-handled-backends nil org-startup-
  command-line()
  normal-top-level()
Test test-org-colview/columns-summary condition:
(ert-test-failed
 ((should
   (equal "705d 01h 0m 0s"
  (cl-letf ... ...)))
  :form
  (equal "705d 01h 0m 0s" "705d 00h 0m 0s")
  :value nil :explanation
  (array-elt 6
 (different-atoms
  (49 "#x31" "?1")
  (48 "#x30" "?0")
   FAILED  1/1  test-org-colview/columns-summary

Ran 1 tests, 0 results as expected, 1 unexpected (2016-07-25 18:37:21+0530)


[O] error while upgrading to 8.3.5

2016-07-24 Thread Vikas Rawal
I did the usual "make up2" in my git repository but got the following error 
(just pasting the tail of the log):

—

Ran 634 tests, 633 results as expected, 1 unexpected (2016-07-25 06:07:28+0530)
7 expected failures

1 unexpected results:
   FAILED  test-org-colview/columns-summary

mk/targets.mk:103: recipe for target 'test-dirty' failed
make[1]: *** [test-dirty] Error 1
make[1]: Leaving directory '/Users/vikas/.emacs.d/src/org-mode'
mk/targets.mk:115: recipe for target 'up2' failed
make: *** [up2] Error 2

—

What do I do? Re-install?

Vikas


Re: [O] Unable to resolve link: nil

2016-07-22 Thread Vikas Rawal
> 
>> Working on long, complex documents, I sometimes have a wrongly pointed
>> link. And when I try to export it, I get the error: "Unable to resolve
>> link: nil”. Is there a straightforward way to find out which link is
>> not resolving?
> good question ;). I spent half an hour this week in a similar situation ;).
> I used bisecting to find the problem. In my case it was a space before
> the protocol: [[ http://foo.bar][foo]].


I am unable to export individual headlines because of many cross-references. An 
individual headline refuses to export because of them. So, exporting parts of 
the document to narrow down to the part where the problem is does not work for 
me.

Vikas 


Re: [O] Unable to resolve link: nil

2016-07-22 Thread Vikas Rawal
> 
>> 
>> (untested)
>> 
>> Does org-lint help? 
> 
> Oh wow!
> 

org-lint helped identify several errors but this problem remains.

Vikas




Re: [O] Unable to resolve link: nil

2016-07-22 Thread Vikas Rawal
> 
> (untested)
> 
> Does org-lint help? 

Oh wow!

Thanks.

Vikas




[O] Unable to resolve link: nil

2016-07-22 Thread Vikas Rawal
Working on long, complex documents, I sometimes have a wrongly pointed link. 
And when I try to export it, I get the error: "Unable to resolve link: nil”. Is 
there a straightforward way to find out which link is not resolving?

Vikas


Re: [O] Cross-reference to Tables and Figures in Latex export is broken

2016-06-12 Thread Vikas Rawal
I updated org, and now :exports results has stopped working, and I am getting 
both the code and the results in my output!!!

V.


> On 13-Jun-2016, at 9:25 am, Vikas Rawal <vikasli...@agrarianresearch.org> 
> wrote:
> 
> This must be a result of some recent update.
> 
> When I export to pdf via xelatex, cross references to Tables and Figures in 
> my org document get messed up. Table/Figure numbers in cross-references are 
> wrong.
> 
> Has anyone else faced this?
> 
> Vikas




  1   2   3   4   5   >