Hi Eric,
Eric Schulte <[email protected]> writes:
> This actually is also an issue with shell code blocks. The fix is to
> customize the org-babel-inline-result-wrap variable (e.g., as follows)
> instead of setting the result type to RAW.
>
> (setq org-babel-inline-result-wrap "%s")
>
> Perhaps a note about this variable should be added to the description of
> inline code blocks (both call and src_*) in the manual.
AFAICT, this variable has no effect on export of calls to R source code
blocks, where the source code block is set with :results raw.
Also, AFAICT, the behavior of R source code blocks differs from others,
including shell.
With the default value of org-babel-inline-result-wrap I get this LaTeX
export:
\section{Export this subtree raw to \LaTeX{}}
\label{sec-1}
Will shell-2 export 2 with a newline?
Will r-2 export 2 with a newline?
Will shell-2-raw export 2 with a newline?
Will r-2-raw export 2
with a newline?
\section{Export this subtree without raw to \LaTeX{}}
\label{sec-2}
Will shell-2 export \texttt{2} with a newline?
Will r-2 export \texttt{2} with a newline?
Will shell-2-raw export \texttt{2} with a newline?
\begin{verbatim}
Will r-2-raw export 2
\end{verbatim}
with a newline?
% Emacs 24.3.1 (Org mode 8.2.5h)
With org-babel-inline-result-wrap set to "%s" I get this:
\section{Export this subtree raw to \LaTeX{}}
\label{sec-1}
Will shell-2 export 2 with a newline?
Will r-2 export 2 with a newline?
Will shell-2-raw export 2 with a newline?
Will r-2-raw export 2
with a newline?
\section{Export this subtree without raw to \LaTeX{}}
\label{sec-2}
Will shell-2 export 2 with a newline?
Will r-2 export 2 with a newline?
Will shell-2-raw export 2 with a newline?
\begin{verbatim}
Will r-2-raw export 2
\end{verbatim}
with a newline?
% Emacs 24.3.1 (Org mode 8.2.5h)
Note that there is no change in the LaTeX export of the R calls.
I think this is a bug in ob-R.el. From my experiments, it behaves
differently than the other babel languages, including shell.
For LaTeX export, the workaround is to avoid :results raw with R source
code blocks. Although a spurious newline is inserted into the source,
this is ignored by LaTeX.
All the best,
Tom
--
Thomas S. Dye
http://www.tsdye.com