emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* latex export of source code in lists
@ 2010-12-09  9:38 Andreas Leha
  2010-12-09 17:25 ` Thomas S. Dye
  2010-12-09 20:36 ` Nicolas Goaziou
  0 siblings, 2 replies; 6+ messages in thread
From: Andreas Leha @ 2010-12-09  9:38 UTC (permalink / raw)
  To: emacs-orgmode


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

Hi all,

(how) can I have source code block in lists not breaking the latex
exported list?

Example:
* Test
  1) this is the first item
     #+srcname: code
     #+begin_src R :tangle no :export code
       print("some code")
     #+end_src
     which has some code

  2) this is the second item

This results in
  \section{Test}
  \label{sec-1}
 
  \begin{enumerate}
  \item this is the first item
  \end{enumerate}

  \lstset{language=R}
  \begin{lstlisting}
  print("some code")
  \end{lstlisting}
       which has some code

  \begin{enumerate}
  \item this is the second item
  \end{enumerate}

While I expect this:
  \section{Test}
  \label{sec-1}
 
  \begin{enumerate}
  \item this is the first item
    \lstset{language=R}
    \begin{lstlisting}
    print("some code")
    \end{lstlisting}
     which has some code

  \item this is the second item
  \end{enumerate}

Thanks,
Andreas




[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 6432 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: latex export of source code in lists
  2010-12-09  9:38 latex export of source code in lists Andreas Leha
@ 2010-12-09 17:25 ` Thomas S. Dye
  2010-12-09 17:47   ` Andreas Leha
  2010-12-09 20:36 ` Nicolas Goaziou
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas S. Dye @ 2010-12-09 17:25 UTC (permalink / raw)
  To: Andreas Leha; +Cc: emacs-orgmode

Hi Andreas,

In my experience, lists are a bit fragile this way (probably  
necessarily).  One workaround might be to float the source code block  
(in the way I mentioned in a previous message) and then cross  
reference it from the list.

* Test
   1) this is the first item (Listing \ref{fig:first-code})
   2) this is the second item (Listing \ref{fig:second-code})

But this might not be what you're after.

All the best,
Tom

On Dec 8, 2010, at 11:38 PM, Andreas Leha wrote:

> Hi all,
>
> (how) can I have source code block in lists not breaking the latex
> exported list?
>
> Example:
> * Test
>  1) this is the first item
>     #+srcname: code
>     #+begin_src R :tangle no :export code
>       print("some code")
>     #+end_src
>     which has some code
>
>  2) this is the second item
>
> This results in
>  \section{Test}
>  \label{sec-1}
>
>  \begin{enumerate}
>  \item this is the first item
>  \end{enumerate}
>
>  \lstset{language=R}
>  \begin{lstlisting}
>  print("some code")
>  \end{lstlisting}
>       which has some code
>
>  \begin{enumerate}
>  \item this is the second item
>  \end{enumerate}
>
> While I expect this:
>  \section{Test}
>  \label{sec-1}
>
>  \begin{enumerate}
>  \item this is the first item
>    \lstset{language=R}
>    \begin{lstlisting}
>    print("some code")
>    \end{lstlisting}
>     which has some code
>
>  \item this is the second item
>  \end{enumerate}
>
> Thanks,
> Andreas
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: latex export of source code in lists
  2010-12-09 17:25 ` Thomas S. Dye
@ 2010-12-09 17:47   ` Andreas Leha
  2010-12-10  1:29     ` Thomas S. Dye
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Leha @ 2010-12-09 17:47 UTC (permalink / raw)
  To: emacs-orgmode


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

Hi Tom,

thanks for all your input!  This is great.

Using a float environment around my listings is an option I have not
considered yet, as I have a lot of code snippets in the one file, which
would result in several pages of floating listings.  But I'll use that
option anyway or do completely without lists then.

Thanks again,
Andreas



Am 09.12.2010 18:25, schrieb Thomas S. Dye:
> Hi Andreas,
>
> In my experience, lists are a bit fragile this way (probably
> necessarily).  One workaround might be to float the source code block
> (in the way I mentioned in a previous message) and then cross
> reference it from the list.
>
> * Test
>   1) this is the first item (Listing \ref{fig:first-code})
>   2) this is the second item (Listing \ref{fig:second-code})
>
> But this might not be what you're after.
>
> All the best,
> Tom
>
> On Dec 8, 2010, at 11:38 PM, Andreas Leha wrote:
>
>> Hi all,
>>
>> (how) can I have source code block in lists not breaking the latex
>> exported list?
>>
>> Example:
>> * Test
>>  1) this is the first item
>>     #+srcname: code
>>     #+begin_src R :tangle no :export code
>>       print("some code")
>>     #+end_src
>>     which has some code
>>
>>  2) this is the second item
>>
>> This results in
>>  \section{Test}
>>  \label{sec-1}
>>
>>  \begin{enumerate}
>>  \item this is the first item
>>  \end{enumerate}
>>
>>  \lstset{language=R}
>>  \begin{lstlisting}
>>  print("some code")
>>  \end{lstlisting}
>>       which has some code
>>
>>  \begin{enumerate}
>>  \item this is the second item
>>  \end{enumerate}
>>
>> While I expect this:
>>  \section{Test}
>>  \label{sec-1}
>>
>>  \begin{enumerate}
>>  \item this is the first item
>>    \lstset{language=R}
>>    \begin{lstlisting}
>>    print("some code")
>>    \end{lstlisting}
>>     which has some code
>>
>>  \item this is the second item
>>  \end{enumerate}
>>
>> Thanks,
>> Andreas
>>
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>

