no inline images anymore after reinstall

2021-06-16 Thread Prof. Dr. Johanna May


Hi guys,

I've been trying on the web and in "known as good" config files to solve
this but cannot seem to find the solution:

After reinstalling linux (openSuse leap 15.3) and finding out that
unfortunately the distro is too new, so 27.1 does not yet get offered
and switching back to 25.3 most of the stuff that I need works again.

Except for including python output diagrams in org-babel. I put the
diagram code at the very bottom since it takes up some space. At the very end
you also see the output: it is not a file, it is just a link called
[[file:]]. That cannot be right and then, of course, there are no inline
images displayed and not exported either. It is remarkable though, that
latex gets the link to the file, but just does not seem to show it
right. This might point to a latex problem, but the inline images aren't
shown in org-babel. Therefore I'm trying to find a solution here.

In my dotemacs I included what I thought relevant to get it working, but
it doesn't (below).

I would be very glad about a hint where to look for a solution. Maybe
some package-install (but which). Or some other configuration ... Or
maybe I'm still lacking an important distro package that just does not
get output on any error buffer?

Thank you very much, any help is appreciated

Johanna May

--- some of my dotemacs lines ---
;; === org-babel - Code einbinden ===
;; ### Darstellung ###
(setq org-startup-with-inline-images t)
(setq org-confirm-babel-evaluate nil)
(setq org-src-fontify-natively t)
(setq org-src-tab-acts-natively t)
(setq org-hide-emphasis-markers t)

