emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Exporting Latex fragment both rendered and verbatim
@ 2018-03-07 14:49 Jarmo Hurri
  2018-03-07 15:24 ` Eric S Fraga
  0 siblings, 1 reply; 7+ messages in thread
From: Jarmo Hurri @ 2018-03-07 14:49 UTC (permalink / raw)
  To: emacs-orgmode


Greetings all.

I have been using Org for years, but just bumped into a very simple
thing I don't know how to achieve.

Let's say I have a Latex fragment, and to illustrate the use of Latex, I
want to
1. write that fragment in an Org file
2. export the file so that the fragment is exported both verbatim and
   rendered (by pdflatex or similar).

It is easy to export the fragment rendered as follows:

  #+BEGIN_EXPORT latex
    Here is an interesting (and true) equation: 
    \begin{equation} 
    \int uv' = uv - \int u'v \label{int}. 
    \end{equation}
    And that happens to be equation \eqref{int} on page \pageref{int}.
  #+END_EXPORT

It is easy to export it verbatim as follows:

  #+name: fragment
  #+BEGIN_SRC latex
    Here is an interesting (and true) equation: 
    \begin{equation} 
    \int uv' = uv - \int u'v \label{int}. 
    \end{equation}
    And that happens to be equation \eqref{int} on page \pageref{int}.
  #+END_SRC

But what is the correct combination of environments (src, export) and
header arguments (noweb, exports, results, ...) which allows me to only
write the fragment once and produce both effects? I have tried quite a
few.

Jarmo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Exporting Latex fragment both rendered and verbatim
  2018-03-07 14:49 Exporting Latex fragment both rendered and verbatim Jarmo Hurri
@ 2018-03-07 15:24 ` Eric S Fraga
  2018-03-07 16:53   ` Jarmo Hurri
  0 siblings, 1 reply; 7+ messages in thread
From: Eric S Fraga @ 2018-03-07 15:24 UTC (permalink / raw)
  To: Jarmo Hurri; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 615 bytes --]

On Wednesday,  7 Mar 2018 at 16:49, Jarmo Hurri wrote:

[...]

> It is easy to export it verbatim as follows:
>
>   #+name: fragment
>   #+BEGIN_SRC latex
>
>     Here is an interesting (and true) equation: 
>     \begin{equation} 
>     \int uv' = uv - \int u'v \label{int}. 
>     \end{equation}
>     And that happens to be equation \eqref{int} on page \pageref{int}.
>   #+END_SRC
>
> But what is the correct combination of environments (src, export) and

Use this src block but add ":exports both" to the begin_src line.

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-191-g90607d

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Exporting Latex fragment both rendered and verbatim
  2018-03-07 15:24 ` Eric S Fraga
@ 2018-03-07 16:53   ` Jarmo Hurri
  2018-03-07 17:40     ` Eric S Fraga
  0 siblings, 1 reply; 7+ messages in thread
From: Jarmo Hurri @ 2018-03-07 16:53 UTC (permalink / raw)
  To: emacs-orgmode


>> It is easy to export it verbatim as follows:
>>
>>   #+name: fragment
>>   #+BEGIN_SRC latex
>>
>>     Here is an interesting (and true) equation: 
>>     \begin{equation} 
>>     \int uv' = uv - \int u'v \label{int}. 
>>     \end{equation}
>>     And that happens to be equation \eqref{int} on page \pageref{int}.
>>   #+END_SRC
>>
>> But what is the correct combination of environments (src, export) and
>
> Use this src block but add ":exports both" to the begin_src line.

Tried this before: for some weird (?) reason I am getting the verbatim
output only. And ":exports results" produces blank.

This is a beamer export with org version 9.1.6.

Hmm...

Jarmo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Exporting Latex fragment both rendered and verbatim
  2018-03-07 16:53   ` Jarmo Hurri
@ 2018-03-07 17:40     ` Eric S Fraga
  2018-03-07 18:21       ` Jarmo Hurri
  2018-03-07 18:32       ` Jarmo Hurri
  0 siblings, 2 replies; 7+ messages in thread
From: Eric S Fraga @ 2018-03-07 17:40 UTC (permalink / raw)
  To: Jarmo Hurri; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 285 bytes --]

On Wednesday,  7 Mar 2018 at 18:53, Jarmo Hurri wrote:
> Tried this before: for some weird (?) reason I am getting the verbatim
> output only. And ":exports results" produces blank.

Very strange.  Attached are the org file I used to try this out and the
result of exporting to LaTeX.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: a.org --]
[-- Type: text/x-org, Size: 271 bytes --]

* test
#+name: fragment
#+BEGIN_SRC latex :exports both

  Here is an interesting (and true) equation: 
  \begin{equation} 
  \int uv' = uv - \int u'v \label{int}. 
  \end{equation}
  And that happens to be equation \eqref{int} on page \pageref{int}.
#+END_SRC

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.3: a.tex --]
[-- Type: text/x-tex, Size: 1403 bytes --]

