Hi,

On Fri, 03 Jun 2016 06:36:12 +0100
Sharon Kimble <boudic...@skimble.plus.com> wrote:

> 
> How can I run an org-mode command in a bash script please?
> 
> Specifically 'org-latex-export-to-latex'?
> 
> I'm developing my own modular script to choose between, at present, 3
> tex files which have been pre-exported from org-mode. I'm now
> wondering if its possible to export from the org-mode file as part of
> another module in the script.
> 
> Can it be done, and if so, how please?


I'm using this shell function for exporting certain documents to pdf:


orgexp()
{
    emacs  --batch -l ~/.emacs --eval \
           "(progn
             (setq org-latex-image-default-width \".4cm\"
                   org-export-allow-bind-keywords t
                   org-confirm-babel-evaluate nil)
             (find-file \"$1\")
             (org-latex-export-to-pdf))"
}


You probably don't want to set the variables, so for export to latex
this might work (i.e. I didn't test it):


org2latex()
{
    emacs  --batch -l ~/.emacs --eval \
           "(progn
             (find-file \"$1\")
             (org-latex-export-to-latex))"
}


If you put this in your .bashrc you can just use
    org2latex myfile.org
to export myfile.org to latex.

Best regards
Robert

Reply via email to