开发者

In Emacs org-mode, Latex export of literal string containing "\__" giving problem

I am trying to export a literal string from Emacs Org-mode to Latex for subsequent export to PDF. The literal string is:

str1\__str2

I have tried the following input in the Org file:

\verb+str1\__str2+

This produces the following code in the .tex file:

\verb+str1\hspace{3ex}str2+

I expected the following code in the .tex file:

\verb+str1\__str2+

I have also tried the following in the Org file:

\begin{verbatim}
str1\__str2
\end{verbatim}

This produces the following code in .tex file:

\begin{verbatim}
str1\hspace{3ex}str2
\end{verbatim}

Including 开发者_如何转开发the following option in the Org file has no effect on the output:

#+OPTIONS:     ^:{}


If you don't mind the verbatim block, which you indicated above you're ok with, then this:

#+BEGIN_EXAMPLE
   str1\__str2
#+END_EXAMPLE

Produces this:

\begin{verbatim}
str1\__str2
\end{verbatim}


You can use org-entities-user to create your own entities with different translations on export.

Setting it to e.g. (("textbackslash" "\\textbackslash" nil "\\" "\\" "\\" "\\")) will translate \textbackslash to \textbackslash on LaTeX output and to \ for all other outputs.


This ugly workaround may help:

| str1\textbackslash{}\_\_str2  |

I cannot get the backslash thing out of the way, which will not look good on HTML export.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