% Created 2018-03-07 Wed 17:38
% Intended LaTeX compiler: pdflatex
\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{soul}
\usepackage{listings}
\usepackage[version=3]{mhchem}
\usepackage{doi}
\usepackage{amsmath}
\usepackage[british, english]{babel}
\author{Eric S Fraga}
\date{\today}
\title{}
\hypersetup{
 pdfauthor={Eric S Fraga},
 pdftitle={},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 27.0.50 (Org mode 9.1.6)}, 
 pdflang={English}}
\begin{document}

\tableofcontents

\section{test}
\label{sec:orgb830d36}
\lstset{language=[LaTeX]TeX,label=fragment,caption= ,captionpos=b,numbers=none}
\begin{lstlisting}

Here is an interesting (and true) equation: 
\begin{equation} 
\int uv' = uv - \int u'v \label{int}. 
\end{equation}
And that happens to be equation \eqref{int} on page \pageref{int}.
\end{lstlisting}

Here is an interesting (and true) equation: 
\begin{equation} 
\int uv' = uv - \int u'v \label{int}. 
\end{equation}
And that happens to be equation \eqref{int} on page \pageref{int}.
\end{document}

[-- Attachment #1.4: Type: text/plain, Size: 70 bytes --]


-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-191-g90607d

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Exporting Latex fragment both rendered and verbatim
  2018-03-07 17:40     ` Eric S Fraga
@ 2018-03-07 18:21       ` Jarmo Hurri
  2018-03-07 22:17         ` Eric S Fraga
  2018-03-07 18:32       ` Jarmo Hurri
  1 sibling, 1 reply; 7+ messages in thread
From: Jarmo Hurri @ 2018-03-07 18:21 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 435 bytes --]

Eric S Fraga <esflists@gmail.com> writes:

> On Wednesday,  7 Mar 2018 at 18:53, Jarmo Hurri wrote:
>> Tried this before: for some weird (?) reason I am getting the verbatim
>> output only. And ":exports results" produces blank.
>
> Very strange.  Attached are the org file I used to try this out and the
> result of exporting to LaTeX.

And when I export your a.org to LaTeX, I get the attached tex with a
verbatim environment only:


[-- Attachment #2: my tex export --]
[-- Type: application/octet-stream, Size: 863 bytes --]

% Created 2018-03-07 Wed 20:08
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\date{\today}
\title{}
\hypersetup{
 pdfauthor={},
 pdftitle={},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 25.3.1 (Org mode 9.1.7)}, 
 pdflang={English}}
\begin{document}

\tableofcontents

\section{test}
\label{sec:org9108211}
\begin{verbatim}

Here is an interesting (and true) equation: 
\begin{equation} 
\int uv' = uv - \int u'v \label{int}. 
\end{equation}
And that happens to be equation \eqref{int} on page \pageref{int}.
\end{verbatim}
\end{document}

[-- Attachment #3: Type: text/plain, Size: 289 bytes --]


Even the document classes are different. Now I am running org 9.1.7, by
the way, just did a git pull and all.

So this is a setup issue of some kind. Where should I begin... Our emacs
versions differ quite a bit (yours 27, mine 25). But that is not likely
to be the issue.

Ideas?

Jarmo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Exporting Latex fragment both rendered and verbatim
  2018-03-07 17:40     ` Eric S Fraga
  2018-03-07 18:21       ` Jarmo Hurri
@ 2018-03-07 18:32       ` Jarmo Hurri
  1 sibling, 0 replies; 7+ messages in thread
From: Jarmo Hurri @ 2018-03-07 18:32 UTC (permalink / raw)
  To: emacs-orgmode


Eric S Fraga <esflists@gmail.com> writes:

> Very strange.  Attached are the org file I used to try this out and the
> result of exporting to LaTeX.

Got it: I did not have latex in my org-babel-do-load-languages.

Thanks!

Jarmo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Exporting Latex fragment both rendered and verbatim
  2018-03-07 18:21       ` Jarmo Hurri
@ 2018-03-07 22:17         ` Eric S Fraga
  0 siblings, 0 replies; 7+ messages in thread
From: Eric S Fraga @ 2018-03-07 22:17 UTC (permalink / raw)
  To: Jarmo Hurri; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 383 bytes --]

On Wednesday,  7 Mar 2018 at 20:21, Jarmo Hurri wrote:

[...]

> Even the document classes are different. Now I am running org 9.1.7, by
> the way, just did a git pull and all.

Ah, that's because I do modify the default LaTeX class for
export...  sorry!

But I see that you've sorted the problem out.

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-191-g90607d

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-03-07 22:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-07 14:49 Exporting Latex fragment both rendered and verbatim Jarmo Hurri
2018-03-07 15:24 ` Eric S Fraga
2018-03-07 16:53   ` Jarmo Hurri
2018-03-07 17:40     ` Eric S Fraga
2018-03-07 18:21       ` Jarmo Hurri
2018-03-07 22:17         ` Eric S Fraga
2018-03-07 18:32       ` Jarmo Hurri

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).