Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Org-mode: protect emphasis

Tags:

emacs

org-mode

How could I protect emphasis like italics or code within Emacs org-mode when I have things like

/cologne/dome/

or

=<pre language="python">=

?

like image 634
dshh2011 Avatar asked Feb 20 '12 19:02

dshh2011


1 Answers

The following org-block demonstrates which parts work by default and which need a small amount of work-around to work.

The following was created using Org-mode version 7.8.03 (release_7.8.03.321.gaac1c). If you're using an older version it is possible that the behaviour is slightly different.

See Literal Examples and Monospace in the Org-Manual for full details

ORG
* Italics
  - Your example simply works\\
    /cologne/dome/
  - It also works if your /example had / spaces within it/
  - It will only fail if / your /have spaces on one end or the other /
* Code
  Code blocks can be delimited in multiple ways:
 ** Inline formatting
    - Using ~ for verbatim text works\\
      ~<pre language="python">~
    - ~ renders the same as = for blocks =test= ~test~
 ** Code Blocks
    - Single-line blocks
      : <pre language="python">
    - Multi-line blocks
      #+BEGIN_EXAMPLE
        asdf
      #+END_EXAMPLE
HTML Export
<div id="outline-container-1" class="outline-2">
<h2 id="sec-1"><span class="section-number-2">1</span> Italics</h2>
<div class="outline-text-2" id="text-1">

<ul>
<li>Your example simply works<br/>
  <i>cologne/dome</i>
</li>
<li>It also works if your <i>example had / spaces within it</i>
</li>
<li>It will only fail if / your /have spaces on one end or the other /
</li>
</ul>

</div>

</div>

<div id="outline-container-2" class="outline-2">
<h2 id="sec-2"><span class="section-number-2">2</span> Code</h2>
<div class="outline-text-2" id="text-2">

<p>Code blocks can be delimited in multiple ways:
</p>
</div>

<div id="outline-container-2-1" class="outline-3">
<h3 id="sec-2-1"><span class="section-number-3">2.1</span> Inline formatting</h3>
<div class="outline-text-3" id="text-2-1">

<ul>
<li>Using ~ for verbatim text works<br/>
  <code>&lt;pre language="python"&gt;</code>
</li>
<li>~ renders the same as = for blocks <code>test</code> <code>test</code>
</li>
</ul>

</div>

</div>

<div id="outline-container-2-2" class="outline-3">
<h3 id="sec-2-2"><span class="section-number-3">2.2</span> Code Blocks</h3>
<div class="outline-text-3" id="text-2-2">

<ul>
<li>Single-line blocks
<pre class="example">
&lt;pre language="python"&gt;
</pre>

</li>
<li>Multi-line blocks



<pre class="example">asdf
</pre>

</li>
</ul>
LaTeX Export
\section{Italics}
\label{sec-1}

\begin{itemize}
\item Your example simply works\\
\emph{cologne/dome}
\item It also works if your \emph{example had / spaces within it}
\item It will only fail if / your /have spaces on one end or the other /
\end{itemize}
\section{Code}
\label{sec-2}

Code blocks can be delimited in multiple ways:
\subsection{Inline formatting}
\label{sec-2-1}

\begin{itemize}
\item Using \~{} for verbatim text works\\
\verb~<pre language="python">~
\item \~{} renders the same as = for blocks \texttt{test} \verb~test~
\end{itemize}
\subsection{Code Blocks}
\label{sec-2-2}

\begin{itemize}
\item Single-line blocks
\begin{verbatim}
   <pre language="python">
\end{verbatim}
\item Multi-line blocks

\begin{verbatim}
asdf
\end{verbatim}
\end{itemize}
like image 101
Jonathan Leech-Pepin Avatar answered Sep 28 '22 16:09

Jonathan Leech-Pepin