emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Incorrect references to LaTeX Listings
@ 2018-01-09 10:58 James Harkins
  2018-01-09 12:35 ` Eric S Fraga
  2018-01-09 12:50 ` Nicolas Goaziou
  0 siblings, 2 replies; 4+ messages in thread
From: James Harkins @ 2018-01-09 10:58 UTC (permalink / raw)
  To: emacs-orgmode

I have several org documents containing source code listings, with references such as the following:

```
* Section
#+name: codeblock
#+caption: Hello, world.
#+BEGIN_SRC C
// Hello, world
#+END_SRC

Reference to [[codeblock]].
```

I've been doing this for years, never had any problem.

Today, I get the following sort of LaTeX export (assuming the Listings package):

```
\section{Section}
\label{sec:orgheadline1}
\lstset{language=C,label=codeblock,caption={Hello, world.},captionpos=b,numbers=none}
\begin{lstlisting}
// Hello, world
\end{lstlisting}

Reference to \ref{orgsrcblock1}.
```

Well, there is no label orgsrcblock1, so the exported document shows "??" instead of a listing number.

I checked the manual to see if any of the syntax had changed, but I don't see any. I also tried doing

#+CAPTION:
#+NAME:
#+BEGIN_SRC
...

... but no difference -- I still get the wrong reference in the text.

So, how do I make source block references work the way they used to? Rather critical for me -- this is one of /the/ main reasons why I prefer to write in org and export LaTeX.

org 8.3.3 -- I'm using the packages provided by Ubuntu 16.04. (I realize distro packages are usually behind, but I wouldn't have expected a seriously broken org version to make it into package repositories, especially for a feature whose malfunction would not be tolerated by the technical writers in org's user base. So I suspect there must be some configuration issue, rather than a bug.)

hjh

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

* Re: Incorrect references to LaTeX Listings
  2018-01-09 10:58 Incorrect references to LaTeX Listings James Harkins
@ 2018-01-09 12:35 ` Eric S Fraga
  2018-01-10  9:14   ` James Harkins
  2018-01-09 12:50 ` Nicolas Goaziou
  1 sibling, 1 reply; 4+ messages in thread
From: Eric S Fraga @ 2018-01-09 12:35 UTC (permalink / raw)
  To: James Harkins; +Cc: emacs-orgmode

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

On Tuesday,  9 Jan 2018 at 18:58, James Harkins wrote:
> I have several org documents containing source code listings, with
> references such as the following:

[...]

> Well, there is no label orgsrcblock1, so the exported document shows
> "??" instead of a listing number.

Check org-latex-prefer-user-labels.

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-317-gc82c21

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

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

* Re: Incorrect references to LaTeX Listings
  2018-01-09 10:58 Incorrect references to LaTeX Listings James Harkins
  2018-01-09 12:35 ` Eric S Fraga
@ 2018-01-09 12:50 ` Nicolas Goaziou
  1 sibling, 0 replies; 4+ messages in thread
From: Nicolas Goaziou @ 2018-01-09 12:50 UTC (permalink / raw)
  To: James Harkins; +Cc: emacs-orgmode

Hello,

James Harkins <jamshark70@zoho.com> writes:

> I have several org documents containing source code listings, with references such as the following:
>
> ```
> * Section
>
> #+name: codeblock
> #+caption: Hello, world.
>
> #+BEGIN_SRC C
> // Hello, world
> #+END_SRC
>
> Reference to [[codeblock]].
> ```
>
> I've been doing this for years, never had any problem.
>
> Today, I get the following sort of LaTeX export (assuming the Listings package):
>
> ```
> \section{Section}
> \label{sec:orgheadline1}
> \lstset{language=C,label=codeblock,caption={Hello, world.},captionpos=b,numbers=none}
> \begin{lstlisting}
> // Hello, world
> \end{lstlisting}
>
> Reference to \ref{orgsrcblock1}.
> ```
> Well, there is no label orgsrcblock1, so the exported document shows
> "??" instead of a listing number.

FWIW, I cannot reproduce it on a recent Org.

> So, how do I make source block references work the way they used to?
> Rather critical for me -- this is one of /the/ main reasons why
> I prefer to write in org and export LaTeX.

You could update Org.

> org 8.3.3 -- I'm using the packages provided by Ubuntu 16.04. (I
> realize distro packages are usually behind, but I wouldn't have
> expected a seriously broken org version to make it into package
> repositories, especially for a feature whose malfunction would not be
> tolerated by the technical writers in org's user base. So I suspect
> there must be some configuration issue, rather than a bug.)

I'm also surprised this doesn't work in Org 8.3.3, but my time machine
is being repaired at the moment, so there is nothing I can do about it.
Meanwhile, let me quote the usual licensing stuff, included in every Org
library (caps are not mine):

    ;; GNU Emacs is distributed in the hope that it will be useful,
    ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
    ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ;; GNU General Public License for more details.

Again, I suggest to update Org. Release 8.3.3 is very old.

Regards,

-- 
Nicolas Goaziou

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

* Re: Incorrect references to LaTeX Listings
  2018-01-09 12:35 ` Eric S Fraga
@ 2018-01-10  9:14   ` James Harkins
  0 siblings, 0 replies; 4+ messages in thread
From: James Harkins @ 2018-01-10  9:14 UTC (permalink / raw)
  To: Eric S Fraga, emacs-orgmode

---- On Tue, 09 Jan 2018 20:35:37 +0800 Eric S Fraga <esflists@gmail.com> wrote ---- 
> Check org-latex-prefer-user-labels. 

OK, this works for me, thanks.

FWIW, org-latex-prefer-user-labels eluded me in the documentation. Now that you pointed me to it, I see the reason for the change, but I wouldn't have guessed it on my own.

I'll update org when I can.

In any case, thanks.
hjh

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

end of thread, other threads:[~2018-01-10  9:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-09 10:58 Incorrect references to LaTeX Listings James Harkins
2018-01-09 12:35 ` Eric S Fraga
2018-01-10  9:14   ` James Harkins
2018-01-09 12:50 ` Nicolas Goaziou

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