;; ### Statistik mit R ESS ###
(require 'ess-site)

;; ### org-babel Sprachen ###
(require 'ob-python)
(setq org-babel-python-command "python3")
;;(setq python-shell-interpreter "python3")
(org-babel-do-load-languages
 'org-babel-load-languages
 '((emacs-lisp . t)
   (python . t)
   (ipython . t)
   (shell . t)
   (js . t)
   (latex . t)
   (org . t)
   (octave . t)
   (R . t)
   (plantuml . t)
   (dot . t)
   (gnuplot . t)
   (ruby . t)
   (screen . nil)
   (ledger . t)
   (C . t)
   (sql . t)
   (ditaa . t)))

;; ### Einrückungen beachten (z. B. python) ###
(setq org-edit-src-content-indentation 0)
(setq org-src-tab-acts-natively t)
(setq org-src-preserve-indentation t)

;; ### python-Coding ###
(require 'epc)
(require 'company)
(add-hook 'after-init-hook 'global-company-mode)
(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)
(setq-default indent-tabs-mode nil) ;; nicht Tabs sondern 4 Leerzeichen
(setq default-tab-width 4)
(add-hook 'python-mode-hook 'anaconda-mode)
(add-hook 'python-mode-hook 'eldoc-mode)
(eval-after-load "company"
  '(progn
 (add-to-list 'company-backends 'company-anaconda)))
(add-hook 'python-mode-hook 'anaconda-mode)

;; ### Bilder aus python inline anzeigen ###
(add-hook 'org-babel-after-execute-hook 'org-display-inline-images 'append)
(add-hook 'org-mode-hook 'org-display-inline-images)
--- snip ---


---diagram code in org---
#+name: fig-zeitverlaufspgendrehstrom
#+begin_src python :results file :session :var 
matplot_lib_filename=(org-babel-temp-file "figure" ".png"),fontsize=fs :exports 
results
import matplotlib.pyplot as plt
plt.style.use('classic')
import numpy as np
from matplotlib.ticker import FuncFormatter, MultipleLocator
plt.style.use('classic')

plt.rcParams.update({'font.size':fontsize})
rcParams.update({'figure.autolayout': True})

fig=plt.figure(figsize=(6,3))

x=np.linspace(0,5*np.pi,1000)
udach=230*np.sqrt(2)
phi1=0
phi2=-np.pi*2/3
phi3=-np.pi*4/3
u1=udach*np.cos(x+phi1)
u2=udach*np.cos(x+phi2)
u3=udach*np.cos(x+phi3)

plt.plot(x,u1,label='$u_1(t)$')
plt.plot(x,u2,label='$u_2(t)$')
plt.plot(x,u3,label='$u_3(t)$')
plt.xlabel('$t$')
plt.ylabel('$u$')
plt.xticks([])
plt.yticks([])
plt.legend(fontsize='small',bbox_to_anchor=(0,1.02,1.02,0),loc=3,ncol=3,mode="expand",borderaxespad=0.)
plt.grid(True)
plt.axhline(0,color='black',lw=1)

#plt.tight_layout()
plt.savefig(matplot_lib_filename,bbox_inches='tight')
matplot_lib_filename
#+end_src

#+CAPTION: Zeitverlauf symmetrischer Spannungen
#+LABEL: fig-zeitverlaufspgendrehstrom
#+ATTR_LATEX: :width \textwidth :height \textheight :options 
angle=0,keepaspectratio :float nil
#+RESULTS: fig-zeitverlaufspgendrehstrom
[[file:]]
---snip ---



Re: Overleaf equivalent for org-babel users?

2020-04-18 Thread Prof. Dr. Johanna May
Dear Ken,

thank you very much. I'm looking into cocalc now. I already got it to
compile some test.org file as pdf. I also set up a test file there in
order to start finding out how to do this. Next step, I guess, would be
to see, if org-babel works. Unfortunately, it looks like
a bit more work since for collaboration I need to find out about
versioning and testing the stuff and also about how to get some very
simple interface working there, maybe for small edits github is
nicer. But I have to admit, my experience on tramp (what is that?) and
git is very limited, so I don't yet have an idea of how to set that up
in a good way.

Jupyter Notebooks are not what I feel is right for lecture notes in that
subject since they cannot display circuitikz and latex export is not the
way it should be. It's not a programming class I'm teaching and many
students do prefer the pdf they can either print out or annotate in some
software on their tablets or just display on their smartphone. The exam
is in writing and on paper.

I do also provide some jupyter notebooks, but only for the interested
part of the class and they surely can manage without that. As always,
such options are rather taken up by the more skilled, and not so much by
the weaker students, unfortunately.

Cheers, have a good weekend!

J

Am Samstag, 18. April 2020 um 15:59 schrieb Ken Mankoff ...
> Hi Dr. May,
>
> Unfortunately I have not found Emacs + Org to be the right tools when 
> collaborating. What we need is a way for Org wrap/interface/edit Jupyter 
> Notebooks, since that seems to be becoming the standard. Unfortunately.
>
> I have had some luck with a hybrid approach using the Sage Notebook server. 
> That project is no longer active (perhaps due to the success of Jupyter 
> Notebooks?), but I think you can do something similar with either Google 
> Colab https://colab.research.google.com or more likely CoCalc 
> https://cocalc.com/
>
> Google Collab is just an interface to Jupyter Notebooks.
>
> CoCalc can also just run Jupyter Notebooks, but also lets you have a full 
> Linux environment, bash shell, ssh, git, etc. I think you may need to pay for 
> this level of service, but you could then run emacs remotely via ssh, or 
> locally and use tramp. If the backend is git you may be able to work locally 
> and sync with the webserver interface to the tools that your colleagues would 
> see.
>
> I still don't think your colleagues would be directly editing your Org source 
> though, but you may be able to get close to what you're looking for on those 
> sites. Good luck, and please do post back here if you come up with a good 
> solution.
>
>   -k.
>
> On 2020-04-16 at 10:22 -07, Prof. Dr. Johanna May
>  wrote...
>> Hey there,
>>
>> I've been preparing lecture notes with org-mode and lualatex export
>> that include python diagrams and so on for about more than a year. Now
>> my colleagues and team start to get interested in tweaking the
>> results. Therefore, we would need some kind of online collaboration
>> solution similar to overleaf that can compile the latex including the
>> python (org-babel) inserts. And, obviously, versioning would also come
>> in handy, so that would rather be github / gitlab functionality.
>>
>> Does anyone know of a solution like overleaf that can be used for
>> that? Could you point me at your description of any setup needed? Or,
>> alternatively, do you have some good description of how to set up a
>> server / virtual machine that can do that? (at best including a
>> virtual emacs interface, so not all users have to do all the
>> installations locally)? If so, that description would also interest
>> me.
>>
>> I would like to either use some online platform like overleaf or
>> explain to my university colleagues who already have servers running
>> what they could do for me.
>>
>> The problem is, that the collaboration colleagues are not good friends
>> with coding (they prefer word to latex, excel to python ... until now,
>> at least), so I'm not very inclined to suggest them to start using
>> emacs. I would very much prefer some web-based solution to get them
>> started. Also, such a solution might provide ways of having students
>> contribute smaller bits and pieces without having to go thru the whole
>> learning curve of learning the use of emacs, installing all the tools,
>> etc.pp. Any ideas?
>>
>> Thank you very much!
>>
>> Cheers,
>>
>> J. May


-- 
Prof. Dr. Johanna May
Stellvertretende Institutsleiterin CIRE
Fakultät für Informations-, Medien- und Elektrotechnik (F07)
Institut für Elektrische Energietechnik (IET)
Cologne Institute for Renewable Energy (CIRE)
Lehrgebiete: Energieeffizienz und Grundlagen Elektrotechnik

T: +49 221-8275-2697
M: +49 174 891 9002
E: johanna@th-koeln.de

Technische Hochschule Köln
Campus Deutz
Betzdorfer Str. 2
50679 Köln
Raum: HW2-40

www.th-koeln.de



Overleaf equivalent for org-babel users?

2020-04-16 Thread Prof. Dr. Johanna May
Hey there,

I've been preparing lecture notes with org-mode and lualatex export that
include python diagrams and
so on for about more than a year. Now my colleagues and team start to get 
interested
in tweaking the results. Therefore, we would need some kind of online
collaboration solution similar to overleaf that can compile the latex
including the python (org-babel) inserts. And, obviously, versioning
would also come in handy, so that would rather be github / gitlab
functionality.

Does anyone know of a solution like overleaf that can be used for that?
Could you point me at your description of any setup needed? Or,
alternatively, do you have some good description of how to set up a
server / virtual machine that can do that? (at best including a virtual
emacs interface, so not all users have to do all the installations
locally)? If so, that description would also interest me.

I would like to either use some online platform like overleaf or explain
to my university colleagues who already have servers running what they
could do for me.

The problem is, that the collaboration colleagues are not good friends with 
coding
(they prefer word to latex, excel to python ... until now, at least),
so I'm not very inclined to suggest them to start using emacs. I would
very much prefer some web-based solution to get them started. Also, such
a solution might provide ways of having students contribute smaller bits
and pieces without having to go thru the whole learning curve of
learning the use of emacs, installing all the tools, etc.pp. Any ideas?

Thank you very much!

Cheers,

J. May



solved partly: exporting ics files with broken link

2019-11-03 Thread Prof. Dr. Johanna May


Hey there,

in the end I did find that link in my file. Probably I was using the
wrong search function (C-s) which did not show text inside links
whereas console grep did the job in the end. And then exporting via C-c c f 
exported one
file for me. 

Cheers,

J

Prof. Dr. Johanna May writes:

> Hey there,
>
> using https://orgmode.org/manual/iCalendar-export.html I wanted to
> export my agenda files. I tried exporting just one file, or combining
> the agenda files. But I always get an error message about an unresolved
> link to "selfhosted.libhunt.com". - This link is not in any of my agenda
> files or .org files. So it must be sitting somewhere else but I cannot
> find out where. Any hints on how to repair that? Any hints in which file
> that strange link may sit? And: how can I make sure my files stay
> exportable?
>
> Thanks,
>
> Cheers,
>
> J


-- 
Prof. Dr. Johanna May
Stellvertretende Institutsleiterin CIRE
Fakultät für Informations-, Medien- und Elektrotechnik (F07)
Institut für Elektrische Energietechnik (IET)
Cologne Institute for Renewable Energy (CIRE)
Lehrgebiete: Energieeffizienz und Grundlagen Elektrotechnik

T: +49 221-8275-2697
M: +49 174 891 9002
E: johanna@th-koeln.de

Technische Hochschule Köln
Campus Deutz
Betzdorfer Str. 2
50679 Köln
Raum: HW2-40

www.th-koeln.de



exporting ics files with broken link

2019-11-01 Thread Prof. Dr. Johanna May


Hey there,

using https://orgmode.org/manual/iCalendar-export.html I wanted to
export my agenda files. I tried exporting just one file, or combining
the agenda files. But I always get an error message about an unresolved
link to "selfhosted.libhunt.com". - This link is not in any of my agenda
files or .org files. So it must be sitting somewhere else but I cannot
find out where. Any hints on how to repair that? Any hints in which file
that strange link may sit? And: how can I make sure my files stay
exportable?

Thanks,

Cheers,

J



[O] ipython integration fails

2019-10-16 Thread Prof. Dr. Johanna May


Hi everybody,

I am creating lecture notes including some python snippets. Now, in
order to teach jupyter notebook use I would like to include just the
same code as in a python snippet in an ipython snippet.

However ipython blocks don't work in my set up and I could not figure
out which dependency or config line I might need to add in order to do
this properly (and scimax also creates errors, but since I have my own
config running I thought ipython might  already do the job).

The ipython snippet I used is:
#+BEGIN_SRC ipython :session :results raw drawer
  %matplotlib inline
  import matplotlib.pyplot as plt
  import numpy as np
#+END_SRC

The error message is:
Traceback (most recent call last):
  File "/home/username/.emacs.d/elpa/ob-ipython-20180224.953/client.py", line 
60, in 
c = create_client(args.conn_file)
  File "/home/username/.emacs.d/elpa/ob-ipython-20180224.953/client.py", line 
43, in create_client
cf = find_connection_file('emacs-' + name)
  File "/usr/lib/python3.6/site-packages/jupyter_client/connect.py", line 218, 
in find_connection_file
raise IOError("Could not find %r in %r" % (filename, path))
OSError: Could not find 'emacs-default' in ['.', '/run/user/1000/jupyter']

Maybe I do not need ipython anyway. What works are python code snippets
like the following one. Minted exports both, code and results and they
are both displayed in the pdf slides/manuscript (using lualatex,
beamerarticle etc.)

#+begin_src python :results output :session :exports both
import time
time.sleep(3)
#+end_src

However, then, what does not work properly is several code blocks in one
session, e.g.

(1)
#+begin_src python :results output :session :exports both
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import datetime as dt
import seaborn as sns
sns.set(style="darkgrid")
#+end_src

(2)
#+begin_src python :results output :session :exports both
df = pd.read_csv('./household_data_1min_singleindex.csv')
#+end_src

(3)
#+begin_src python :results output :session :exports both
zeit=df.utc_timestamp.apply(lambda x: dt.datetime.strptime(x, 
"%Y-%m-%dT%H:%M:%SZ"))
#+end_src

(4)
#+begin_src python :results file :session :var 
matplot_lib_filename=(org-babel-temp-file "figu" ".png"),fontsize=fs :exports 
both
plt.rcParams.update({'font.size':fontsize})
rcParams.update({'figure.autolayout': True})
plt.plot(zeit,df.DE_KN_residential2_washing_machine)
plt.savefig(matplot_lib_filename)
matplot_lib_filename
#+end_src

I do not like the fact that plt.rcParams.update and other lines that
jupyter does not need get exported - is there a simple way to exclude
certain lines from export?

And I do get in serious trouble when I add a second data set (another csv) and 
do
further analysis steps - all graphics then look the same and bad and do
not represent the actual result of the code block. It seems that all get
the same wrong name and then at each graphics location this same png
gets displayed. 

So, maybe there is a good tutorial on using sessions in ob-python or
some other hint that I could use?

Is there a way to restart the (python) kernel with some header message
in the src block?

Thank you very much,

Cheers,

J. May



Re: [O] Show weekday in daily agenda view

2019-05-15 Thread Prof. Dr. Johanna May


Hey there,
thank you very much, that is now perfect:

I use

(setq org-agenda-format-date ;; (1)
  "%Y-%m-%d %A ") ;; (1)

(the (1) in brackets gives me an indication of where I got the initial
code from)

and it gives me

2019-05-15 Mittwoch 

all I want :)

Cheers and have a good week
J

Richard Lawrence writes:

> Hi Johanna,
>
> "Prof. Dr. Johanna May"  writes:
>
>> thanks for pointing me at the variable org-agenda-format-date. There
>> was  a line in my dotemacs that included a formatting without the
>> weekday (something like %y-%w-%d).
>
> Ah, ok, great!
>
>> I could not figure out how the name-of-the-weekday format would be
>> called. But for now I'm fine with returning to the default which gives
>> me an English date including the weekday.
>
> You probably want "%a" or "%A" somewhere in there, if you want a
> locale-specific name of the weekday.  See the docstring for the
> format-time-string function.




Re: [O] Show weekday in daily agenda view

2019-05-15 Thread Prof. Dr. Johanna May
Hi Richard,
thanks for pointing me at the variable org-agenda-format-date. There
was  a line in my dotemacs that included a formatting without the
weekday (something like %y-%w-%d). I could not figure out how the
name-of-the-weekday format would be called. But for now I'm fine with
returning to the default which gives me an English date including the
weekday.

Cheers, J

Richard Lawrence writes:

> Hi Johanna,
>
> johanna@th-koeln.de writes:
>
>> maybe I did not search the right way in google alias startpage. But I
>> could not figure out how to write next to the date e.g. 2000-04-01 the
>> weekday, i.e. the specific day of the week. It would come very handy to
>> have the date displayed as 2019-05-14 Tu and 2019-05-15 We and so on. Or
>> even have it spelled out as 2019-05-14 Tuesday.
>>
>> Probably there is a way of setting this. How does it work?
>
> Hmm.  My daily agenda (the default one) starts like this:
>
> Day-agenda (W20):
> Tuesday14 May 2019
>
> and tasks, etc. are listed below that.  I don't think I've ever
> customized this.  Are you seeing something different?  Or maybe you mean
> something else by "agenda"?
>
> If you're talking about Org's built-in agenda, you might want to take a
> look at the `org-agenda-format-date' variable.  Mine is set to the
> org-agenda-format-date-aligned function, which I assume is what outputs
> the example above.
>
> If you're just talking about timestamps in Org files, you might want to
> look at the `org-time-stamp-custom-formats' and
> `org-display-custom-times' variables.
>
> Hope that helps!