When I create a new org-mode file, I create a header similar to this:
#+TITLE: Some title
#+AUTHOR: Me
#+CATEGORY: things
#+STARTUP: align fold nodlcheck oddeven lognotestate
#+OPTIONS: H:4 num:nil toc:t \n:nil #:t ::t |:t ^:{} -:t f:t *:t
#+OPTIONS: skip:nil d:(HIDE) tags:not-in-toc
#+LANGUAGE: en
#+PROPERTY: header-args :results code :exports both :noweb yes
However, when I specify the #+PROPERTY setting, it doesn't take effect until I reopen the file.
How can I force org-mode to re-read header configuration without closing the buffer and reopening it?
You could do a M-x revert-buffer. This is, in short, a „re-open file from disk” macro.
Related
I used to use markdown all the time. Now I use emacs org-mode for everything ("this koolaid tastes good"). One piece that kept driving me nuts was the ability to use backticks for inline code in emacs.
Everything I read wanted me to use easy templates for source code like this:
#+BEGIN_SRC
Just add: " < " + one of the letters below
s #+BEGIN_SRC ... #+END_SRC
e #+BEGIN_EXAMPLE ... #+END_EXAMPLE
q #+BEGIN_QUOTE ... #+END_QUOTE
v #+BEGIN_VERSE ... #+END_VERSE
c #+BEGIN_CENTER ... #+END_CENTER
l #+BEGIN_LaTeX ... #+END_LaTeX
L #+LaTeX:
h #+BEGIN_HTML ... #+END_HTML
H #+HTML:
a #+BEGIN_ASCII ... #+END_ASCII
A #+ASCII:
i #+INDEX: line
I #+INCLUDE: line
#+END_SRC
Then I stumbled onto the post by Mr. Abrams: Exporting inline code to html in org-mode. I just need to use =code= instead of 'code' for emacs inline quotes? OK. Why isn't this noted somewhere simple in the months worth of docs I've been perusing!? (It probably is!)
Now of course, I want to know how to customize the color, font, and size of these inline code snippets in emacs. The default size is too small and there is no subtle background color like with markdown.
Thank you
I believe Org Mode exports your current color theme. To verify that, you can change the colour scheme of your emacs and re-export your buffer to see if things change.
As for myself, I set org-html-htmlize-output-type to css and org-html-head to the following:
<link rel="stylesheet" type="text/css" href="path/to/my.css" />
This way, I can tune the css as I want regardless the colour theme of my emacs.
Below please see the help of org-html-htmlize-output-type:
org-html-htmlize-output-type is a variable defined in ‘ox-html.el’. Its value is ‘css’ Original value was inline-css
Documentation: Output type to be used by htmlize when formatting code snippets. Choices are ‘css’ to export the CSS selectors only,‘inline-css’ to export the CSS attribute values inline in the HTML or ‘nil’ to export plain text. We use as default ‘inline-css’, in order to make the resulting HTML self-containing.
…
To get a start for your css file, start Emacs session and make sure that all the faces you are interested in are defined, for example by loading files in all modes you want. Then, use the command ‘M-x org-html-htmlize-generate-css’ to extract class definitions.
You can customize this variable.
EDIT
Please put the following to your init.el, restart emacs and retry to see if it works:
(setq org-html-htmlize-output-type 'css)
(setq-default org-html-head "<link rel=\"stylesheet\" .../>")
I just need to use =code= instead of 'code' for emacs inline quotes?
I think this is because you didn't go through the manual carefully. Monospace is described in 11.2 Emphasis and Monospace
You can make words ‘bold’, ‘/italic/’, ‘underlined’, ‘=verbatim=’ and ‘~code~
If you want to represent a code block, you can use #+BEGIN_SRC and #+END_SRC pair.
#+BEGIN_SRC emacs-lisp
(defun org-xor (a b)
"Exclusive or."
(if a (not b) b))
#+END_SRC
As you have mentioned in your question description, you can type <s and TAB for auto completion.
I want to know how to customize the color, font, and size of these inline code snippets in emacs.
There are two levels to set font in org.
Change the font on a document-wide level
Add below #+HTML_HEAD_EXTRA: to the begin of your org file.
#+HTML_HEAD_EXTRA: <style>*{font-family:Arial,'Times New Roman','Microsoft YaHei',SimHei; font-size: 20px; font-style: italic; !important}</style>
#Lungang Fang gives you another way to place CSS.
Change the font size locally
#+BEGIN_EXPORT html
<p style="font-family:Monospace; font-size: 30px; font-style: italic;">
This is a customized line.
</p>
#+END_EXPORT
To customize the style of a block mentioned in your quetion description, you can see my other answer.
In emacs org-mode, is it possible to apply markup to the RESULTS section of a SRC block output when exporting to PDF (or any export format)?
For example, here is a src code block:
#+BEGIN_SRC python :results output :exports both
print '*I would like this line to be bold*'
#+END_SRC
#+RESULTS:
: *I would like this line to be bold*
The RESULTS section is generated by the usual C-c C-c.
Normally org-mode will mark up text in * as bold, but it obviously doesn't do this if that text is in a RESULTS block (or, it appears in a SRC block). In my example, if I export this (PDF via Latex) then I just get the exact output of
*I would like this line to be bold*
...there's no markup.
Answering my own question.
There are formatting modifiers you can add in the header section of the SRC block to do what I want. One of them is 'raw'.
#+BEGIN_SRC python :results output raw
print '*I would like this line to be bold*'
#+END_SRC
#+RESULTS:
*I would like this line to be bold*
(Ironically on Stack Overflow I'm not sure how to mix code blocks and bold face, but the bold line is the result of running the code block in org-mode).
There is a full list of ways to format output here:
http://orgmode.org/manual/results.html#results
I'm currently trying to write up my thesis in emacs org-mode, and have run into some problems with file inclusions.
When I include figures with:
#+NAME: fig:banana
#+CAPTION: this is a figure caption
[[/path/to/image.png]]
(or using a pdf) it works fine. But when I insert another image, it is somehow moved to the end of the file instead of being inserted where it is called.
My pdf-export process (in my ~/.emacs file) looks like this:
(setq org-latex-pdf-process
'("latexmk -pdflatex='pdflatex -interaction nonstopmode' -pdf -bibtex -f %f"))
Any ideas on how to fix this?
A friend of mine pointed me to the LaTex package placeins.
#+LATEX_HEADER: \usepackage{placeins}
* section 1
** hi!
#+TITLE: fig:banana
#+CAPTION: this is a banana figure
[[/link/to/banana.png]]
\FloatBarrier
* section 2
The FloatBarrier stops floats (figures are floats) from jumping over them. I will need to look into passing [tbh] options to figures from org mode further.
Check the org-mode manual on how to pass placement options such as [h], [t] etc. to theLaTeX compiler.
If you're not sure how to control where figures (more precisely, floats) get placed by LaTeX, please refer to any introduction.
Or do you want the figure to be placed where you include it? If so, you might not need it to be a float.
I use org-mode+LaTex to take scientific notes and produce them to PDFs, I can use
#+BEGIN_src latex:
\begin{equation}
\int_\text{Birth}^{Death} work \mathrm{d} t = \text{LIFT}
\end{equation}
#+END_src
to highlight all latex codes between codes #+BEGIN_src latex .... #+END but if I don't delete this codes before I produce my org-document to PDF, I will get the unexpected #+BEGIN_src latex and #+END in the PDF.
Is there a more convenient way that can make latex syntax highlighted in org-mode with no unexpected codes left in PDF?
I searched some info about highlight source codes in org-mode, however, it seem no one concerns my demand that I simply only need the function of highlights of the latex syntax to make me edit easily, not the highlights in the resulting PDF.
Thanks a lot.
The (first?) problem is the colon after "latex" on the first line.
I got sick of adding #+OPTIONS: ^:{} to the top of all of my .org files, so I thought I'd try to get that behavior once and for all by editing my .emacs file. Based on available documentation, it seems like
(setq org-export-with-sub-superscripts "{}")
would achieve the same behavior as #+OPTIONS: ^:{}, although when I do the (setq ... thing on its own, both A_B and A_{B} are rendered as A<sub>B</sub> in the HTML output. To ensure org-export-with-sub-superscripts is the right variable, I tried
(setq org-export-with-sub-superscripts nil)
which caused A_B to be rendered as A_B and A_{B} to be rendered as A_{B}—exactly what you'd expect. I've also tried '"{}", and (setq org-use-sub-superscripts "{}") (with and without quoting "{}"), neither of which worked.
I had this problem in Org mode 7.9.3, and it's followed me to 8.2.10. Any ideas what I'm doing incorrectly?
You must write instead:
(setq org-use-sub-superscripts '{})
Another approach is to define a template based on your #+OPTIONS
example:
here I have a template file to export to HTML which contains
---- level-0-html.org--------
#+DRAWERS: HIDDEN PROPERTIES STATE CABECALHO COMENTARIOS
:CABECALHO:
# # desabilita o superscrito/subscrito | não exporta programação
#+OPTIONS: ^:nil p:nil
#+OPTIONS: tags:nil
#+STARTUP: showeverything
#+STYLE: <link rel="stylesheet" type="text/css" href="../../css/leslie.css" />
#+LANGUAGE: pt_BR
#+OPTIONS: H:2 num:t toc:f \n:nil #:t ::t |:t ^:t -:t f:t *:t <:t
#+EXPORT_SELECT_TAGS: export
#+EXPORT_EXCLUDE_TAGS: noexport
#+TAGS: export(e) noexport(n)
#+LINK_UP:
#+LINK_HOME:
:END:
#+TITLE:
#+AUTHOR: Leslie H. Watter
#+EMAIL:
#+DATE:
------------------------------------------------
and in my org-file that I'll export I have:
----- presentation.org ------
#+SETUPFILE: ~/org/templates/level-0-html.org
#+TITLE: Gerência de Redes
#+AUTHOR: Leslie H. Watter
#+EMAIL: hooorayyyy # my domain .com
* Gerência de Redes
(and here goes the entire file)
------
This way I get a consistent way of exporting.
References: http://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.html#sec-6