emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Name of code pieces when exported to PDF
@ 2016-09-26 14:28 claude fuhrer
  2016-09-26 15:34 ` Nicolas Goaziou
  0 siblings, 1 reply; 8+ messages in thread
From: claude fuhrer @ 2016-09-26 14:28 UTC (permalink / raw)
  To: emacs-orgmode

Hello

To explain a small program, I've broken it down into small pieces. My
org file looks something like

# =========================================================================
#+NAME MainClass
#+BEGIN_SRC java :noweb tangle :tangle Test.java
public class Test
{
    <<secondBlock>>
    <<thirdBlock>>
}
#+END_SRC

some text

#+NAME secondBlock
#+BEGIN_SRC java :noweb tangle
     int a, b;
#+END_SRC

and then

#+NAME thirdBlock
#+BEGIN_SRC java :noweb tangle
     a = 17;
     b = a / 2;
#+END_SRC
# =========================================================================

Org-babel-tangle give me exactly what I want.

But, is it possible to have the "NAME" value displayed in the
lstlisting parameters when I export the org document as pdf ? I've
included the following lines in the beginning of my org file

#+LaTeX_HEADER:\lstset{language=Java,
#+LaTeX_HEADER:        numbers=left,
#+LaTeX_HEADER:        basicstyle=\footnotesize\ttfamily,
#+LaTeX_HEADER:        basicstyle=\ttfamily,
#+LaTeX_HEADER:        backgroundcolor=\color{LightYellow},
#+LaTeX_HEADER:        stringstyle=\color{blue},
#+LaTeX_HEADER:        frame=single,
#+LaTeX_HEADER:        columns=fullflexible,
#+LaTeX_HEADER:        numberstyle=\scriptsize\color{red},
#+LaTeX_HEADER:        commentstyle=\color{ForestGreen}}

The package listing provides a "title" or "caption" keyword, but I do
not know how to pass the "NAME" argument. Can you please help me or
give me a pointer ? Thank you in advance for your help.

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

* Re: Name of code pieces when exported to PDF
  2016-09-26 14:28 Name of code pieces when exported to PDF claude fuhrer
@ 2016-09-26 15:34 ` Nicolas Goaziou
  2016-09-26 16:48   ` claude fuhrer
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2016-09-26 15:34 UTC (permalink / raw)
  To: claude fuhrer; +Cc: emacs-orgmode

Hello,

claude fuhrer <claude@fuhrer.ch> writes:

> To explain a small program, I've broken it down into small pieces. My
> org file looks something like
>
> # =========================================================================
> #+NAME MainClass
>
> #+BEGIN_SRC java :noweb tangle :tangle Test.java
> public class Test
> {
>     <<secondBlock>>
>     <<thirdBlock>>
> }
> #+END_SRC

It should be

  #+name: MainClass
  #+begin_src ...

i.e, with dots and no blank line in-between.

Regards,

-- 
Nicolas Goaziou

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

* Re: Name of code pieces when exported to PDF
  2016-09-26 15:34 ` Nicolas Goaziou
@ 2016-09-26 16:48   ` claude fuhrer
  2016-09-26 18:13     ` Sebastian Christ
  0 siblings, 1 reply; 8+ messages in thread
From: claude fuhrer @ 2016-09-26 16:48 UTC (permalink / raw)
  To: emacs-orgmode

Hi Nicolas


On 26/09/16 17:34, Nicolas Goaziou wrote:
> Hello,
>
> claude fuhrer <claude@fuhrer.ch> writes:
>
>> [...]
> It should be
>
>    #+name: MainClass
>    #+begin_src ...
>
> i.e, with dots and no blank line in-between.

Thank you for your quick answer, but I do not really understand how to 
use it. I've corrected the syntax as you mentioned and shows what is the 
generated latex code. The export process gives then:



\lstset{language=java,label=secondBlock,caption= ,captionpos=b,numbers=none}
\begin{lstlisting}
.....
\end{lstlisting}

But I wanted to have the "caption" filled with the same value as the 
label. Is it possible ?

Thank you once again for your help.

regards
claude


>
> Regards,
>

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

* Re: Name of code pieces when exported to PDF
  2016-09-26 16:48   ` claude fuhrer
@ 2016-09-26 18:13     ` Sebastian Christ
  2016-09-26 21:32       ` Nick Dokos
  0 siblings, 1 reply; 8+ messages in thread
From: Sebastian Christ @ 2016-09-26 18:13 UTC (permalink / raw)
  To: emacs-orgmode

On 2016-09-26 18:48, claude fuhrer <claude@fuhrer.ch> wrote:
 > \lstset{language=java,label=secondBlock,caption= ,captionpos=b,numbers=none}
 > \begin{lstlisting}
 > .....
 > \end{lstlisting}
 > 
 > But I wanted to have the "caption" filled with the same value as the
 > label. Is it possible ?
 > 
Yes, use caption!

#+caption: MainClass
#+name: MainClass
#+begin_src ...

Regards,
Sebastian 
-- 
Sebastian (Rudolfo) Christ
http://rudolfochrist.github.io
GPG Fingerprint: 306D 8FD3 DFB6 4E44 5061
                 CE71 6407 D6F8 2AC5 55DD

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

* Re: Name of code pieces when exported to PDF
  2016-09-26 18:13     ` Sebastian Christ
