From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id cCBHKPSRs2UvfwEA62LTzQ:P1 (envelope-from ) for ; Fri, 26 Jan 2024 12:05:24 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id cCBHKPSRs2UvfwEA62LTzQ (envelope-from ) for ; Fri, 26 Jan 2024 12:05:24 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=kxblwamC; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1706267124; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=OBuTxFRMFr4xOniCsH6PpNpWK8gCgKY/h7ohdGbuXqU=; b=LUo43DueLlehtu18eKli7mbVKN3Ubk+sLKHAR7RRp7Z94oUsMGkAR8BFEcBIKkisk9lrxq uGUqne20CuPF25GuicBITf252/4zAV4fXJVopP9wKpqCIbRmhDqiAyJHV0GOI/hIiR4hd6 s1KUFCCbat7IuK0Fa1eeu+VI+QiJtslk3imkyM7DsoAl3LzUiaYKm4zAhoBs1BWj3tYBzz MHs5jTzLjn0eoBsZTKOvWD2shtR+60r2RS5Ul/pQ3+sjWtVK/WCJ3L6WAGwfbMxYGZhcBu Cq3CRl+XEPGvpsaH2/DB1hkXeQP+ZsVsPvvomUeqTEn9kYrc+wNGpFk+pXgaGQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=kxblwamC; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1706267124; a=rsa-sha256; cv=none; b=ghO+EWq7ThoCBlpm4dLagTO/jgxcknx+1T6Uf84QCqt+TkL4xweZwXGcx9vuOUCENf9REt UMrZbSdxxbROgvCOU/1QeB8jzvNurZSF1CWvvf9ZuUQxW4lCVrfE+p5IYLJbRciflexsn9 T5BmjI6uKWjHYgS4AP/RR6ywUgU+9T16LvaZnnb5mYjElWMfQdQ8pawt18gljyivLMgM9A d2n3VcmUrQgVp4pJBWCsNShkevCBqZ1NsLTIwuJPdX+8w5RWnsSmatINdoorPJDgYKEidb AEAObfco0Y2VHDYrUyQr2wy8z1FMJH7pTLyWoDCfwxfHrivcF7sCmNLg47234g== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 622A146655 for ; Fri, 26 Jan 2024 12:05:24 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rTK0k-0000zu-Uz; Fri, 26 Jan 2024 06:04:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rTK0g-0000mO-QL for emacs-orgmode@gnu.org; Fri, 26 Jan 2024 06:04:36 -0500 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rTK0c-0001Cp-Se for emacs-orgmode@gnu.org; Fri, 26 Jan 2024 06:04:33 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 39A3A240101 for ; Fri, 26 Jan 2024 12:04:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1706267066; bh=QRxlQ1YZklkGokYO8LCVvdpfSTHD+n0cUQL6VnCHgkk=; h=MIME-Version:Content-Type:Content-Transfer-Encoding:Date:From:To: Cc:Subject:Message-ID:From; b=kxblwamC0qmMnglvD1A+NDeZWGHAPfh+7mApvs7c96jfMeeZC9P3noDn2B/m0KcKO 9GHETltfbkdC/Rd1qWzetYLBjlyEbGMsCAdbb/Q13xLf/g/vYlxNq7WdlUUEpXhXnL 1Hm73iRNa3P7lqlDiOeSUqzQncxsne2HqSS4BWi8cSppPwgpRQqEc2Pzw2dXmaTaiR 63GzF7fHGKoUaWG8MpQOE5EswowtOJ0sKs0e1GjeagyLRf2vVYDWhdIs8+uuosDXTm 8au+m7s8aB330yrlEphAEri3ZjsPpDTgJfddErgemj5QSqozCGXMMAQWM8wbP+pXQi 8yVmafrDBiRVA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TLvw91T5fz9rxD; Fri, 26 Jan 2024 12:04:25 +0100 (CET) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 26 Jan 2024 11:04:25 +0000 From: gerard.vermeulen@posteo.net To: Ihor Radchenko Cc: =?UTF-8?Q?Juan_Manuel_Mac=C3=ADas?= , Pedro Andres Aranda Gutierrez , Timothy , Emacs orgmode Subject: Re: [BUG] ox-latex produces broken references to src code listings without caption (was: [BUG] org-lint tells to move #+name to wrong place in results block) In-Reply-To: <87r0i5lh4r.fsf@localhost> References: <60f395fcacacdc6a7d9de3cd7a00032b@posteo.net> <875xzls08s.fsf@localhost> <429d681f72b1b13d81f24836017929d7@posteo.net> <8734upry70.fsf@localhost> <7bf1f79071a714750634e76130fe5963@posteo.net> <87r0i5lh4r.fsf@localhost> Message-ID: <1516db648e4c36ce803c8388b70ea0d3@posteo.net> Received-SPF: pass client-ip=185.67.36.66; envelope-from=gerard.vermeulen@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -5.88 X-Migadu-Queue-Id: 622A146655 X-Spam-Score: -5.88 X-Migadu-Scanner: mx11.migadu.com X-TUID: 7HTe/EL5YYhu On 25.01.2024 13:41, Ihor Radchenko wrote: > gerard.vermeulen@posteo.net writes: > >> I have found that CAPTION keywords in the "name-result-example" in >> the >> manual are essential to produce correct links. > > It should not be essential. What you demonstrated is two bugs in Org > mode. > >> In case the relevant blocks have e.g. ":exports both", Org handles >> this, but: >> 1. HTML export requires captions to produce links with unequivocal >> "link texts" which are numbers in the HTML output. > > Fixed, on main. > https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=ea529007d I confirm that it is fixed. > >> 2. LaTeX export requires captions to produce captions with labels like >> =\caption{\label{path}desc}=. > > `org-latex-link' assumes that it is safe to use > \ref{} in order to refer to an existing src > block. > However, it is not true. > > `org-latex-src-block--engraved', `org-latex-src-block--minted', > and `org-latex-src-block--listings' only produce a label when src block > has a caption. > > We should generally not need to put a caption in order to refer to a > source block listing. At least, it does not look like we need it from > https://tex.stackexchange.com/questions/438260/referencing-without-captions-appearing-but-keeping-numbering > > Thoughts? Ideas? I do not see how to put the LaTeX hypertarget inside listings where it is needed, because those listings are not floating. I looked at `org-latex-src-block--verbatim' that uses the LaTeX captionof macro, by exporting --- begin narrow lines below --- #+caption: caption or comment #+name: name #+begin_src emacs-lisp (+ 1 2) #+end_src Link \ref{name}. --- end narrow lines above But, I cannot get the captionof macro working after: exporting the snippet above using `org-latex-src-block--listings' without caption and adding the captionof macro by hand (LuaLaTeX does not compile). > >> Tested on example below: >> Produced by listing [[IN]]. >> >> #+name: OUT >> #+RESULTS: IN >> #+begin_src emacs-lisp :exports code >> 6 >> #+end_src >> >> #+header: :wrap "src emacs-lisp :exports code" >> #+name: IN >> #+begin_src emacs-lisp :exports both >> 6 >> #+end_src >> >> Listing [[IN]] produces listing [[OUT]]. >> >> From inspecting HTML or LaTeX output using this example >> for the difference between with and without captions it is >> easy to see that only with captions the output is correct. Regards -- Gerard