LaTeX Headers not in partial export

2020-10-22 Thread Mike Gauland

Not sure if I'm doing something wrong, or this is expected.

I have a number of #+LATEX directives at the top of my org file, for 
configuring the minted package.


When I export the whole thing to LaTeX, the source blocks are formatted 
with the desired minted options.


If I export only part of the document--either my marking it, or by 
adding an "export" tag--the source blocks are *not* formatted with the 
desired options. On looking at the generated tex file, I find that the 
options from the top of the org file are missing.


Does this sound like a bug, or user (possibly local configuration) 
error? If the former, I'll generate a small file that demonstrates the 
problem.


Kind regards,

MIke





Re: org-table-sum

2020-10-22 Thread Jeremie Juste
Hello

I have figured out that calc-eval might do the job for the floating
point problem for org.

(info "(calc) Calling Calc from Your Programs")

(calc-eval "83.6+0.1")


So in the function org-table-sum I have made the following modification:
> (res (string-to-number (calc-eval (combine-and-quote-strings  (mapcar 
> 'number-to-string numbers )  "+"


modified   lisp/org-table.el
@@ -4771,7 +4771,7 @@ If NLAST is a number, only the NLAST fields will actually 
be summed."
  (nreverse items
 (numbers (delq nil (mapcar #'org-table--number-for-summing
items1)))
-(res (apply '+ numbers))
+(res (string-to-number (calc-eval (combine-and-quote-strings  
(mapcar 'number-to-string numbers )  "+"
 (sres (if (= org-timecnt 0)
   (number-to-string res)
 (setq diff (* 3600 res)


I believe that the org-table--number-for-summing function can be
bypassed but my elisp foo is weak. Feel free to improve.

Best regards
Jeremie



Re: Bug: Can’t assign to hline relative reference

2020-10-22 Thread Dante Catalfamo
That seems to work for the most part, but now I'm experiencing a strange 
difference when evaluating. If I use a formula like

 
#+TBLFM:@2$3..@23$3=if($2!=0,12*$2,$3);%.2f::@24$2=vsum(@I..@II);%.2f::@24$3=vsum(@I..@II);%.2f

The column gets evaluated first, then the sum at the bottom gets 
evaluated, resulting in what I'd expect. But if I use a formula like

#+TBLFM:@<<$3..@>>$3=if($2!=0,12*$2,$3);%.2f::@24$2=vsum(@I..@II);%.2f::@24$3=vsum(@I..@II);%.2f

The sum gets calculated first, and the column after, meaning the sum 
doesn't reflect any changes made before calculation. I find this pretty 
strange considering the formulas are in the same order. Do formulas 
involving relative references get calculated last for some reason?

On 2020-10-22 8:04 a.m., Maxim Nikulin wrote:
> 
> Dante Catalfamo wrote:
>> In the case where I'm using this formula, there are many more rows
>> between @I..@II. I only used two in the example to keep the email small.
>> I would also be adding more rows regularly, making it slightly
>> impractical to be adjusting the beginning and end points of the formula
>> every time I add or remove a row. I appreciate your suggestion, though I
>> was hoping for a more convenient solution. If nothing else works, that's
>> what I'll do.
> 
> You are not alone. From my point of view it is not clear enough from org
> manual that @I references could be used only to the right of "=". The
> error message was a bad surprize. Another similar pitfal was with named
> columns.
> 
> However in some cases @<< (unlike @2 remains unchanged if a new line is
> added before second row) and @>> could be a workaround. If there are
> several horizontal lines, sometimes it is possible to mark particular
> lines with # and use e.g. $3=vsum(@-I$-1..@+I$-1) to avoid proliferation
> of same formulas for each table section.
> 
> 




Re: Babel->Latex export: how to set includegraphics scale?

2020-10-22 Thread TEC



Hi Mirko

Mirko Vukovic  writes:

Instead specifying the width, I'd like to use the parameter 
\scale.


Have you tried #+attr_latex: :scale SCALE ?

Not sure how you'd put this in a header though I'm afraid - you'll
likely want to change a variable or add an export filter.

Hope something there may be of use,
Timothy.



Babel->Latex export: how to set includegraphics scale?

2020-10-22 Thread Mirko Vukovic
Hello,

I use Babel to create UML diagrams using plantUML. The codeblocks produce
png files.

When exported to LaTeX, the png files are imported using \includegraphics.
The width is set to 0.9\linewidth

Instead specifying the width, I'd like to use the parameter \scale.

Ideally, I would set \scale in the document header, possibly over-riding
the setting when necessary.

Is this possible, and if so, can you point me to the documentation? I could
not find any.

Thank you,

Mirko


Re: Interview with Rainer König - who's content made me go from vim to emacs for coding :D

2020-10-22 Thread Palak Mathur




> On Oct 22, 2020, at 9:53 AM, Xianwen Chen  wrote:
> 
> 
> Thank you.
> 
> Do you by the way have a URL to Rainer König's org-mode course?
> 

https://www.youtube.com/playlist?list=PLVtKhBrRV_ZkPnBtt_TD1Cs9PJlU0IIdE







>  
> 
> 
>> On 2020-10-21 07:27, Martin Schröder wrote:
>> 
>> Today I had the chance to do a lengthy interview with Rainer König who is 
>> known for creating a very popular Org Mode course. 
>>  
>> The first part is about how Rainer got started and the story of how Org Mode 
>> saved his life during a very difficult time: 
>> https://www.youtube.com/watch?v=L_DYO0_eJ6A
>>  
>> In the second part of the interview we look at how Rainer manages his org 
>> mode setup with multiple files and weekly reviews. Rainer is tremendously 
>> methodical and a really good teacher.
>>  
>> Here is the recording of the second part: 
>> https://www.youtube.com/watch?v=kPKhS-QDn7c
>>  
>> Enjoy! 
>>  
>> -- 
>> Best regards,
>>  
>> Martin Schröder
>> Embedded Systems Consultant, Firmware Expert
>>  
>> Tel: +46-733-38-76-94
>> LinkedIn: https://www.linkedin.com/in/martinschroder/
>>  
>> Learn How To Build Embedded Products From Step 1 to Step 90: 
>> https://swedishembedded.com/learn/


Re: Interview with Rainer König - who's content made me go from vim to emacs for coding :D

2020-10-22 Thread 陈贤文
Thank you. 

Do you by the way have a URL to Rainer König's org-mode course? 

Yours sincerely, 


Xianwen

On 2020-10-21 07:27, Martin Schröder wrote:

Today I had the chance to do a lengthy interview with Rainer König who is known for creating a very popular Org Mode course.  

The first part is about how Rainer got started and the story of how Org Mode saved his life during a very difficult time: https://www.youtube.com/watch?v=L_DYO0_eJ6A 

In the second part of the interview we look at how Rainer manages his org mode setup with multiple files and weekly reviews. Rainer is tremendously methodical and a really good teacher. 

Here is the recording of the second part: https://www.youtube.com/watch?v=kPKhS-QDn7c 

Enjoy! 
--


Best regards, 

Martin Schröder 
_Embedded Systems Consultant, Firmware Expert_ 

Tel: +46-733-38-76-94 
LinkedIn: https://www.linkedin.com/in/martinschroder/ 


Learn How To Build Embedded Products From Step 1 to Step 90: 
https://swedishembedded.com/learn/ [1]



Links:
--
[1] https://swedishembedded.com/learn

Re: Bug: org-plus-contrib freezes emacs when opening file [9.4 (9.4-19-gb1de0c-elpaplus @ /Users/gb4dt/.emacs.d/elpa/org-plus-contrib-20201019/)]

2020-10-22 Thread Russell Adams
On Wed, Oct 21, 2020 at 01:21:33PM -0400, Georgios Bakirtzis wrote:
> Org without contrib does not have the following issue.
>
> A vanilla setup with the just latest org-plus contrib completely freezes emacs
> when trying to open a file with the attached export command in it.
> It causes the computer to use 100% cpu
> and_might_ load after some time (in hours)
> but will freeze again if the cursor goes anywhere near
> #+BEGIN_EXPORT -- #+END_EXPORT.
> In general org _without_ contrib feels less sluggish than with contrib,
> which makes me think some package in there adds a lot of overhead.
>
> I am not sure what else to say or do to get this fixed. Please let me know.

If you press control-g while it's hung, does it stop?

If so, can you try running the Emacs profiler and reproduce the issue?

https://www.emacswiki.org/emacs/EmacsNativeProfiler

Is that begin/end export block on a single long line?

400k of text data might better belong in an attachment.

--
Russell Adamsrlad...@adamsinfoserv.com

PGP Key ID: 0x1160DCB3   http://www.adamsinfoserv.com/

Fingerprint:1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3



Bug: Can’t assign to hline relative reference

2020-10-22 Thread Dante Catalfamo
Hello,

I'm trying to create a table where the third column between two hlines is set 
by a formula referencing the second column.

Here is an example:

| a | b |  c |
|---+---+|
| row 1 | 12.00 | 144.00 |
| row 2 |   |  23.00 |
|---+---+|
| sum   | 12.00 | 167.00 |
#+TBLFM: @I$3..II$3=if($2 != 0, 12*$2, 
$3);%.2f::@4$2=vsum(@I..II);%.2f::@4$3=vsum(@I..II);%.2f

When I try to calculate this table however, I get the error "Can’t assign to 
hline relative reference".

Why is this now allowed? This seems like a fairly mundane use of a table to me. 
It is explicitly disabled in the source, but without explanation, and searching 
the mailing list doesn't turn up many answers.

Is there a recommended way to handle a situation like this?

Could this feature be fixed?

Thank you,
Dante



Re: [PATCH] ob-java

2020-10-22 Thread John Herrlin


ian martins  writes:

> Actually I realized if I keep the commits separate and generate a patch set
> instead of squashing then I can preserve authorship.

Thank you for taking the time! It's not necessary and not important for
me!

>
> These patches, which follow patch 0001, fix the spacing and allow
> non-public classes.
>
> Thanks again for testing, debugging, and reporting.

It's been a pleasure!

>
> On Wed, Oct 21, 2020 at 9:54 AM John Herrlin  wrote:
>
>>
>> ian martins  writes:
>>
>> >>
>> >> What do you think about having a configurable list where the user can
>> >> add =org-babel-java--import-maybe=? In my current use case I could then
>> >> add RxJava imports to that list and the imports could be removed from
>> >> the source code block.
>> >
>> >
>> > I think this can already be done. imports can be added to the headers,
>> and
>> > babel allows file-wide headers, so you could add a =#+HEADER: :import
>> > rx.Observable= line to the file and all source blocks would get it.  it's
>> > slightly different in that =org-babel-java--import-maybe= skips imports
>> > that it thinks aren't needed. also if there are any non-java source
>> blocks
>> > in the same file, these imports could be added to them which would be
>> bad,
>> > so when mixing multiple languages in the same file this wouldn't be an
>> > option.
>>
>> Thanks for pointing that out! It work just fine!
>>
>> >
>> > NIT
>> >> Some spacing when writing =public static...=
>> >>
>> >
>> > Thanks for fixing the spacing. I don't think I can give you credit for
>> the
>> > patch, though, without leaving it out until ob-java is accepted.
>>
>> I dont need any credits, the important part is the result!
>>
>> I have made a couple of more runs and I cant find anything that doesnt
>> work!
>>
>> >
>> > On Wed, Oct 21, 2020 at 1:59 AM John Herrlin  wrote:
>> >
>> >>
>> >> I did and it looks really good. The difference in this example:
>> >>
>> >> #+BEGIN_SRC java
>> >>   import rx.Observable;
>> >>
>> >>   Observable.range(5, 3)
>> >>   .subscribe((Integer i) ->   { System.out.println("Got: " +
>> i); },
>> >>  (Throwable t) -> { t.printStackTrace();},
>> >>  () ->{ System.out.println("Ending
>> >> stream"); });
>> >> #+END_SRC
>> >>
>> >> from the ones I posted yesterday is tremendous!
>> >>
>> >> I am not very experienced with Emacs lisp but I think it's pretty easy
>> >> to understand how things works and follow the code. The comments are
>> >> also of good help. I really appreciate the work you have done!
>> >>
>> >>
>> >> What do you think about having a configurable list where the user can
>> >> add =org-babel-java--import-maybe=? In my current use case I could then
>> >> add RxJava imports to that list and the imports could be removed from
>> >> the source code block.
>> >>
>> >>
>> >> NIT
>> >>
>> >> Some spacing when writing =public static...=
>> >>
>> >>#+BEGIN_SRC diff
>> >>  diff --git a/lisp/ob-java.el b/lisp/ob-java.el
>> >>  index 94c3f69cf..4f3904871 100644
>> >>  --- a/lisp/ob-java.el
>> >>  +++ b/lisp/ob-java.el
>> >>  @@ -220,7 +220,7 @@ RESULT-FILE is the temp file to write the
>> result."
>> >> (org-babel-java--move-past org-babel-java--class-re)
>> >> (insert "\npublic static void main(String[] args) {
>> >>   System.out.print(\"success\");
>> >>  -}\n\n"))
>> >>  +}\n\n"))
>> >>
>> >>   ;; special handling to return value
>> >>   (when (eq result-type 'value)
>> >>#+END_SRC
>> >>
>> >>
>> >>
>> >> ian martins  writes:
>> >>
>> >> > Thanks for testing, and thanks for pointing that out. I will fix it so
>> >> that
>> >> > `public` is optional.
>> >> >
>> >> > btw, in your example you didn't have to specify `:classname` since you
>> >> > defined the class name in the source block.
>> >> >
>> >> > btw2, did you notice that you can C-c C-c on source blocks that don't
>> >> have
>> >> > main methods and it'll compile without error?
>> >> >
>> >> > On Tue, Oct 20, 2020 at 3:17 PM John Herrlin 
>> wrote:
>> >> >
>> >> >>
>> >> >> Hey,
>> >> >>
>> >> >> Did some debugging and found out that my class didn't contained
>> =public=
>> >> >> and the patch requires it to be.
>> >> >>
>> >> >> This works fine:
>> >> >>
>> >> >>#+HEADER: :classname Main
>> >> >>#+HEADER: :dir src
>> >> >>#+HEADER: :cmdline -classpath ./rxjava-1.3.8.jar:.
>> >> >>#+HEADER: :cmpflag -classpath ./rxjava-1.3.8.jar
>> >> >>#+BEGIN_SRC java :results output code
>> >> >>  import rx.Observable;
>> >> >>  public class Main {
>> >> >>  public static void main(String[] args) {
>> >> >>  Observable.range(5, 5)
>> >> >>  .subscribe(System.out::println);
>> >> >>  }
>> >> >>  }
>> >> >>#+END_SRC
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> ian martins  writes:
>> >> >>
>> >> >> > I noticed that the tests didn't run with "make 

Re: [PATCH] ob-java

2020-10-22 Thread ian martins
Actually I realized if I keep the commits separate and generate a patch set
instead of squashing then I can preserve authorship.

These patches, which follow patch 0001, fix the spacing and allow
non-public classes.

Thanks again for testing, debugging, and reporting.

On Wed, Oct 21, 2020 at 9:54 AM John Herrlin  wrote:

>
> ian martins  writes:
>
> >>
> >> What do you think about having a configurable list where the user can
> >> add =org-babel-java--import-maybe=? In my current use case I could then
> >> add RxJava imports to that list and the imports could be removed from
> >> the source code block.
> >
> >
> > I think this can already be done. imports can be added to the headers,
> and
> > babel allows file-wide headers, so you could add a =#+HEADER: :import
> > rx.Observable= line to the file and all source blocks would get it.  it's
> > slightly different in that =org-babel-java--import-maybe= skips imports
> > that it thinks aren't needed. also if there are any non-java source
> blocks
> > in the same file, these imports could be added to them which would be
> bad,
> > so when mixing multiple languages in the same file this wouldn't be an
> > option.
>
> Thanks for pointing that out! It work just fine!
>
> >
> > NIT
> >> Some spacing when writing =public static...=
> >>
> >
> > Thanks for fixing the spacing. I don't think I can give you credit for
> the
> > patch, though, without leaving it out until ob-java is accepted.
>
> I dont need any credits, the important part is the result!
>
> I have made a couple of more runs and I cant find anything that doesnt
> work!
>
> >
> > On Wed, Oct 21, 2020 at 1:59 AM John Herrlin  wrote:
> >
> >>
> >> I did and it looks really good. The difference in this example:
> >>
> >> #+BEGIN_SRC java
> >>   import rx.Observable;
> >>
> >>   Observable.range(5, 3)
> >>   .subscribe((Integer i) ->   { System.out.println("Got: " +
> i); },
> >>  (Throwable t) -> { t.printStackTrace();},
> >>  () ->{ System.out.println("Ending
> >> stream"); });
> >> #+END_SRC
> >>
> >> from the ones I posted yesterday is tremendous!
> >>
> >> I am not very experienced with Emacs lisp but I think it's pretty easy
> >> to understand how things works and follow the code. The comments are
> >> also of good help. I really appreciate the work you have done!
> >>
> >>
> >> What do you think about having a configurable list where the user can
> >> add =org-babel-java--import-maybe=? In my current use case I could then
> >> add RxJava imports to that list and the imports could be removed from
> >> the source code block.
> >>
> >>
> >> NIT
> >>
> >> Some spacing when writing =public static...=
> >>
> >>#+BEGIN_SRC diff
> >>  diff --git a/lisp/ob-java.el b/lisp/ob-java.el
> >>  index 94c3f69cf..4f3904871 100644
> >>  --- a/lisp/ob-java.el
> >>  +++ b/lisp/ob-java.el
> >>  @@ -220,7 +220,7 @@ RESULT-FILE is the temp file to write the
> result."
> >> (org-babel-java--move-past org-babel-java--class-re)
> >> (insert "\npublic static void main(String[] args) {
> >>   System.out.print(\"success\");
> >>  -}\n\n"))
> >>  +}\n\n"))
> >>
> >>   ;; special handling to return value
> >>   (when (eq result-type 'value)
> >>#+END_SRC
> >>
> >>
> >>
> >> ian martins  writes:
> >>
> >> > Thanks for testing, and thanks for pointing that out. I will fix it so
> >> that
> >> > `public` is optional.
> >> >
> >> > btw, in your example you didn't have to specify `:classname` since you
> >> > defined the class name in the source block.
> >> >
> >> > btw2, did you notice that you can C-c C-c on source blocks that don't
> >> have
> >> > main methods and it'll compile without error?
> >> >
> >> > On Tue, Oct 20, 2020 at 3:17 PM John Herrlin 
> wrote:
> >> >
> >> >>
> >> >> Hey,
> >> >>
> >> >> Did some debugging and found out that my class didn't contained
> =public=
> >> >> and the patch requires it to be.
> >> >>
> >> >> This works fine:
> >> >>
> >> >>#+HEADER: :classname Main
> >> >>#+HEADER: :dir src
> >> >>#+HEADER: :cmdline -classpath ./rxjava-1.3.8.jar:.
> >> >>#+HEADER: :cmpflag -classpath ./rxjava-1.3.8.jar
> >> >>#+BEGIN_SRC java :results output code
> >> >>  import rx.Observable;
> >> >>  public class Main {
> >> >>  public static void main(String[] args) {
> >> >>  Observable.range(5, 5)
> >> >>  .subscribe(System.out::println);
> >> >>  }
> >> >>  }
> >> >>#+END_SRC
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> ian martins  writes:
> >> >>
> >> >> > I noticed that the tests didn't run with "make test." This updates
> the
> >> >> > patch so that they can. I didn't add java to the list of default
> >> >> languages
> >> >> > because the java tests are slow.
> >> >> >
> >> >> > On Mon, Oct 5, 2020 at 9:23 AM ian martins  wrote:
> >> >> >
> >> >> >> I wrote those examples i

Re: Bug: Can’t assign to hline relative reference

2020-10-22 Thread Maxim Nikulin

Dante Catalfamo wrote:

In the case where I'm using this formula, there are many more rows
between @I..@II. I only used two in the example to keep the email small.
I would also be adding more rows regularly, making it slightly
impractical to be adjusting the beginning and end points of the formula
every time I add or remove a row. I appreciate your suggestion, though I
was hoping for a more convenient solution. If nothing else works, that's
what I'll do.


You are not alone. From my point of view it is not clear enough from org 
manual that @I references could be used only to the right of "=". The 
error message was a bad surprize. Another similar pitfal was with named 
columns.


However in some cases @<< (unlike @2 remains unchanged if a new line is 
added before second row) and @>> could be a workaround. If there are 
several horizontal lines, sometimes it is possible to mark particular 
lines with # and use e.g. $3=vsum(@-I$-1..@+I$-1) to avoid proliferation 
of same formulas for each table section.