@ 2016-09-26 21:32       ` Nick Dokos
  2016-09-26 21:43         ` John Kitchin
  2016-09-27 11:11         ` Sebastian Christ
  0 siblings, 2 replies; 8+ messages in thread
From: Nick Dokos @ 2016-09-26 21:32 UTC (permalink / raw)
  To: emacs-orgmode

Sebastian Christ <rudolfo.christ@gmail.com> writes:

> On 2016-09-26 18:48, claude fuhrer <claude@fuhrer.ch> wrote:
>  > \lstset{language=java,label=secondBlock,caption= ,captionpos=b,numbers=none}
>  > \begin{lstlisting}
>  > .....
>  > \end{lstlisting}
>  > 
>  > But I wanted to have the "caption" filled with the same value as the
>  > label. Is it possible ?
>  > 
> Yes, use caption!
>
> #+caption: MainClass
> #+name: MainClass
>
> #+begin_src ...
>

That seems indeed to be necessary (at least in a few experiments that
I've run), but it's less than ideal (duplication of information).

I was under the impression that #+CAPTION is deprecated and #+NAME is
to be used in its place going forward. If that's the case, then the
listings problem needs fixing.  If not, can somebody summarize the
actual situation?

Thanks!
-- 
Nick

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

* Name of code pieces when exported to PDF
  2016-09-26 21:32       ` Nick Dokos
@ 2016-09-26 21:43         ` John Kitchin
  2016-09-27  0:17           ` Nick Dokos
  2016-09-27 11:11         ` Sebastian Christ
  1 sibling, 1 reply; 8+ messages in thread
From: John Kitchin @ 2016-09-26 21:43 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode@gnu.org

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

It is #+label that is deprecated in favor of #+name.

On Monday, September 26, 2016, Nick Dokos <ndokos@gmail.com
<javascript:_e(%7B%7D,'cvml','ndokos@gmail.com');>> wrote:

> Sebastian Christ <rudolfo.christ@gmail.com> writes:
>
> > On 2016-09-26 18:48, claude fuhrer <claude@fuhrer.ch> wrote:
> >  > \lstset{language=java,label=secondBlock,caption=
> ,captionpos=b,numbers=none}
> >  > \begin{lstlisting}
> >  > .....
> >  > \end{lstlisting}
> >  >
> >  > But I wanted to have the "caption" filled with the same value as the
> >  > label. Is it possible ?
> >  >
> > Yes, use caption!
> >
> > #+caption: MainClass
> > #+name: MainClass
> >
> > #+begin_src ...
> >
>
> That seems indeed to be necessary (at least in a few experiments that
> I've run), but it's less than ideal (duplication of information).
>
> I was under the impression that #+CAPTION is deprecated and #+NAME is
> to be used in its place going forward. If that's the case, then the
> listings problem needs fixing.  If not, can somebody summarize the
> actual situation?
>
> Thanks!
> --
> Nick
>
>
>

-- 
John

-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

[-- Attachment #2: Type: text/html, Size: 1901 bytes --]

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

* Re: Name of code pieces when exported to PDF
  2016-09-26 21:43         ` John Kitchin
@ 2016-09-27  0:17           ` Nick Dokos
  0 siblings, 0 replies; 8+ messages in thread
From: Nick Dokos @ 2016-09-27  0:17 UTC (permalink / raw)
  To: emacs-orgmode

John Kitchin <jkitchin@andrew.cmu.edu> writes:

> It is #+label that is deprecated in favor of #+name. 
>

Ah, thanks!

> On Monday, September 26, 2016, Nick Dokos <ndokos@gmail.com> wrote:
>
>     ...   
>     I was under the impression that #+CAPTION is deprecated and #+NAME is
>     to be used in its place going forward. If that's the case, then the
>     listings problem needs fixing.  If not, can somebody summarize the
>     actual situation?
>    

-- 
Nick

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

* Re: Name of code pieces when exported to PDF
  2016-09-26 21:32       ` Nick Dokos
  2016-09-26 21:43         ` John Kitchin
@ 2016-09-27 11:11         ` Sebastian Christ
  1 sibling, 0 replies; 8+ messages in thread
From: Sebastian Christ @ 2016-09-27 11:11 UTC (permalink / raw)
  To: emacs-orgmode

On 2016-09-26 17:32, Nick Dokos <ndokos@gmail.com> wrote:
 >> #+caption: MainClass
 >> #+name: MainClass
 >> 
 >> #+begin_src ...
 > That seems indeed to be necessary (at least in a few experiments that
 > I've run), but it's less than ideal (duplication of information).

In this peculiar case, yes. But, at least for me, I use each for a
different purpose that doesn't duplicate the information. I'm using
org-ref for references and most of the time a more meaningful
caption. For example:

#+caption: A class with a main method
#+name: lst-main
#+begin_src java

Regards,

Sebastian

-- 
Sebastian (Rudolfo) Christ
http://rudolfochrist.github.io
GPG Fingerprint: 306D 8FD3 DFB6 4E44 5061
                 CE71 6407 D6F8 2AC5 55DD

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

end of thread, other threads:[~2016-09-27 11:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-26 14:28 Name of code pieces when exported to PDF claude fuhrer
2016-09-26 15:34 ` Nicolas Goaziou
2016-09-26 16:48   ` claude fuhrer
2016-09-26 18:13     ` Sebastian Christ
2016-09-26 21:32       ` Nick Dokos
2016-09-26 21:43         ` John Kitchin
2016-09-27  0:17           ` Nick Dokos
2016-09-27 11:11         ` Sebastian Christ

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