-- 
Andreas Leha

Universitätsmedizin Göttingen
Abteilung Medizinische Statistik
Humboldtallee 32
37073 Göttingen

Tel: +49 (0)551 39-10710
Fax: +49 (0)551 39-4995

http://www.ams.med.uni-goettingen.de/amsneu/leha.html



University Medical Center Göttingen
Department for Medical Statistics
Humboldtallee 32
37073 Göttingen
Germany

Phone: +49 (0) 551 39-10710
Fax: +49 (0) 551 39-4995

http://www.ams.med.uni-goettingen.de/amsneu/leha-en.html



[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 6432 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: latex export of source code in lists
  2010-12-09  9:38 latex export of source code in lists Andreas Leha
  2010-12-09 17:25 ` Thomas S. Dye
@ 2010-12-09 20:36 ` Nicolas Goaziou
  2010-12-10 17:01   ` Andreas Leha
  1 sibling, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2010-12-09 20:36 UTC (permalink / raw)
  To: Andreas Leha; +Cc: emacs-orgmode

Hello,

>>>>> Andreas Leha writes:

> Hi all, (how) can I have source code block in lists not breaking the
> latex exported list?

It should be fixed on git head.

Regards,

-- Nicolas

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

* Re: latex export of source code in lists
  2010-12-09 17:47   ` Andreas Leha
@ 2010-12-10  1:29     ` Thomas S. Dye
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas S. Dye @ 2010-12-10  1:29 UTC (permalink / raw)
  To: Andreas Leha; +Cc: emacs-orgmode

Aloha Andreas,

I gather Nicolas Goaziou has worked some magic so that your example  
works with lists now.

I had problems using the listings package in situations where LaTeX  
changes \linewidth, as it can do inside lists.  I got bad line breaks  
and wasn't able to make them good.  If listings works for you in this  
kind of environment, please let me know how you got it to work.

All the best,
Tom

On Dec 9, 2010, at 7:47 AM, Andreas Leha wrote:

> Hi Tom,
>
> thanks for all your input!  This is great.
>
> Using a float environment around my listings is an option I have not
> considered yet, as I have a lot of code snippets in the one file,  
> which
> would result in several pages of floating listings.  But I'll use that
> option anyway or do completely without lists then.
>
> Thanks again,
> Andreas
>
>
>
> Am 09.12.2010 18:25, schrieb Thomas S. Dye:
>> Hi Andreas,
>>
>> In my experience, lists are a bit fragile this way (probably
>> necessarily).  One workaround might be to float the source code block
>> (in the way I mentioned in a previous message) and then cross
>> reference it from the list.
>>
>> * Test
>>  1) this is the first item (Listing \ref{fig:first-code})
>>  2) this is the second item (Listing \ref{fig:second-code})
>>
>> But this might not be what you're after.
>>
>> All the best,
>> Tom
>>
>> On Dec 8, 2010, at 11:38 PM, Andreas Leha wrote:
>>
>>> Hi all,
>>>
>>> (how) can I have source code block in lists not breaking the latex
>>> exported list?
>>>
>>> Example:
>>> * Test
>>> 1) this is the first item
>>>    #+srcname: code
>>>    #+begin_src R :tangle no :export code
>>>      print("some code")
>>>    #+end_src
>>>    which has some code
>>>
>>> 2) this is the second item
>>>
>>> This results in
>>> \section{Test}
>>> \label{sec-1}
>>>
>>> \begin{enumerate}
>>> \item this is the first item
>>> \end{enumerate}
>>>
>>> \lstset{language=R}
>>> \begin{lstlisting}
>>> print("some code")
>>> \end{lstlisting}
>>>      which has some code
>>>
>>> \begin{enumerate}
>>> \item this is the second item
>>> \end{enumerate}
>>>
>>> While I expect this:
>>> \section{Test}
>>> \label{sec-1}
>>>
>>> \begin{enumerate}
>>> \item this is the first item
>>>   \lstset{language=R}
>>>   \begin{lstlisting}
>>>   print("some code")
>>>   \end{lstlisting}
>>>    which has some code
>>>
>>> \item this is the second item
>>> \end{enumerate}
>>>
>>> Thanks,
>>> Andreas
>>>
>>>
>>>
>>> _______________________________________________
>>> Emacs-orgmode mailing list
>>> Please use `Reply All' to send replies to the list.
>>> Emacs-orgmode@gnu.org
>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>
>
> -- 
> Andreas Leha
>
> Universitätsmedizin Göttingen
> Abteilung Medizinische Statistik
> Humboldtallee 32
> 37073 Göttingen
>
> Tel: +49 (0)551 39-10710
> Fax: +49 (0)551 39-4995
>
> http://www.ams.med.uni-goettingen.de/amsneu/leha.html
>
>
>
> University Medical Center Göttingen
> Department for Medical Statistics
> Humboldtallee 32
> 37073 Göttingen
> Germany
>
> Phone: +49 (0) 551 39-10710
> Fax: +49 (0) 551 39-4995
>
> http://www.ams.med.uni-goettingen.de/amsneu/leha-en.html
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: latex export of source code in lists
  2010-12-09 20:36 ` Nicolas Goaziou
@ 2010-12-10 17:01   ` Andreas Leha
  0 siblings, 0 replies; 6+ messages in thread
From: Andreas Leha @ 2010-12-10 17:01 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1.1: Type: text/plain, Size: 618 bytes --]

