When using org-mode, I would like to be able to save my org file (called here pad.org) in a ODT format. Here is what I have when trying save the file pad.org,
Auto-saving...done
org-babel-exp process python at position 2716...
Evaluate this python code block on your system? (y or n) n
Evaluation of this python code block is aborted.
LaTeX to MathML converter not available.
Formatting LaTeX using verbatim
Embedding c:/Users/Julien/Documents/ORG/img/IMG_3130.jpg as Images/0001.jpg...
Embedding c:/Users/Julien/Documents/ORG/img/ergoemacs-layout-fr.png as Images/0002.png...
Wrote c:/Users/Julien/AppData/Local/Temp/odt-ANDdwG/meta.xml
Using schema c:/Emacs/emacs-26.3-x86_64/share/emacs/26.3/etc/schema/od-schema-v1.2-os.rnc [2 times]
Saving file c:/Users/Julien/AppData/Local/Temp/odt-ANDdwG/styles.xml...
Wrote c:/Users/Julien/AppData/Local/Temp/odt-ANDdwG/styles.xml
Using vacuous schema
Wrote c:/Users/Julien/AppData/Local/Temp/odt-ANDdwG/mimetype
Using vacuous schema
Saving file c:/Users/Julien/AppData/Local/Temp/odt-ANDdwG/META-INF/manifest.xml...
Wrote c:/Users/Julien/AppData/Local/Temp/odt-ANDdwG/META-INF/manifest.xml
Saving file c:/Users/Julien/AppData/Local/Temp/odt-ANDdwG/content.xml...
Wrote c:/Users/Julien/AppData/Local/Temp/odt-ANDdwG/content.xml
Creating ODT file...
Running zip -mX0 pad.odt mimetype
When zip.exe is running, the GUI opens and I get the error message
Can't open -mX0 pad.odt
I'm a new user of emacs and org-mode on Windows 10. In the .emacs file I have the following lines :
;; Load ODT backend to allow for exporting to open document format.
(eval-after-load "org" '(require 'ox-odt nil t))
;;set env for odt
(setenv "PATH" (concat (getenv "PATH") ";" "C:\zip"))
(setq exec-path (append exec-path '("C:\zip")))
In the folder C:\zip, I placed the zip executable (in fact Wiz.exe renamed zip.exe). With the command C-x C-e o o, I get the error message mentioned above.
I also tried with 7z.exe. But in that case, I have the error message :
Embedding c:/Users/Julien/Documents/ORG/img/ergoemacs-layout-fr.png as Images/0002.png...
Wrote c:/Users/Julien/AppData/Local/Temp/odt-gAEsLl/meta.xml
Using schema c:/Emacs/emacs-26.3-x86_64/share/emacs/26.3/etc/schema/od-schema-v1.2-os.rnc [2 times]
Saving file c:/Users/Julien/AppData/Local/Temp/odt-gAEsLl/styles.xml...
Wrote c:/Users/Julien/AppData/Local/Temp/odt-gAEsLl/styles.xml
Using vacuous schema
Wrote c:/Users/Julien/AppData/Local/Temp/odt-gAEsLl/mimetype
Using vacuous schema
Saving file c:/Users/Julien/AppData/Local/Temp/odt-gAEsLl/META-INF/manifest.xml...
Wrote c:/Users/Julien/AppData/Local/Temp/odt-gAEsLl/META-INF/manifest.xml
Saving file c:/Users/Julien/AppData/Local/Temp/odt-gAEsLl/content.xml...
Wrote c:/Users/Julien/AppData/Local/Temp/odt-gAEsLl/content.xml
Creating ODT file...
Running zip -mX0 pad.odt mimetype
OpenDocument export failed: Unable to create OpenDocument file. Zip failed with error (
7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21
Based on https://lists.gnu.org/archive/html/emacs-orgmode/2013-04/msg00538.html, you may also get the zip executable from
https://fossies.org/windows/misc/zip300xn.zip/
Based on https://lists.gnu.org/archive/html/emacs-orgmode/2013-04/msg00489.html, you can use the zip package from following links
http://gnuwin32.sourceforge.net/packages.html
http://gnuwin32.sourceforge.net/packages/zip.htm
Related
I tried the below code with pycharm IDE and found that file is being created for append mode.
As we learn in course lecture that file will be created only with write mode ='w'
with open('xyz.txt',mode= 'a') as xyz_file:
xyz_file.write('This file is created in append mode')
with open('xyz.txt',mode= 'r') as xyz_file:
print(xyz_file.read())
I was aware that there is no file that exists with the name xyz.txt in my python file path. yet with the above code, it is created and the text appended.
The python open() command will create the file if the mode is 'w', 'a', or 'x'.
I believe that if you want to be able to write in a file but still error if the file is not created, the 'r+' mode will do that.
GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.7)
Org-mode version 8.3.2 (org-20151005)
org-odt related config's in my .emacs:
;;ox-odt
(require 'ox-odt)
;;/usr/share/emacs/site-list/org-mode/etc
(setq org-odt-data-dir "/usr/share/emacs/24.3/etc/org/styles")
Styles folder contains:
1. od-manifest-schema-v1.2-os.rnc
2. od-schema-v1.2-os.rnc
3. OrgOdtContentTemplate.xml
4. OrgOdtStyles.xml
5. schemas.xml
Other .emacs config's set through M-x customize-variable RET
(custom-set-variables
'(org-export-backends (quote (ascii html icalendar latex odt taskjuggler)))
'(org-odt-convert-process "LibreOffice")
'(org-odt-preferred-output-format "odt"))
However when trying to convert cvArun.org file to odt through C-c C-e o O, mini buffer says -
No such file: /home/deadlytackler/Documents/AKK/cvArun.odt
Debug on error is enabled globally however it doesn't give any 'backtrace'. Message has following message -
`
LaTeX to MathML converter not available.
Formatting LaTeX using verbatim
Wrote /tmp/odt-2666UgV/meta.xml
Using vacuous schema [2 times]
Saving file /tmp/odt-2666UgV/styles.xml...
Wrote /tmp/odt-2666UgV/styles.xml
Using vacuous schema
Wrote /tmp/odt-2666UgV/mimetype
Using vacuous schema
Saving file /tmp/odt-2666UgV/META-INF/manifest.xml...
Wrote /tmp/odt-2666UgV/META-INF/manifest.xml
Saving file /tmp/odt-2666UgV/content.xml...
Wrote /tmp/odt-2666UgV/content.xml
(No changes need to be saved)
Creating ODT file...
Running zip -mX0 cvArun.odt mimetype
Running zip -rmTq cvArun.odt .
Created /home/deadlytackler/Documents/AKK/cvArun.odt
Executing soffice --headless --convert-to odt --outdir /home/deadlytackler/Documents/AKK/ /home/deadlytackler/Documents/AKK/cvArun.odt
Error: source file could not be loaded
Export to /home/deadlytackler/Documents/AKK/cvArun.odt failed
user-error: No such file: /home/deadlytackler/Documents/AKK/cvArun.odt
Any help in properly configuring org-odt would be highly appreciated, as unable to find what is stopping it to load source file (error).
I was recently troubled by the same error, setting
org-odt-preferred-output-format
to either odt or doc resulted in the same error. docx seemed to work okay though. Found this out by running emacs with -Q and loading
(require 'ox-odt)
to remove my config out of the equation.
Our network system is set up such that we can not write directly to the root directory (C:) so I get the following error when attempting to print.
Spooling with options (page headers are not supported)...
direct-print-region-helper: Opening output file: permission denied, c:/IP_139.222.92.102
If I could somehow change the location that emacs is attempting to write to (anywhere else) it would likely work.
GNU emacs 24.3.1 running on MS Win 7
I tried various solutions given in this thread and others with no success. I saw someone has commented about quoting the slashes. So, I entered
(setq printer-name "\\\\MyComputer\\HP8600")
(setq ps-printer-name "\\\\MyComputer\\HP8600")
in the .emacs file, and SUCCESS. Obviously you will have to change the names "MyComputer" to match your computer and HP8600 to your printer name (both available via Control Panel).
Adjust pr-temp-dir, e.g.:
(setq pr-temp-dir "c:/some/other/location")
After requiring 'printing, C-h v pr-temp-dir on my Linux system gives:
pr-temp-dir is a variable defined in `printing.el'.
Its value is "/tmp/"
Documentation:
Specify a directory for temporary files during printing.
See also `pr-ps-temp-file' and `pr-file-modes'.
You can customize this variable.
You may have to play with quoting or escaping a Windows-style path.
I'm using GNU/Linux distro (Arch, if that's relevant), Emacs v23.2.1, ESS v5.9 and AucTeX v11.86.
I want to setup AucTeX to recognize .Rnw files, so I can run LaTeX on .Rnw files with C-c C-c and get .dvi file automatically. I reckon it's quite manageable by editing .emacs file, but I still haven't got a firm grasp on Elisp.
Yet another problem is quite annoying - somehow, LaTeX is not recognizing \usepackage{Sweave} in preambule, so I actually need to copy Sweave.sty file (in my case located in /usr/share/R/texmf/Sweave.sty) to directory where .Rnw file is located (and I'm becoming more frustrated by the fact that this is common bug on Windows platforms!)
My question boils down to two problems:
how to make LaTeX recognize \usepackage{Sweave} (without copying Sweave.sty to "home" folder each time) [Edit: managed to do this; see comment after Dirk's answer]
how to setup AucTeX to compile .Rnw files to .dvi
That's two different questions.
For the first one, my Debian R packages make sure that there is a soft link from the $RHOME/share/texmf/ directory into the TeX file system tree, e.g. as /usr/share/texmf/tex/latex/R.
For the second question: dunno. I tend to run Sweave via a small shell script I crafted years ago even though I do all the editing in Emacs.
Edit, a few months later: Use ESS, rather than AucTeX. Then M-n s (i.e Alt-n followed by s) runs the Sweave step and M-n P runs the LaTeX compilation, with a call to Bibtex if needed.
After brief and efficient Googling, I've found this link, and at first glance, everything seems OK, but pdf file gets garbled after Sweaving... So I tackled this problem another way around: when in doubt, go bash! I've shamelessly stolen error checking function from Dirk's Sweave bash script available here. Basically, this is a workaround: R CMD Sweave gets executed on .Rnw file, hence latex comes in, and pdflatex after that...
I'll post a bash script that does the job for me. I must state that I'm not an advanced bash programmer, moreover I'm not even a programmer by vocation, so there's a great chance that this script can be optimized/written properly. Here goes:
#!/bin/bash
FILEBASE=${1%.*}
FILEXT=${1##*.}
FILEPATH=${1%/*}
TEXFILE=$FILEBASE.tex
PDFFILE=$FILEBASE.pdf
# errorexit
function errorexit () {
echo "Error: $1"
exit 1
}
# check if file exists
if [ ! -f $1 ]; then
errorexit "File $1 not found!"
else
# check for filename length
if [ ${#1} -lt 1 ]; then
errorexit "Need to specify argument file!"
else
# if filelength OK, check extension
if [ $FILEXT != "Rnw" ]; then
errorexit "You must pass Sweave (.Rnw) file!"
# finally, run Sweave
else
cd $FILEPATH && R CMD Sweave $1
# latex $TEXFILE
pdflatex $TEXFILE
# xdg-open $PDFFILE
fi
fi
fi
Then save/copy/move this script in any of echo $PATH folders (I keep mine in /usr/bin/), and make sure that it's named sweave, or choose whatever name you like, then put these lines in your .emacs file:
(global-set-key (kbd "C-c s")
(lambda ()
(interactive)
(shell-command (concat "sweave " buffer-file-name))))
Of course, you can change keybinding to suite your needs, and be sure to change sweave with script name placed in /usr/bin/.
Bare in mind that this is not an answer, but a workaround. If you have found a way to deal with AucTeX/ESS/Sweave integration, post it, and I'll give it a checkmark.
Prior to this workaround, I had to do M-n s to Sweave, followed by C-c C-c which is default keybind in AucTeX for LaTeX file compilation. Produced file is erroneous, so I had to give it a try with bash. It works for me, if you have any suggestions, please let me know.
Kind regards,
aL3xa
EDIT:
Inserted cd $FILEPATH
I'm trying to export a bunch of org mode files to PDF using emacs in batch mode. So far, only export to html seems to work.
When I export to html I see the following -
U:\tmp>d:\programs\emacs-23.1\bin\emacs.exe -batch --visit=Changelog.org --funcall org-export-as-html-batch
OVERVIEW
Exporting...
Exporting...
Saving file u:/tmp/Changelog.html...
Wrote u:/tmp/Changelog.html
HTML export done, pushed to kill ring and clipboard
However, there is no function like org-export-as-pdf-batch and so I tried the following.
U:\tmp>d:\programs\emacs-23.1\bin\emacs.exe -batch --visit=Changelog.org -eval "(org-export-as-pdf \"Changelog.pdf\")"
OVERVIEW
Exporting to PDF...
Exporting to LaTeX...
Wrong type argument: number-or-marker-p, "Changelog.pdf"
Any ideas on how to export to PDF? My org-mode version is 6.35i with on Emacs 23.1. I'm on WinXP.
Mistake in calling org-export-as-pdf.
First ARG use in calling org-export-as-latex and specifies how many levels of the outline should become headlines.
Try without ARG:
C:\> emacs.exe -batch --visit=Changelog.org --funcall org-export-as-pdf