6

Here is a bit of Org code:

Here's a bit of OCaml: ~let x' = 1 in x' + x'~.
Many ~x~s in there, no?
And this one is worse: ~x ~!~ x <> 0~ 

Exporting to PDF yields this:

rendered

How do I

  • Escape the ' to fix the first line?
  • Escape the s to fix the second line?
  • Escape the ~ to fix the third line?

I did not find any mention of this is the org manual.

2

2 Answers 2

1

Escape the ' to fix the first line?

Works for me with the development version.

Escape the s to fix the second line?

I don't think that's possible ATM in Org syntax. You might need something like @@latex:\texttt{x}s@@.

Escape the ~ to fix the third line?

=x ~!~ x <> 0=
5
  • 2
    Re the third one: that won't do; I do need a difference between Code and Verbatim.
    – Clément
    Aug 1, 2016 at 17:31
  • 1
    how about src_ocaml{x ~!~ x <> 0}?
    – rasmus
    Aug 2, 2016 at 9:09
  • Woops. Not sure how I missed your comment. I just came across these. Feel free to expand your answer, and I'll delete mine.
    – Clément
    Aug 8, 2016 at 0:25
  • Although src_ is broken as well: src_c{int main \{} keeps the escape character in there, and src_c{a{}b} stops at the first closing brace...
    – Clément
    Aug 8, 2016 at 0:50
  • 1
    You were right about the first one: it was fixed in org 9.
    – Clément
    Aug 10, 2016 at 1:46
4

Using inline code blocks fixes some of these issues; I'm not sure why I didn't come across them before:

#+PROPERTY: header-args :exports code

Here's a bit of OCaml: src_ocaml{let x' = 1 in x' + x'}.
Many src_ocaml{x}s in there, no?
And this one is worse: src_ocaml{x ~!~ x <> 0}.

And the output:

Here's a bit of OCaml: \texttt{let x' = 1 in x' + x'}.
Many \texttt{x}s in there, no?
And this one is worse: \texttt{x \textasciitilde{}!\textasciitilde{} x <> 0}.

It's not a panacea, of course: both src_c{int main \{} and src_c{a{}b} are broken...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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