Hello Nicolas,

I can confirm that this is fixed now.  Thanks a lot!

Greetings,
Andreas

Am 09.12.2010 21:36, schrieb Nicolas Goaziou:
> Hello,
>
>   
>>>>>> Andreas Leha writes:
>>>>>>             
>   
>> Hi all, (how) can I have source code block in lists not breaking the
>> latex exported list?
>>     
> It should be fixed on git head.
>
> Regards,
>
> -- Nicolas
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>   

[-- Attachment #1.1.2: andreas_leha.vcf --]
[-- Type: text/x-vcard, Size: 377 bytes --]

begin:vcard
fn:Andreas Leha
n:Leha;Andreas
org;quoted-printable:University Medicine G=C3=B6ttingen;Biostatistics/Bioinformatics (Dept. Medical Statistics)
adr;quoted-printable:;;Humboldallee 32;G=C3=B6ttingen;;37073;Germany
email;internet:andreas.leha@med.uni-goettingen.de
title:Dipl. Inf.
tel;work:+49 551 39-10710
tel;cell:+49 163 7662824
version:2.1
end:vcard


[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 6432 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

end of thread, other threads:[~2010-12-10 17:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-09  9:38 latex export of source code in lists Andreas Leha
2010-12-09 17:25 ` Thomas S. Dye
2010-12-09 17:47   ` Andreas Leha
2010-12-10  1:29     ` Thomas S. Dye
2010-12-09 20:36 ` Nicolas Goaziou
2010-12-10 17:01   ` Andreas Leha

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