Org-mode: Hide buffer settings/export options
Asked Answered
C

3

9

My org file contains many buffer settings/export options lines at the top, such as:

#+LaTeX_CLASS: koma-article
#+LaTeX_CLASS_OPTIONS: [a4paper,captions=nooneline,DIV=15]

This takes up a lot of screen space and requires having to scroll down to the working area when I open the file. Is there a way to hide these, such as in a drawer or block, that can be folded up or down as needed? I found this link which offers the use of #+SETUPFILE but I would prefer an option that keeps the options in the file I am working in. I tried creating a drawer as in:

#+BEGIN_OPTIONS
#+LaTeX_CLASS: koma-article
#+LaTeX_CLASS_OPTIONS: [a4paper,captions=nooneline,DIV=15]
...
#+END_OPTIONS

The above worked as I would like, being able to fold the options away into a single line at the top of my file. However, on export to PDF the contents of the drawer were displayed in the PDF file (The export options in the drawer were also applied to the format of the exported PDF, which is what I want, just without them displaying in the PDF itself).

Thank you in advance for any tips or advice.

Coriolanus answered 6/9, 2011 at 9:54 Comment(0)
A
14

As Juancho said you can place the export options anywhere in the document, however to expand slightly on his heading at the end of the file you can simply set up your configuration in an archived headline with a :noexport: tag (See: Selective Export and Latex Selective Exporting)

C-c C-x a   ;archive sub-tree while keeping in file
C-c C-q noexport ;add the noexport tag

* Export Configuration                                     :noexport:ARCHIVE:

With this not only will the content be hidden in a headline while you work on the file (It will only expand if you use C-Tab on the headline, not when cycling headlines globally), but it will not be exported to the final PDF.

You should also be able to set :ARCHIVE: as an excluded tag in the org-export-exclude-tags list so that you'd only need to have one tag on the headline, but the above works from the default settings.

Averi answered 6/9, 2011 at 22:47 Comment(2)
Thank you both for your advice. The :noexport:ARCHIVE: tag in a headline worked perfectly and is exactly what I was wanting. I am fairly new to Org-mode and love it. I also appreciate the willingness of fellow users such as yourselves to help Org-mode newbies like me! Great stuff. @JuanchoCoriolanus
Note that you can use #+OPTIONS: arch:nil in a file in order to turn off exporting of ARCHIVE tags for that file. Adding ARCHIVE to org-export-exclude-tags appears not to work, however.Phionna
D
3

The export options can be placed anywhere in the document, not necessarily at the top.

An option is to include the export options on a COMMENTed heading at the end of the file.

Dissatisfactory answered 6/9, 2011 at 11:13 Comment(1)
While this is true if one is exporting the whole file, one needs a different solution if one wishes to export only a subtree.Secede
T
0
#+BEGIN_OPTIONS
#+LaTeX_CLASS: koma-article
#+LaTeX_CLASS_OPTIONS: [a4paper,captions=nooneline,DIV=15]
...
#+END_OPTIONS

What you created when you wrote the above is a 'block' not a 'drawer'. There are some default blocks, such as #+BEGIN_EXAMPLE ... #+END_EXAMPLE, but you can also create custom blocks with #+BEGIN_<X> ... #+END_<X>, which is effectively what you did. If you export such a block to LaTeX you get \begin{X} ... \end{X}.

If you had successfully put the options into a drawer, you would have had the desired behaviour. It would look like this:

:OPTIONS:
#+LaTeX_CLASS: koma-article
#+LaTeX_CLASS_OPTIONS: [a4paper,captions=nooneline,DIV=15]
...
:END:

NB: the name of the draw doesn't have to be :OPTIONS:

Being inside a drawer has no effect on whether or not the line will export. Lines such as #+LaTeX_CLASS: koma-article do not get exported literally, and so will not export from within a drawer either.

Tyree answered 7/9, 2023 at 18:17 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.