emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Better way to specify the latex documentclass of an exported file without changing my configuration?
@ 2014-03-26  8:37 Alan Schmitt
  2014-03-26  9:24 ` Feng Shu
  2014-03-26 13:21 ` Nicolas Goaziou
  0 siblings, 2 replies; 12+ messages in thread
From: Alan Schmitt @ 2014-03-26  8:37 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I'm collaborating on a paper with some colleagues, and I convinced them
to use org-mode. I'm trying to make sure the paper is as self-contained
as possible (I don't want them to have to change their emacs
configuration file). To change the documentclass name of the exported
article, I added the following block in a section that is not exported:

--8<---------------cut here---------------start------------->8---
#+begin_src emacs-lisp :results silent :exports results
  (add-to-list 'org-latex-classes
               '("llncs"
                 "\\documentclass{llncs}"
                 ("\\section{%s}" . "\\section*{%s}")
                 ("\\subsection{%s}" . "\\subsection*{%s}")
                 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
#+end_src
--8<---------------cut here---------------end--------------->8---

My questions are:
- is there a way to do this without an emacs-lisp block?
- is there a nicer way to make sure that an emacs-lisp block is
evaluated upon export than ":exports results :results silent"? (If
I don't put it there, the block is not evaluated.)
- is there a way to just say the name of the documentclass without all
the boilerplate code below? In other words, can I say "this is a llncs
documentclass with the same sectioning as an article"?

Thanks,

Alan

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Better way to specify the latex documentclass of an exported file without changing my configuration?
  2014-03-26  8:37 Better way to specify the latex documentclass of an exported file without changing my configuration? Alan Schmitt
@ 2014-03-26  9:24 ` Feng Shu
  2014-03-26 12:38   ` Fabrice Niessen
  2014-03-26 12:47   ` Alan Schmitt
  2014-03-26 13:21 ` Nicolas Goaziou
  1 sibling, 2 replies; 12+ messages in thread
From: Feng Shu @ 2014-03-26  9:24 UTC (permalink / raw)
  To: emacs-orgmode

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> Hello,
>
> I'm collaborating on a paper with some colleagues, and I convinced them
> to use org-mode. I'm trying to make sure the paper is as self-contained
> as possible (I don't want them to have to change their emacs
> configuration file).To change the documentclass name of the exported

Maybe you can write a Makefile to change their emacs configure...
> article, I added the following block in a section that is not exported:
> --8<---------------cut here---------------start------------->8---
> #+begin_src emacs-lisp :results silent :exports results
>   (add-to-list 'org-latex-classes
>                '("llncs"
>                  "\\documentclass{llncs}"
>                  ("\\section{%s}" . "\\section*{%s}")
>                  ("\\subsection{%s}" . "\\subsection*{%s}")
>                  ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
> #+end_src
> --8<---------------cut here---------------end--------------->8---
>
> My questions are:
> - is there a way to do this without an emacs-lisp block?
> - is there a nicer way to make sure that an emacs-lisp block is
> evaluated upon export than ":exports results :results silent"? (If
> I don't put it there, the block is not evaluated.)
> - is there a way to just say the name of the documentclass without all
> the boilerplate code below? In other words, can I say "this is a llncs
> documentclass with the same sectioning as an article"?

You should defun a classe for llncs.sty before use it. maybe
you can rename llncs.sty to article.sty, and put it to directory which contain
your org file.

>
> Thanks,
>
> Alan

-- 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Better way to specify the latex documentclass of an exported file without changing my configuration?
  2014-03-26  9:24 ` Feng Shu
@ 2014-03-26 12:38   ` Fabrice Niessen
  2014-03-26 12:53     ` Alan Schmitt
  2014-03-26 12:47   ` Alan Schmitt
  1 sibling, 1 reply; 12+ messages in thread
From: Fabrice Niessen @ 2014-03-26 12:38 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Feng Shu wrote:
> Alan Schmitt <alan.schmitt-o/5/jSaJEHk+NdeTPqioyti2O/JbrIOy@public.gmane.org> writes:
>>
>> I'm collaborating on a paper with some colleagues, and I convinced
>> them to use org-mode. I'm trying to make sure the paper is as
>> self-contained as possible (I don't want them to have to change their
>> emacs configuration file).To change the documentclass name of the
>> exported
>
> Maybe you can write a Makefile to change their emacs configure...

You could have a look at Orgmk [1], a suite of shell scripts I wrote
with the following goals in mind:

- to be more productive, by running the export only when the source Org
  files are updated.

- *to share some common Emacs and Org configuration inside your team*,
  separately of what you have in your personal Emacs configuration file.

- to offload compilation into an external batch Emacs process, allowing
  you to go on editing or working while exporting the documents.

You just need to install it, and then using it is a simple as:

--8<---------------cut here---------------start------------->8---
  org2html [OPTION] FILE
  org2latex [OPTION] FILE
  org2pdf [OPTION] FILE
  org2beamerpdf [OPTION] FILE
  org2odt [OPTION] FILE
  org2txt [OPTION] FILE
  orgmk [OPTION]
  orgmk [OPTION] [html | pdf]
  orgmk [OPTION] [FILE]
--8<---------------cut here---------------end--------------->8---

Best regards,
Fabrice

[1] https://github.com/fniessen/orgmk

-- 
Fabrice Niessen
Leuven, Belgium
http://www.pirilampo.org/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Better way to specify the latex documentclass of an exported file without changing my configuration?
  2014-03-26  9:24 ` Feng Shu
  2014-03-26 12:38   ` Fabrice Niessen
@ 2014-03-26 12:47   ` Alan Schmitt
  2014-03-26 23:26     ` Richard Lawrence
  1 sibling, 1 reply; 12+ messages in thread
From: Alan Schmitt @ 2014-03-26 12:47 UTC (permalink / raw)
  To: Feng Shu; +Cc: emacs-orgmode

Feng Shu <tumashu@gmail.com> writes:

> Alan Schmitt <alan.schmitt@polytechnique.org> writes:
>
>> Hello,
>>
>> I'm collaborating on a paper with some colleagues, and I convinced them
>> to use org-mode. I'm trying to make sure the paper is as self-contained
>> as possible (I don't want them to have to change their emacs
>> configuration file).To change the documentclass name of the exported
>
> Maybe you can write a Makefile to change their emacs configure...

I don't want to push my luck ;-)

>> My questions are:
>> - is there a way to do this without an emacs-lisp block?
>> - is there a nicer way to make sure that an emacs-lisp block is
>> evaluated upon export than ":exports results :results silent"? (If
>> I don't put it there, the block is not evaluated.)
>> - is there a way to just say the name of the documentclass without all
>> the boilerplate code below? In other words, can I say "this is a llncs
>> documentclass with the same sectioning as an article"?
>
> You should defun a classe for llncs.sty before use it. maybe
> you can rename llncs.sty to article.sty, and put it to directory which contain
> your org file.

Yes, this could be a way to do it. The current approach works, I find it
a little bit too verbose, though.

Thank you for the suggestion,

Alan

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Better way to specify the latex documentclass of an exported file without changing my configuration?
  2014-03-26 12:38   ` Fabrice Niessen
@ 2014-03-26 12:53     ` Alan Schmitt
  2014-03-26 18:46       ` Thomas S. Dye
  0 siblings, 1 reply; 12+ messages in thread
From: Alan Schmitt @ 2014-03-26 12:53 UTC (permalink / raw)
  To: Fabrice Niessen; +Cc: emacs-orgmode

Hello Fabrice,

Fabrice Niessen <fni-news@pirilampo.org> writes:

> You could have a look at Orgmk [1], a suite of shell scripts I wrote
> with the following goals in mind:
>
> - to be more productive, by running the export only when the source Org
>   files are updated.
>
> - *to share some common Emacs and Org configuration inside your team*,
>   separately of what you have in your personal Emacs configuration
>   file.

This is very interesting ...

> - to offload compilation into an external batch Emacs process, allowing
>   you to go on editing or working while exporting the documents.

I usually export in offline mode, so I can keep editing while the export
is going on.

> You just need to install it, and then using it is a simple as:
>
>   org2html [OPTION] FILE
>   org2latex [OPTION] FILE
>   org2pdf [OPTION] FILE
>   org2beamerpdf [OPTION] FILE
>   org2odt [OPTION] FILE
>   org2txt [OPTION] FILE
>   orgmk [OPTION]
>   orgmk [OPTION] [html | pdf]
>   orgmk [OPTION] [FILE]

Thank you for the suggestion, I'll definitely have a look.

Alan

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Better way to specify the latex documentclass of an exported file without changing my configuration?
  2014-03-26  8:37 Better way to specify the latex documentclass of an exported file without changing my configuration? Alan Schmitt
  2014-03-26  9:24 ` Feng Shu
@ 2014-03-26 13:21 ` Nicolas Goaziou
  2014-03-26 13:54   ` Alan Schmitt
  1 sibling, 1 reply; 12+ messages in thread
From: Nicolas Goaziou @ 2014-03-26 13:21 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

Hello,

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> I'm collaborating on a paper with some colleagues, and I convinced them
> to use org-mode. I'm trying to make sure the paper is as self-contained
> as possible (I don't want them to have to change their emacs
> configuration file). To change the documentclass name of the exported
> article, I added the following block in a section that is not exported:
>
> #+begin_src emacs-lisp :results silent :exports results
>   (add-to-list 'org-latex-classes
>                '("llncs"
>                  "\\documentclass{llncs}"
>                  ("\\section{%s}" . "\\section*{%s}")
>                  ("\\subsection{%s}" . "\\subsection*{%s}")
>                  ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
> #+end_src
>
> My questions are:
> - is there a way to do this without an emacs-lisp block?

Yes there is, with a BIND keyword, e.g.:

  #+BIND: org-latex-classes (("article" "\\documentclass{llncs}" ("\\section{%s}" . "\\section*{%s}")))

Though you need to activate it with `org-export-allow-bind-keywords', if
only as a file local variable:

  # Local Variables:
  # org-export-allow-bind-keywords: t
  # End:

> - is there a nicer way to make sure that an emacs-lisp block is
> evaluated upon export than ":exports results :results silent"? (If
> I don't put it there, the block is not evaluated.)

You can put the block in a :noexport: section. Then, I don't think that
you need to then :exports or :results parameters.

> - is there a way to just say the name of the documentclass without all
> the boilerplate code below? In other words, can I say "this is a llncs
> documentclass with the same sectioning as an article"?

You can use a final filter to replace "article" with "llncs" in the
document, but there is no straightforward way, e.g., a keyword, to do
so.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Better way to specify the latex documentclass of an exported file without changing my configuration?
  2014-03-26 13:21 ` Nicolas Goaziou
@ 2014-03-26 13:54   ` Alan Schmitt
  2014-03-26 14:10     ` Nicolas Goaziou
  0 siblings, 1 reply; 12+ messages in thread
From: Alan Schmitt @ 2014-03-26 13:54 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

Hello Nicolas,

Nicolas Goaziou <n.goaziou@gmail.com> writes:

>> My questions are:
>> - is there a way to do this without an emacs-lisp block?
>
> Yes there is, with a BIND keyword, e.g.:
>
>   #+BIND: org-latex-classes (("article" "\\documentclass{llncs}" ("\\section{%s}" . "\\section*{%s}")))
>
> Though you need to activate it with `org-export-allow-bind-keywords', if
> only as a file local variable:
>
>   # Local Variables:
>   # org-export-allow-bind-keywords: t
>   # End:

Ah, yes, this is quite helpful. Thanks.

>> - is there a nicer way to make sure that an emacs-lisp block is
>> evaluated upon export than ":exports results :results silent"? (If
>> I don't put it there, the block is not evaluated.)
>
> You can put the block in a :noexport: section. Then, I don't think that
> you need to then :exports or :results parameters.

It is in a :noexport: section already. Here is a quick test.

Exporting

--8<---------------cut here---------------start------------->8---
* Test :noexport:

#+begin_src sh
echo "date 1" >> ~/tmp/results
echo `date` >> ~/tmp/results
#+end_src

#+begin_src sh :exports results :results silent
echo "date 2" >> ~/tmp/results
echo `date` >> ~/tmp/results
#+end_src
--8<---------------cut here---------------end--------------->8---

yields this "~/tmp/results" file:

--8<---------------cut here---------------start------------->8---
date 2
Wed Mar 26 14:46:08 CET 2014
--8<---------------cut here---------------end--------------->8---

The behavior is identical if the ":noexport:" tag is absent.

>> - is there a way to just say the name of the documentclass without all
>> the boilerplate code below? In other words, can I say "this is a llncs
>> documentclass with the same sectioning as an article"?
>
> You can use a final filter to replace "article" with "llncs" in the
> document, but there is no straightforward way, e.g., a keyword, to do
> so.

Thanks,

Alan

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Better way to specify the latex documentclass of an exported file without changing my configuration?
  2014-03-26 13:54   ` Alan Schmitt
@ 2014-03-26 14:10     ` Nicolas Goaziou
  2014-03-26 14:57       ` Alan Schmitt
  0 siblings, 1 reply; 12+ messages in thread
From: Nicolas Goaziou @ 2014-03-26 14:10 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> It is in a :noexport: section already. Here is a quick test.
>
> Exporting
>
> * Test :noexport:
>
> #+begin_src sh
> echo "date 1" >> ~/tmp/results
> echo `date` >> ~/tmp/results
> #+end_src
>
> #+begin_src sh :exports results :results silent
> echo "date 2" >> ~/tmp/results
> echo `date` >> ~/tmp/results
> #+end_src
>
> yields this "~/tmp/results" file:
>
> date 2 Wed Mar 26 14:46:08 CET 2014
>
> The behavior is identical if the ":noexport:" tag is absent.

Then I think you can at least remove the ":results silent" part, can't
you?


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Better way to specify the latex documentclass of an exported file without changing my configuration?
  2014-03-26 14:10     ` Nicolas Goaziou
@ 2014-03-26 14:57       ` Alan Schmitt
  0 siblings, 0 replies; 12+ messages in thread
From: Alan Schmitt @ 2014-03-26 14:57 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Alan Schmitt <alan.schmitt@polytechnique.org> writes:
>
>> It is in a :noexport: section already. Here is a quick test.
>>
>> Exporting
>>
>> * Test :noexport:
>>
>> #+begin_src sh
>> echo "date 1" >> ~/tmp/results
>> echo `date` >> ~/tmp/results
>> #+end_src
>>
>> #+begin_src sh :exports results :results silent
>> echo "date 2" >> ~/tmp/results
>> echo `date` >> ~/tmp/results
>> #+end_src
>>
>> yields this "~/tmp/results" file:
>>
>> date 2 Wed Mar 26 14:46:08 CET 2014
>>
>> The behavior is identical if the ":noexport:" tag is absent.
>
> Then I think you can at least remove the ":results silent" part, can't
> you?

Yes, indeed. I'm too used to putting these blocks in parts that are
actually exported. Sorry for the confusion,

Alan

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Better way to specify the latex documentclass of an exported file without changing my configuration?
  2014-03-26 12:53     ` Alan Schmitt
@ 2014-03-26 18:46       ` Thomas S. Dye
  2014-03-26 22:03         ` Alan Schmitt
  0 siblings, 1 reply; 12+ messages in thread
From: Thomas S. Dye @ 2014-03-26 18:46 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: Fabrice Niessen, emacs-orgmode

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> I usually export in offline mode, so I can keep editing while the export
> is going on.

If you and your colleagues export asynchronously, then the document
class (and other environment changes) can be placed in an initialization
file for the asynchronous process.

An approach that I'm exploring tangles this initialization file from
code that is kept in a noexport section of the document.  See
http://orgmode.org/worg/exporters/plos-one-template-worg.html for an
example that likely can be improved.

hth,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Better way to specify the latex documentclass of an exported file without changing my configuration?
  2014-03-26 18:46       ` Thomas S. Dye
@ 2014-03-26 22:03         ` Alan Schmitt
  0 siblings, 0 replies; 12+ messages in thread
From: Alan Schmitt @ 2014-03-26 22:03 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Fabrice Niessen, emacs-orgmode

Hello Tom,

tsd@tsdye.com (Thomas S. Dye) writes:

> Alan Schmitt <alan.schmitt@polytechnique.org> writes:
>
>> I usually export in offline mode, so I can keep editing while the export
>> is going on.
>
> If you and your colleagues export asynchronously, then the document
> class (and other environment changes) can be placed in an initialization
> file for the asynchronous process.
>
> An approach that I'm exploring tangles this initialization file from
> code that is kept in a noexport section of the document.  See
> http://orgmode.org/worg/exporters/plos-one-template-worg.html for an
> example that likely can be improved.

This would clearly make our export process more robust and reproducible.
Thanks a lot for the link, I'll look into it.

Alan

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Better way to specify the latex documentclass of an exported file without changing my configuration?
  2014-03-26 12:47   ` Alan Schmitt
@ 2014-03-26 23:26     ` Richard Lawrence
  0 siblings, 0 replies; 12+ messages in thread
From: Richard Lawrence @ 2014-03-26 23:26 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Alan Schmitt

Hi Alan,

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> Feng Shu <tumashu@gmail.com> writes:
>
>> Alan Schmitt <alan.schmitt@polytechnique.org> writes:
>>
>>> Hello,
>>>
>>> I'm collaborating on a paper with some colleagues, and I convinced them
>>> to use org-mode. I'm trying to make sure the paper is as self-contained
>>> as possible (I don't want them to have to change their emacs
>>> configuration file).To change the documentclass name of the exported
>>
>> Maybe you can write a Makefile to change their emacs configure...
>
> I don't want to push my luck ;-)

I wouldn't have a Makefile change their .emacs, but this does seem like
a good application for a Makefile or similar.

You can put code that configures Emacs/Org in the way you need for
compiling your document in a separate file in the repository, then load
that file using Emacs' --load flag in the command that runs the
export/compilation.

For example, here's a snippet of the Makefile I use for my
dissertation.  This compiles the bibliography from my Org-based reading
list:

#+BEGIN_EXAMPLE
BATCH_EMACS=$(EMACS) --batch -Q 

bib: tasks.org lib/el/bib-export.el
	$(BATCH_EMACS) --load lib/el/bib-export.el --file tasks.org --funcall reading-list-to-bibtex
#+END_EXAMPLE

(The code that lives in bib-export.el takes care of walking over the
reading entries in tasks.org and exporting them to Bibtex.  It is where
reading-list-to-bibtex is defined.  I'm happy to share if you want to
see it.)

This allows me to just type `make bib' to get a fresh copy of my .bib file.

Another nice thing about this approach is that you can use the -Q flag,
as I've done here, to make sure that Emacs' configuration is clean
before the export begins, which should make compilation more reliable.

-- 
Best,
Richard

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-03-26 23:28 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-26  8:37 Better way to specify the latex documentclass of an exported file without changing my configuration? Alan Schmitt
2014-03-26  9:24 ` Feng Shu
2014-03-26 12:38   ` Fabrice Niessen
2014-03-26 12:53     ` Alan Schmitt
2014-03-26 18:46       ` Thomas S. Dye
2014-03-26 22:03         ` Alan Schmitt
2014-03-26 12:47   ` Alan Schmitt
2014-03-26 23:26     ` Richard Lawrence
2014-03-26 13:21 ` Nicolas Goaziou
2014-03-26 13:54   ` Alan Schmitt
2014-03-26 14:10     ` Nicolas Goaziou
2014-03-26 14:57       ` Alan Schmitt

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).