Escaping org-mode footnote like text - org-mode

I've got "[16]" in an org-mode file that is the text you would see in an ipython shell. How do I escape that text so that it does not generate an org-mode footnote? It's fine inside of an example block, but not in the general text. The first [16] is trouble and everything I've tried so far has not produced just straight normal "[16]" in the html output when I export the file.
#+BEGIN_SRC python
def setfrequency():
print 'Setting frequency'
# Write code here to set the frequency
setfrequency()
#+END_SRC
# This next line is the footnote problem
Run it again and you should see this, but the command number [16]
will be different for you:
#+BEGIN_EXAMPLE
In [16]: run sonar # This does not export as a footnote.
Setting frequency
#+END_EXAMPLE
Thanks!

You can escape syntax using =[1]= (code) or ~[1]~ (verbatim) blocks. See the Org-Manual section on Emphasis and Monospace.
* This will export the footnote style brackets verbatim
[1] by itself will fail
=[1]= and ~[1]~ will export as is.
The relevant portion of HTML export for this is
<p class="footnote"><sup><a class="footnum" name="fn.1" href="#fnr.1">1</a>
</sup> by itself will fail
<code>[1]</code> and <code>[1]</code> will export as is.
</p>
<p class="footnote"><sup><a class="footnum" name="fn.1" href="#fnr.1">1</a>
</sup> DEFINITION NOT FOUND: 1

I tried this way.
Run it again and you should see this, but the command number
#+latex: [16]
will be different for you:

Related

How to markup org mode src block results?

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

Org-Mode ignore pagebreak latex cmds in HTML export

I've an org mode file with explicit page breaks using the \pagebreak latex in the file. However if I export it to HTML, I get the literal \pagebreak in the exported file. Is there a way to tell HTML export to ignore such lines?
thanks
SJ
Might try wrapping in Begin and End Latex's like this:
* This is a heading
#+Begin_Latex
\pagebreak
#+End_Latex
* Second heading

How can I stop org mode from moving my figures to the last page?

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.

how to highlight latex-syntax in org-mode but no effect on the produced PDF

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.

Getting Emacs fill-paragraph to play nice with javadoc-like comments

I'm writing an Emacs major mode for an APL dialect I use at work. I've gotten
basic font locking to work, and after setting comment-start and
comment-start-skip, comment/uncomment region and fill paragraph also
work.
However, comment blocks often contain javadoc style comments and i
would like fill-paragraph to avoid glueing together lines starting
with such commands.
If I have this (\ instead of javadoc #):
# This is a comment that is long and should be wrapped.
# \arg Description of argument
# \ret Description of return value
M-q gives me:
# This is a comment that is long and
# should be wrapped. \arg Description
# of argument \ret Description of
# return value
But I want:
# This is a comment that is long and
# should be wrapped.
# \arg Description of argument
# \ret Description of return value
I've tried setting up paragraph-start and paragraph-separate to
appropriate values, but fill-paragraph still doesn't work inside a
comment block. If I remove the comment markers, M-q works as I want
to, so the regexp I use for paragraph-start seems to work.
Do I have to write a custom fill-paragraph for my major
mode? cc-mode has one that handles cases like this, but it's really
complex, I'd like to avoid it if possible.
The problem was that the paragraph-start regexp has to match the entire line to work, including the actual comment character. The following elisp works for the example I gave:
(setq paragraph-start "^\\s-*\\#\\s-*\\\\\\(arg\\|ret\\).*$")
Here a page that has an example regexp for php-mode that does this:
http://barelyenough.org/blog/2006/10/nicer-phpdoc-comments/
There's other modes that have less complex functions used for fill-paragraph-function. Browsing through my install, it looks like the ones in ada-mode and make-mode are good examples.
What I do in these cases is open a blank line between the paragraph lines and the argument lines, then use M-q to wrap the paragraph lines, then kill the blank line between them. Not ideal, but it works and is easy enough to record in a macro if you need to repeat it.