3

I have recently started using org-mode as an electronic lab notebook for my work, and would like to combine these files with the files that I have set up in my old lab notebook, which was done in LaTeX.

The way my old notebook works is that each day goes under a file, e.g. 20161129.tex, and this file is added to the notebook using the \input{} command, so there is no preamble or \begin{document} in 20161129.tex, and it just starts with \section{2016-11-29 Tuesday}.

Given my file in org-mode, e.g.,

* Logbook
:PROPERTIES:
:DATE_TREE:
:END:
** 2016
*** 2016-11 November
**** 2016-11-29 Tuesday
***** Validation cases for subgrid
Some text and some math ($a + b = c$) to export.

I would like to export the 2016-11-09 subtree so that the resulting TeX file only contains the following content:

\section{2016-11-29  Tuesday}
Some text and some math ($a + b = c$) to export.

Preferably, this would be auto-exported and saved with the date (2016-11-29.tex), but having the same thing in a LaTeX buffer would be almost as good.

3

C-c C-e opens the export dialog.

At that point, C-b to toggles 'body-only' - set this to 'on' to ignore all the preamble stuff.

And finally, C-s allows you to select the scope for export. In this case, select subtree and you should have what you're after:

\section{2016-11-29 Tuesday}
\label{sec-1}
\subsection{Validation cases for subgrid}
\label{sec-1-1}
Some text and some math ($a + b = c$) to export.

For details, see (org) The export dispatcher

  • Thanks, swore that I had tried that before. I must have tried compiling with the 'body-only' option which threw an error. Is there a way to set the level of the exported subtree to a section instead of title? If I set the cursor on the subtree for a specific day, it exports the tree name 2016-11-29 Tuesday as the title, and I'd like it to be at the section level. – chasely Nov 29 '16 at 22:07
  • See my update -that's what I am getting, with emacs -Q. It does seem to be fussy about where point is when you call the exporter, sometimes it takes the child of the current subtree instead of the subtree i'm on ? – Tyler Nov 29 '16 at 22:48
  • Interesting, I still have the same issue running emacs -Q. My first section is \section{Validation cases for subgrid}. Guess I will need to look into this a little more and report back. – chasely Nov 30 '16 at 0:47
  • I've marked this as correct, as it does 99% of what I need. The one thing I was not able to get was consistent behavior of getting the sections correct. To remedy this, after I am done with a day I add the :noexport: tag to the daily subtree header, and then export from the monthly subtree using the process Tyler outlined. This gets me the behavior I want with minimal fuss. – chasely Dec 1 '16 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.