emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Finer control over LaTeX export
@ 2013-12-31 15:02 Uwe Ziegenhagen
  2013-12-31 16:00 ` Nicolas Goaziou
  2013-12-31 16:38 ` Nick Dokos
  0 siblings, 2 replies; 3+ messages in thread
From: Uwe Ziegenhagen @ 2013-12-31 15:02 UTC (permalink / raw)
  To: emacs-orgmode

Hi everyone,

I have short parts of Python code in my org file:

#+begin_src python :results value
def foo(x):
  if x>0:
    return x+1

  else:
    return x-1

return foo(590)
#+end_src

#+RESULTS:
: 591

#+begin_src python :results value
return 1+1
#+end_src

#+RESULTS:
: 2

#+begin_src python :results output
print(1+2)
#+end_src

#+RESULTS:
: 3

These get exported to 

\#+begin$_{\text{src}}$ python :results output
print(1+2+3+4+5+6+7+8+9+11)
\#+end$_{\text{src}}$ python

\begin{verbatim}
56
\end{verbatim}
\section{{\bfseries\sffamily TODO} Emacs Artikel zur Code-Evaluation}
\label{sec-18}
\begin{verbatim}
def foo(x):
  if x>0:
    return x+1

  else:
    return x-1

return foo(590)
\end{verbatim}

\begin{verbatim}
return 1+1
\end{verbatim}

\begin{verbatim}
print(1+2)
\end{verbatim}

How can I define how Org Mode is exporting these snippets?

The whole verbatim stuff is "okay", I'd like to replace that with the
listings package, but the 



\#+begin$_{\text{src}}$ python :results output
print(1+2+3+4+5+6+7+8+9+11)
\#+end$_{\text{src}}$ python


requires amsmath just for the \text command, so this is also something I
want to change. Can anyone point me to the correct way of changing it.

Uwe

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

* Re: Finer control over LaTeX export
  2013-12-31 15:02 Finer control over LaTeX export Uwe Ziegenhagen
@ 2013-12-31 16:00 ` Nicolas Goaziou
  2013-12-31 16:38 ` Nick Dokos
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Goaziou @ 2013-12-31 16:00 UTC (permalink / raw)
  To: Uwe Ziegenhagen; +Cc: emacs-orgmode

Hello,

Uwe Ziegenhagen <ziegenhagen@gmail.com> writes:


[...]

> These get exported to 
>
> \#+begin$_{\text{src}}$ python :results output
> print(1+2+3+4+5+6+7+8+9+11)
> \#+end$_{\text{src}}$ python

This is wrong. You ended your block with

  #+end_src python

but it should be

  #+end_src

> The whole verbatim stuff is "okay", I'd like to replace that with the
> listings package, but the 
>
> \#+begin$_{\text{src}}$ python :results output
> print(1+2+3+4+5+6+7+8+9+11)
> \#+end$_{\text{src}}$ python

> requires amsmath just for the \text command, so this is also something I
> want to change. Can anyone point me to the correct way of changing it.

Note that without \text command, you can't get subscript and superscript
to work (see `org-latex-default-packages-alist').


Regards,

-- 
Nicolas Goaziou

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

* Re: Finer control over LaTeX export
  2013-12-31 15:02 Finer control over LaTeX export Uwe Ziegenhagen
  2013-12-31 16:00 ` Nicolas Goaziou
@ 2013-12-31 16:38 ` Nick Dokos
  1 sibling, 0 replies; 3+ messages in thread
From: Nick Dokos @ 2013-12-31 16:38 UTC (permalink / raw)
  To: emacs-orgmode

Uwe Ziegenhagen <ziegenhagen@gmail.com> writes:

> Hi everyone,
>
> I have short parts of Python code in my org file:
>
> #+begin_src python :results value
> def foo(x):
>   if x>0:
>     return x+1
>
>   else:
>     return x-1
>
> return foo(590)
> #+end_src
>
>
> How can I define how Org Mode is exporting these snippets?
>

C-h v org-latex-listings RET

It's apparently nil. Setting it to t should do what you want.

Nick

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

end of thread, other threads:[~2013-12-31 16:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-31 15:02 Finer control over LaTeX export Uwe Ziegenhagen
2013-12-31 16:00 ` Nicolas Goaziou
2013-12-31 16:38 ` Nick Dokos

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).