Re: org-cite and export to ODT
Thank you John. I tried to C-c C-e. I was reminded that org-ref-cite-natmove's function definition is void. I also don't have functions that start with org-ref-export. I suspect that I didn't load a file or package. Bruce and András, I upgraded org-mode on my system to 9.5. org-cite works after I added (require 'oc) Your examples work. I also noticed that I didn't need the following line: #+cite_export: csl Xianwen On Thu, Dec 16, 2021 at 12:50 AM John Kitchin wrote: > you are still not getting the directions. You don't export with C-c Ce oo > here. You run that src block by putting your cursor in it and typing C-c > C-c to run it. > > For org-ref, you have to use a preprocessing hook to replace the cite > links with the csl derived links before the export is done. That is what > the src block does. It temporarily defines org-export-before-parsing-hook > to run those three hook functions before making an odt file. > > Alternatively you can do C-c C-e ro which will use the org-ref exporter > that at least runs the org-ref csl preprocessor. > > 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 > > > > On Wed, Dec 15, 2021 at 6:58 PM Xianwen Chen (陈贤文) > wrote: > >> Thank you John. I'm not sure why it does not work. Below is the minimal >> example I created, using your example. I ran C-e o o to export to ODT. The >> resulted ODT file didn't have the reference. >> >> #+title: A basic example of org-ref for csl export >> #+options: toc:nil >> #+csl-style: apa-5th-edition.csl >> #+csl-locale: en-US >> >> * Bibliography >> >> bibliography:~/data/library/bibliography/biblatex/biblatex.bib >> >> cite:bayulken-et-al-2020-nbs-climate_change-pandemics >> >> * build :noexport: >> >> #+BEGIN_SRC emacs-lisp :results silent >> (let ((org-export-before-parsing-hook '(org-ref-cite-natmove ;; do this >> first >> org-ref-csl-preprocess-buffer >> org-ref-refproc))) >> (org-open-file (org-odt-export-to-odt) 'system)) >> #+END_SRC >> >> >> On Wed, Dec 15, 2021 at 10:16 PM John Kitchin >> wrote: >> >>> That code does not belong in your .emacs file. It should be in an >>> emacs-lisp block in your org-file like it is in the example. You should run >>> it from the org file. >>> >>> >>> >>> >>> 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 >>> >>> >>> >>> On Wed, Dec 15, 2021 at 5:12 PM Xianwen Chen (陈贤文) < >>> xianwen.c...@gmail.com> wrote: >>> >>>> Thank you all for the responses. I have to upgrade from orgmode 9.4.4 >>>> to 9.5 first, to try out org-cite. >>>> >>>> I tried >>>> https://github.com/jkitchin/org-ref/blob/master/examples/basic-csl.org#opendocument. >>>> I added the following codes to my .emacs: >>>> >>>> (let ((org-export-before-parsing-hook '(org-ref-cite-natmove ;; do this >>>> first >>>> org-ref-csl-preprocess-buffer >>>> org-ref-refproc))) >>>> (org-open-file (org-odt-export-to-odt) 'system)) >>>> >>>> I tried to eval-region, after selecting these codes. I got the complain >>>> that org-ref-cite-natmove's function definition is void. >>>> >>>> Do I need to install or require something other than cite-ref? >>>> >>>> Xianwen >>>> >>>> On Thu, Dec 9, 2021 at 2:57 PM John Kitchin >>>> wrote: >>>> >>>>> If you are trying to use org-ref for this see >>>>> https://www.youtube.com/watch?v=rRR-5NSpKyE and this example: >>>>> https://github.com/jkitchin/org-ref/blob/master/examples/basic-csl.org#opendocument. >>>>> You need to use a preprocessing hook (org-ref-csl-preprocess-buffer) with >>>>> org-ref to get the citations and bibliography . >>>>> John >>>>> >>>>> --- >>>>> Professor John Kitchin (he/
Re: org-cite and export to ODT
Thank you John. I'm not sure why it does not work. Below is the minimal example I created, using your example. I ran C-e o o to export to ODT. The resulted ODT file didn't have the reference. #+title: A basic example of org-ref for csl export #+options: toc:nil #+csl-style: apa-5th-edition.csl #+csl-locale: en-US * Bibliography bibliography:~/data/library/bibliography/biblatex/biblatex.bib cite:bayulken-et-al-2020-nbs-climate_change-pandemics * build :noexport: #+BEGIN_SRC emacs-lisp :results silent (let ((org-export-before-parsing-hook '(org-ref-cite-natmove ;; do this first org-ref-csl-preprocess-buffer org-ref-refproc))) (org-open-file (org-odt-export-to-odt) 'system)) #+END_SRC On Wed, Dec 15, 2021 at 10:16 PM John Kitchin wrote: > That code does not belong in your .emacs file. It should be in an > emacs-lisp block in your org-file like it is in the example. You should run > it from the org file. > > > > > 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 > > > > On Wed, Dec 15, 2021 at 5:12 PM Xianwen Chen (陈贤文) > wrote: > >> Thank you all for the responses. I have to upgrade from orgmode 9.4.4 to >> 9.5 first, to try out org-cite. >> >> I tried >> https://github.com/jkitchin/org-ref/blob/master/examples/basic-csl.org#opendocument. >> I added the following codes to my .emacs: >> >> (let ((org-export-before-parsing-hook '(org-ref-cite-natmove ;; do this >> first >> org-ref-csl-preprocess-buffer >> org-ref-refproc))) >> (org-open-file (org-odt-export-to-odt) 'system)) >> >> I tried to eval-region, after selecting these codes. I got the complain >> that org-ref-cite-natmove's function definition is void. >> >> Do I need to install or require something other than cite-ref? >> >> Xianwen >> >> On Thu, Dec 9, 2021 at 2:57 PM John Kitchin >> wrote: >> >>> If you are trying to use org-ref for this see >>> https://www.youtube.com/watch?v=rRR-5NSpKyE and this example: >>> https://github.com/jkitchin/org-ref/blob/master/examples/basic-csl.org#opendocument. >>> You need to use a preprocessing hook (org-ref-csl-preprocess-buffer) with >>> org-ref to get the citations and bibliography . >>> 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 >>> >>> >>> >>> On Thu, Dec 9, 2021 at 4:54 AM Xianwen Chen (陈贤文) < >>> xianwen.c...@gmail.com> wrote: >>> >>>> I have been using org-ref and biblatex. They export well to PDF, >>>> through LaTeX. I am able to export to ODT as well. However, I'm not able to >>>> have the bibliography or the references in the produced ODT. >>>> >>>> I searched online and found this tutorial: >>>> https://kjambunathan.github.io/org-mode-ox-odt/Bibliography-and-Citations-in-ODT-export.html. >>>> However, when following through the tutorial, I wasn't able to find >>>> ox-jabref. >>>> >>>> Thinking about the new org-cite, which is orgmode's native citation >>>> solution, I'm wondering if it would be easier to use org-cite within >>>> orgmode and export to ODT? A small example with configuration suggestion >>>> will be highly appreciated! >>>> >>>> Xianwen >>>> >>>
Re: org-cite and export to ODT
Thank you all for the responses. I have to upgrade from orgmode 9.4.4 to 9.5 first, to try out org-cite. I tried https://github.com/jkitchin/org-ref/blob/master/examples/basic-csl.org#opendocument. I added the following codes to my .emacs: (let ((org-export-before-parsing-hook '(org-ref-cite-natmove ;; do this first org-ref-csl-preprocess-buffer org-ref-refproc))) (org-open-file (org-odt-export-to-odt) 'system)) I tried to eval-region, after selecting these codes. I got the complain that org-ref-cite-natmove's function definition is void. Do I need to install or require something other than cite-ref? Xianwen On Thu, Dec 9, 2021 at 2:57 PM John Kitchin wrote: > If you are trying to use org-ref for this see > https://www.youtube.com/watch?v=rRR-5NSpKyE and this example: > https://github.com/jkitchin/org-ref/blob/master/examples/basic-csl.org#opendocument. > You need to use a preprocessing hook (org-ref-csl-preprocess-buffer) with > org-ref to get the citations and bibliography . > 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 > > > > On Thu, Dec 9, 2021 at 4:54 AM Xianwen Chen (陈贤文) > wrote: > >> I have been using org-ref and biblatex. They export well to PDF, through >> LaTeX. I am able to export to ODT as well. However, I'm not able to have >> the bibliography or the references in the produced ODT. >> >> I searched online and found this tutorial: >> https://kjambunathan.github.io/org-mode-ox-odt/Bibliography-and-Citations-in-ODT-export.html. >> However, when following through the tutorial, I wasn't able to find >> ox-jabref. >> >> Thinking about the new org-cite, which is orgmode's native citation >> solution, I'm wondering if it would be easier to use org-cite within >> orgmode and export to ODT? A small example with configuration suggestion >> will be highly appreciated! >> >> Xianwen >> >
org-cite and export to ODT
I have been using org-ref and biblatex. They export well to PDF, through LaTeX. I am able to export to ODT as well. However, I'm not able to have the bibliography or the references in the produced ODT. I searched online and found this tutorial: https://kjambunathan.github.io/org-mode-ox-odt/Bibliography-and-Citations-in-ODT-export.html. However, when following through the tutorial, I wasn't able to find ox-jabref. Thinking about the new org-cite, which is orgmode's native citation solution, I'm wondering if it would be easier to use org-cite within orgmode and export to ODT? A small example with configuration suggestion will be highly appreciated! Xianwen
Re: [PATCH] Include support for evaluating julia code
Dear Pedro, Thank you! I'm wondering if https://github.com/phrb/ob-julia/blob/master/ob-doc-template.org is up to date? By up to date I mean will the examples in the file work with the latest ob-julia as in https://github.com/phrb/ob-julia? Yours sincerely, Xianwen Original Message SUBJECT: Re: [PATCH] Include support for evaluating julia code DATE: 2021-09-24 20:31 FROM: Pedro Bruel TO: Timothy Hi Timothy, Thanks for the reply! I am submitting a modded version the of the original ob-julia.el, where I had fixed the bugs I encountered and updated the interface with org-mode. I've been using the version on https://github.com/phrb/ob-julia for a while now, mainly to write programming classes using julia. Yours and Nicolò's version seems good though, I think you should submit it when you consider it ready. In the meantime, what do we do? Thanks, Pedro Le ven. 24 sept. 2021 à 17:08, Timothy a écrit : Hi Pedro, Thanks for your patch, it's great to see the interest in Julia support and it's something that I absolutely think should be in org-core 🙂. However, ob-julia.el was moved into org-contrib because it was not well maintained, and very buggy. I'm actually currently working on a successor with Nicolò (see the linked repo) in my free time, and intend to submit that to Org when I feel it is mature enough. See https://github.com/nico202/ob-julia/ for more information. All the best, Timothy From: Pedro Bruel Subject: [PATCH] Include support for evaluating julia code To: Org-mode Date: Sat, 25 Sep 2021 03:56:43 +0800 Hi, This patch includes ob-julia.el from org-contrib, and a tentative test-ob-julia.el test file. This is my first attempt at a patch, so please let me know if there's anything wrong! Thanks, Pedro
Re: Exam LaTeX class
Dear Diego, Gracias! I slightly modified your solution. I added the #+INCLUDE line to the end of #+LATEX_HEADER, because then it will overwrite any previous \printanswers and \noprintanswers defined in the HEADER. #+TITLE:... ... #+LATEX_HEADER: \usepackage{hyperref} #+INCLUDE: ./latex-exam-printanswers-switch.org I used the file name latex-exam-printanswers-switch.org, instead of printanswers.org, because it gives a better indication of what it does. I used your function as it was, except that I changed the function name and updated the switch org file. (defun org-latex-export-to-pdf-exam () (interactive) (write-region "#+LATEX_HEADER: \\printanswers" nil "latex-exam-printanswers-switch.org") (org-latex-export-to-pdf) (rename-file (org-export-output-file-name ".pdf") (org-export-output-file-name "-with_answers.pdf")) (write-region "" nil "latex-exam-printanswers-switch.org") (org-latex-export-to-pdf) ) It works very fine! Have a nice Easter! Yours sincerely, Xianwen On 2021-03-24 13:16, Diego Zamboni wrote: Hi Xianwen, I think the easiest way to conditionally include text in the preamble of the document would be by including a file which can be empty sometimes, and contain the appropriate text when needed. For example, you could have something like this in your Org file: #+include: ./printanswers.org [1] #+TITLE: Test ... Then the following function will automatically export the file twice, one with the \printanswers command inserted then rename the resulting file, and export again without: (defun org-latex-export-exams () (interactive) (write-region "#+latex_header: \\printanswers" nil "printanswers.org [1]") (org-latex-export-to-pdf) (rename-file (org-export-output-file-name ".pdf") (org-export-output-file-name "-with_answers.pdf")) (write-region "" nil "printanswers.org [1]") (org-latex-export-to-pdf)) You can then run M-x org-latex-export-exams to generate both files. Hope this helps, --Diego On Wed, Mar 24, 2021 at 11:21 AM Xianwen Chen (陈贤文) wrote: Dear Christine (and CC list), Thank you! On 2021-03-19 10:13, Christine Köhn wrote: Here is one way to do the latex part. You could pass a jobname to latex. I have this \IfEndWith*{\jobname}{withsolution}{% \usepackage{todonotes} \printanswers }{\usepackage[disable]{todonotes}} in a myexam.sty file to switch between modes (with or without solutions and todo notes) and use it in the latex file with \usepackage{myexam} You could add your own latex class to org-latex-classes and add this line there. The jobname has to be passed to latex with something like -jobname withsolution if you want it to be with solutions. I use a Makefile for this purpose which calls latexmk latexmk -pdf -pdflatex="pdflatex --interaction=errorstopmode" -use-make and adds -jobname=$(basename $@) if asked to create a pdf ending with withsolution.pdf. I can send you the Makefile if you're interested. That's very interesting way to solve the problem using LaTeX. Thank you for sharing this. At the moment I'm leaning more towards solving it using emacs lisp. To use the jobname from within orgmode, you'll have to change org-latex-pdf-process to use the jobname if needed. I think one way to achieve this is to add a new export backend which is derived from latex (see org-export-define-derived-backend) and which sets org-latex-pdf-process accordingly (and resets it afterwards). Thank you again. I'm thinking of a function like following. I'm using comments to express the programming detail that I don't know how to do yet. (deffun org-latex-export-to-pdf-exam () (interactive) # do some emacs lisp to add \printanswers to the end of org document header, i.e., adding a line of #+LATEX_HEADER: \printanswers (org-latex-export-to-pdf) # do some emacs lips to move the foo.pdf to foo-with_solutions.pdf # do some emacs lisp to add \noprintanswers to the end of org document header, i.e., removing the line of #+LATEX_HEADER: \printanswers and adding a line of #+LATEX_HEADER: \noprintanswers (org-latex-export-to-pdf) # remove the line of #+LATEX_HEADER: \noprintanswers ) I don't know enough emacs lisp to fill in the details here for now. However, I think this would be a way to do it within emacs. So each time I call org-latex-export-to-pdf-exam, it would export two PDF files, one with solutions and one without. What do you think? Yours sincerely, Xianwen Links: -- [1] http://printanswers.org
Re: Exam LaTeX class
Dear Christine (and CC list), Thank you! On 2021-03-19 10:13, Christine Köhn wrote: Here is one way to do the latex part. You could pass a jobname to latex. I have this \IfEndWith*{\jobname}{withsolution}{% \usepackage{todonotes} \printanswers }{\usepackage[disable]{todonotes}} in a myexam.sty file to switch between modes (with or without solutions and todo notes) and use it in the latex file with \usepackage{myexam} You could add your own latex class to org-latex-classes and add this line there. The jobname has to be passed to latex with something like -jobname withsolution if you want it to be with solutions. I use a Makefile for this purpose which calls latexmk latexmk -pdf -pdflatex="pdflatex --interaction=errorstopmode" -use-make and adds -jobname=$(basename $@) if asked to create a pdf ending with withsolution.pdf. I can send you the Makefile if you're interested. That's very interesting way to solve the problem using LaTeX. Thank you for sharing this. At the moment I'm leaning more towards solving it using emacs lisp. To use the jobname from within orgmode, you'll have to change org-latex-pdf-process to use the jobname if needed. I think one way to achieve this is to add a new export backend which is derived from latex (see org-export-define-derived-backend) and which sets org-latex-pdf-process accordingly (and resets it afterwards). Thank you again. I'm thinking of a function like following. I'm using comments to express the programming detail that I don't know how to do yet. (deffun org-latex-export-to-pdf-exam () (interactive) # do some emacs lisp to add \printanswers to the end of org document header, i.e., adding a line of #+LATEX_HEADER: \printanswers (org-latex-export-to-pdf) # do some emacs lips to move the foo.pdf to foo-with_solutions.pdf # do some emacs lisp to add \noprintanswers to the end of org document header, i.e., removing the line of #+LATEX_HEADER: \printanswers and adding a line of #+LATEX_HEADER: \noprintanswers (org-latex-export-to-pdf) # remove the line of #+LATEX_HEADER: \noprintanswers ) I don't know enough emacs lisp to fill in the details here for now. However, I think this would be a way to do it within emacs. So each time I call org-latex-export-to-pdf-exam, it would export two PDF files, one with solutions and one without. What do you think? Yours sincerely, Xianwen
Exam LaTeX class
Does someone have experiences with the exam LaTeX class: http://www-math.mit.edu/~psh/exam/examdoc.pdf? I made a simple hack to make it work, by adding the following lines to the .emacs file: (add-to-list 'org-latex-classes '("exam" "\\documentclass{exam}" ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}") ("\\paragraph{%s}" . "\\paragraph*{%s}") ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))) The next step I'm trying to do, but don't know how, is to ask LaTeX exporter to create two exports to PDF. One export is the usual export. The other export is to have [answers] in \documentclass, which in LaTeX will be: \documentclass[answers]{exam} When answers is specified, the resulted PDF will include the solutions that are preset in the solution environments. The switch of printing or hiding solution environments can also be achieved by one of the following preamble codes: \printanswers or \noprintanswers. I guess one way is to modify the org-latex-export-to-pdf function, so that when the document class is exam, the exporter first export without solutions, and then export to an other PDF file (such as foo-with_solutions.pdf). But maybe someone else has hacked on the exam document class as well and would like to share their experiences? Xianwen
Re: Interview with Rainer König - who's content made me go from vim to emacs for coding :D
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
window setup that works with org-agenda
Hi! I use both org mode and org-roam. org-roam opens a right-hand side window that displays backlinks. When I run org-agenda, the right window is closed automatically. I would like to receive tips regarding how to permanently set up the window layout that I have on my mind. The layout has three windows. The right window, *c*, displays the backlinks from org-roam. The rest of the space is divided in half, which I call them as the window *a* and the window *b*. |-| | a | | |--| c | | b | | |-| When org-agenda displays agendas, it will not close *c* and it will not resize *b*. It will display the agendas in the window *b*. Cheers, Xianwen
Re: window setup that works with org-agenda
Dear Professor Fraga, Thank you very much! I set in ~/.emacs that (setq org-agenda-window-setup "current-window") It works beautifully! Yours sincerely, Xianwen On 2020-08-13 14:42, Eric S Fraga wrote: On Thursday, 13 Aug 2020 at 13:33, Xianwen Chen (陈贤文) wrote: I would like to receive tips regarding how to permanently set up the window layout that I have on my mind. The layout has three windows. Have a look at this variable which may provide what you want: ,[ C-h v org-agenda-window-setup RET ] | org-agenda-window-setup is a variable defined in 'org-agenda.el'. | Its value is 'other-frame' | Original value was 'reorganize-frame' | | You can customize this variable. | | Documentation: | How the agenda buffer should be displayed. | Possible values for this option are: | | current-windowShow agenda in the current window, keeping all other windows. | other-window Use 'switch-to-buffer-other-window' to display agenda. | only-window Show agenda, deleting all other windows. | reorganize-frame Show only two windows on the current frame, the current | window and the agenda. | other-frame Use 'switch-to-buffer-other-frame' to display agenda. | Also, when exiting the agenda, kill that frame. | See also the variable 'org-agenda-restore-windows-after-quit'. ` I have a new frame popup when I ask for an agenda view, leaving the window setup for the original frame untouched.
window setup that works with org-agenda
Hi! I use both org mode and org-roam. org-roam opens a right-hand side window that displays backlinks. When I run org-agenda, the right window is closed automatically. I would like to receive tips regarding how to permanently set up the window layout that I have on my mind. The layout has three windows. The right window, *c*, displays the backlinks from org-roam. The rest of the space is divided in half, which I call them as the window *a* and the window *b*. |-| | a | | |--| c | | b | | |-| When org-agenda displays agendas, it will not close *c* and it will not resize *b*. It will display the agendas in the window *b*. Cheers, Xianwen