From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:403:4ea1::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id MALqMxmDyWEXggEAgWs5BA (envelope-from ) for ; Mon, 27 Dec 2021 10:10:49 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id eWzmLRmDyWHt1QAAG6o9tA (envelope-from ) for ; Mon, 27 Dec 2021 10:10:49 +0100 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 6061E2A54F for ; Mon, 27 Dec 2021 10:10:49 +0100 (CET) Received: from localhost ([::1]:45994 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n1m1o-0003KS-Ik for larch@yhetil.org; Mon, 27 Dec 2021 04:10:48 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36786) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n1m0T-0003KI-Cx for emacs-orgmode@gnu.org; Mon, 27 Dec 2021 04:09:25 -0500 Received: from mout01.posteo.de ([185.67.36.65]:42749) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n1m0Q-0002a4-VJ for emacs-orgmode@gnu.org; Mon, 27 Dec 2021 04:09:25 -0500 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 46724240027 for ; Mon, 27 Dec 2021 10:09:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1640596159; bh=//pSgrc6KCH6fOYzGnOO45tKUxUxQtKb5Sm7OUsWhj8=; h=From:To:Cc:Subject:Date:From; b=Gjpf+nQncSMILrE/7+VgfDpMgE3xyzzwneSQv7Y/hVoS6pMhoFbPFga0OMSxjfGpd GRmfrvlSkKbB59NYiYgianBsTG12YmX1eyKAvJONqlz8i4PK/YHJng5+frSwosIc9z UKxcww/m7of1LJoHQ/u6JbxKTK6hGgR2X/gykaD8aTNTTwqMtEISl5owK707aHWLvK EsmnTr8I92zH+xKWPD7tUOVZrmhX1RHzLSpMXFqboictwvQvwphOi4/tBrWCZe+Iwe MAxBohPPywWT6OXWJWkT6gCF0bnVhhu5s1UvvEt3OWiH1586j8PoSOcOdCLEaZ1gI+ 6cNtGDjolvVew== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4JMsL63v6hz6tnV; Mon, 27 Dec 2021 10:09:18 +0100 (CET) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: Seb Subject: Re: caption width in LateX export References: <87lf06q1t9.fsf@phoca.sebkatja.org> <874k6utry0.fsf@posteo.net> Date: Mon, 27 Dec 2021 09:09:16 +0000 In-Reply-To: <874k6utry0.fsf@posteo.net> ("Juan Manuel =?utf-8?Q?Mac=C3=AD?= =?utf-8?Q?as=22's?= message of "Mon, 27 Dec 2021 07:41:59 +0000") Message-ID: <87y246s9c3.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.67.36.65; envelope-from=maciaschain@posteo.net; helo=mout01.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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , Cc: orgmode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1640596249; 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=Z+1T2dezEGEglQ+5O1jLT9w2IIpPTkjIYbX8FkjZG+Y=; b=VtvgaSP2yxcIg0+ftNxerWbL0fUF+YVmUCHkNdow6ibHaNQK2X3cTF0NEJjfVB6E4soi5a 6xk0QrgBE8v+uXN8jWA9xcyQZ0KBQ80+iTJi19CS7qQaqq+7MxtIzCbEyVn38k67PwSpgs nhrwh5spFGvQLBmXWwem5Mi/b38XsvdaZ5EsUdaLhjaghHgQWUESNycNVpxkBUXPEuEizG Bo2cgdvi+1Jpu8Lq/l413sMTPZP2d2DbwQD1OCDvSopaetWNRhde4nsvyBtPv+9KypphoZ m3i3qOHXTUHsQoOpr+o3uGMtBnwpFfX5nia0vbX34rxjgsbAvAIV+YSIMURY4Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1640596249; a=rsa-sha256; cv=none; b=W3ikaJ34lHcBLtJy/ZvqAN+AFAAyNqFnrLWSvNyrgOJJfrd8A6nb34dP/eMRHbplxyxeLE Y2KjZmIs223qf1bj34fJXsUqnJZ4MmgQrGThXl7ShzwpjEwHNlcWK/sSRjuro6SWxTvS5q M3mZFJQq5HpqVl/dW3hlma4+SK8jzELcVEHE2ay7CzHyd2pWQ1OEXr8NiSX4NUgVz9XtBj pGxNtSPVq9ghK5iy77ax+wdpXIqhGnKcRiGFcSeLbzadtWtHSzaZqkMY/JXLHrSJ2OFKyC vEnwXBCjYiUQRcpRXFLZptJSR3UAAeUaQdzciA7ABeuV24XkCdPQuYMQm8zomQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Gjpf+nQn; dmarc=pass (policy=none) header.from=posteo.net; 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" X-Migadu-Spam-Score: -4.47 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Gjpf+nQn; dmarc=pass (policy=none) header.from=posteo.net; 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" X-Migadu-Queue-Id: 6061E2A54F X-Spam-Score: -4.47 X-Migadu-Scanner: scn1.migadu.com X-TUID: qfnGbYUoazc4 P.S.: I have come up with another possibility, more automatic, on the LaTeX side, if you compile with LuaTeX. This thread (https://tex.stackexchange.com/questions/202046/width-of-the-caption-of-a-f= igure), where someone proposes to use a \savebox for concrete images, gave me the idea. We can automate that through a simple function in Lua, and add it to the `process_input_buffer' callback, in order to the caption *always* has the width of each image: You can put this in your Org document: #+NAME: luacode #+begin_src latex :exports none \usepackage{luacode} \begin{luacode*} function caption_width ( text ) text =3D string.gsub ( text, "(\\includegraphics.+)", "\\sbox0{%1}") text =3D string.gsub ( text, "(\\caption{.+})", "\\begin{minipage}{\\wd0}= \\usebox0%1\\end{minipage}") return text end \end{luacode*} \newcommand\CaptionAutoWidth{\directlua{luatexbase.add_to_callback ( "process_input_buffer" , caption_width , "caption_width" )}} \AtBeginDocument{\CaptionAutoWidth} #+end_src #+begin_src latex :noweb yes :results raw ,#+LaTeX_HEADER: <> #+end_src And then: #+CAPTION: Lorem ipsum dolor sit amet, consectetuer adipiscing elit #+ATTR_LaTeX: :width .3\linewidth [[img]] Best regards, Juan Manuel=20 Juan Manuel Mac=C3=ADas writes: > If you use the caption package (https://www.ctan.org/pkg/caption), you > can indicate in each figure the width of the caption. In this case, you > would have to introduce the code using raw latex via the `:caption' > property: > > #+LaTeX_Header: \usepackage{caption} > > #+ATTR_LaTeX: :caption \captionsetup{width=3D.3\linewidth}\caption{Lorem = ipsum dolor sit amet, consectetuer adipiscing elit} > #+ATTR_LaTeX: :width .3\linewidth > [[file_path]]