Exporting from .org to .md (using either ox-gfm or normal markdown) org-mode adds unwanted backslashes (\) before each acute accent (`). So
`path/file` becomes \`path/file\`.
Any idea how I can turn that off?
Thanks, F
The backtick (grave accent) in Markdown is used to delimit code samples.
The equivalent in org-mode is the equal sign. For example, the following orgmode:
The file is at =/tmp/toto=
Exports as Markdown to:
The file is at `/tmp/toto`
If you want a backtick in Markdown, you have to escape it, and that is precisely what the org-mode exporter is doing.
Related
How do I make org mode not interpret a line that begins with an asterisk as a headline? I have some verbatim text in my org mode document. Some of the lines begin with an asterisk. Org mode interprets these lines as headlines. I don't want that.
Here is the text with some context:
* 20160721 Headline for July 21, 2016
I created a git repository for rfc-tools. It's in
~/Documents/rfc-tools.
Renamed grep-rfc-index.sh to search-rfc-index.sh because it searches.
That it uses grep is irrelevant.
Wrote a README.md for the project. Here it is:
#+BEGIN_SRC text
----- BEGIN QUOTED TEXT -----
This is the README.md for rfc-tools, a collection of programs for
processing IETF RFCs.
* fetch-rfcs-by-title.sh downloads into the current directory the RFCs
whose titles contain the string given on the command line. Uses an
rfc-index file in the current directory. Prefers the PDF version of
RFCs but will obtain the text version if the PDF is not available.
* fetch-sip-rfcs.sh downloads RFCs that contain "Session Initiation"
in their titles into the current directory.
* search-rfc-index.sh searches an rfc-index file in the current
directory for the string given on the command line. The string can
contain spaces.
* join-titles.awk turns the contents of an rfc-index file into a
series of long lines. Each line begins with the RFC number, then a
space, then the rest of the entry from the rfc-index.
----- END QUOTED TEXT -----
#+END_SRC
I want the lines between "----- BEGIN QUOTED TEXT -----" and "----- END QUOTED TEXT -----" to be plain text and subordinate to the headline "20160721 Headline for July 21, 2016". Org mode interprets all lines that begin with an asterisk as top-level headlines.
By the way, the verbatim text is Markdown. I hope that doesn't matter.
worked for me:
#+BEGIN_SRC markdown
Try wrapping your text in one of the various special block tags. For example you could try putting your text inside these tags:
#+BEGIN_SRC text
...
#+END_SRC
Here is a screenshot of how the formatting turns out on my Emacs:
If that doesn't meet your needs, you could try:
#+BEGIN_EXAMPLE
...
#+END_EXAMPLE
Which will render everything inside the tags without markup and in a monospace font.
If that doesn't work either, you could try one of the other kinds of tags listed here.
Escape the * with a comma like this,*
Probably if you type C-c ' to enter a special edit and then exit, org will do that for you.
I think the answer is "You can't do that". I found a way to work around the problem using drawers. The org-mode manual explains that a drawer is a place to put text that you don't want to see all of the time.
A StackExchange user had a question about
getting a custom org drawer to open/close. It seems that for older versions of org-mode, you must tell org-mode the names of your drawers. E.g. If you have a drawer named "COMMANDS"
:COMMANDS:
ls
cat
grep
:END:
you must tell org-mode the name of the drawer using the +DRAWERS keyword:
#+DRAWERS COMMAND
and restart org-mode.
I found a solution:
Escape Character
You may sometimes want to write text that looks like Org syntax, but should really read as plain text. Org may use a specific escape character in some situations, i.e., a backslash in macros (see Macro Replacement) and links (see Link Format), or a comma in source and example blocks (see Literal Examples). In the general case, however, we suggest to use the zero width space. You can insert one with any of the following:
C-x 8 zero width space
C-x 8 200B
For example, in order to write ‘[[1,2]]’ as-is in your document, you may write instead
[X[1,2]]
where ‘X’ denotes the zero width space character.
How to remove zero width space:
sed -i "s/$(echo -ne '\u200b')//g" abc.txt
I've got a table in Emacs org-mode, and the contents are regular expressions. I can't seem to figure out how to escape a literal pipe-character (|) that's part of a regex though, so it's interpreted as a table-cell separator. Could someone point me to some help? Thanks.
Update: I'm also looking for escapes for a slash (/), so that it doesn't trigger the start of an italic/emphasis sequence. I experimented with \/ and \// - for example, suppose I want the literal text /foo/ in a table cell. Here are 3 ways of attempting it:
| /foo/ | \/foo/ | \//foo/ |
In LaTeX export, that becomes:
\emph{foo} & \/foo/ & \//foo/
So none of them is the plain /foo/ I'm hoping for.
\vert for the pipe.
Forward slashes seem to work fine for me unescaped when exporting both to HTML and PDF.
Use a broken-bar character, “¦”, Unicode 00A6 BROKEN BAR. This may or may not work for your specific needs, but it’s a good visual approximation.
You could also format the relevant text as verbatim or code:
Text in the code and verbatim string is not processed for Org mode
specific syntax; it is exported verbatim.
So you might try something like =foo | bar= (code) or foo ~|~ bar (verbatim). It does change the output format, though.
I am converting a MS Word-document (.docx) with Pandoc to LaTeX (.tex). The .docx-file contains backslashes and brackets which Pandoc converts to the corresponding LaTeX-commands (e.g. \textbackslash) what I do not want.
How can I prevent Pandoc from converting special characters?
I think pandoc is actually doing what you want. You cannot have plain backslashes in LaTeX since they would be interpreted as commands, so instead you have to use \textbackslash{}, which is the command to print a simple plain backslash in LaTeX. Try generating a PDF with LaTeX and you'll see what I mean.
If you actually want to include LaTeX commands in your Word file, I think that's not possible. (How would pandoc know whether the word user wanted to write a backslash or a LaTeX command?) However, you can transform your word doc to markdown, adjust it (in pandoc markdown you actually can include raw TeX), then export it to LaTeX.
pandoc input.docx -o file.md
# edit file.md now
pandoc file.md -o output.tex
For a more automated solution, you could look into pandoc filters. Then it's up to you how to solve the ambiguity of backslashes...
What is the intended difference between ~code~ and =verbatim= markup in Org-mode? Exporting to HTML in both cases yields <code> tags.
Same for LaTeX...
Though, as they are fontified differently in your buffer, you can use them for different semantics.
Personally, I use "code" for var/func names, commands to be typed, etc; and "verbatim" for paths or file names.
I would have loved to have the same number of markups as there are in TeX Info, but that's not the case...
In Org 8.0 (ox-* exporters) there are a few differences.
In LaTeX
Code comes out as `\verb{sep}content{sep} where {sep} is found as an appropriate delimiter.
Verbatim comes out as \texttt{content} with certain characters escaped/protected.
In HTML and ODT
Code and Verbatim are treated identically
In TeXInfo
The same behaviour is followed as in LaTeX.
I've got a table in Emacs org-mode, and the contents are regular expressions. I can't seem to figure out how to escape a literal pipe-character (|) that's part of a regex though, so it's interpreted as a table-cell separator. Could someone point me to some help? Thanks.
Update: I'm also looking for escapes for a slash (/), so that it doesn't trigger the start of an italic/emphasis sequence. I experimented with \/ and \// - for example, suppose I want the literal text /foo/ in a table cell. Here are 3 ways of attempting it:
| /foo/ | \/foo/ | \//foo/ |
In LaTeX export, that becomes:
\emph{foo} & \/foo/ & \//foo/
So none of them is the plain /foo/ I'm hoping for.
\vert for the pipe.
Forward slashes seem to work fine for me unescaped when exporting both to HTML and PDF.
Use a broken-bar character, “¦”, Unicode 00A6 BROKEN BAR. This may or may not work for your specific needs, but it’s a good visual approximation.
You could also format the relevant text as verbatim or code:
Text in the code and verbatim string is not processed for Org mode
specific syntax; it is exported verbatim.
So you might try something like =foo | bar= (code) or foo ~|~ bar (verbatim). It does change the output format, though.