From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id uIxpH6c8w2JEFAEAbAwnHQ (envelope-from ) for ; Mon, 04 Jul 2022 21:16:55 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id mAGOHqc8w2KUFgEAG6o9tA (envelope-from ) for ; Mon, 04 Jul 2022 21:16:55 +0200 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 B095BE240 for ; Mon, 4 Jul 2022 21:16:54 +0200 (CEST) Received: from localhost ([::1]:59506 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8RYz-0008AP-Sx for larch@yhetil.org; Mon, 04 Jul 2022 15:16:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40630) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8RYA-000865-45 for emacs-orgmode@gnu.org; Mon, 04 Jul 2022 15:16:02 -0400 Received: from w4.tutanota.de ([81.3.6.165]:60826) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8RY7-0003Uj-2L for emacs-orgmode@gnu.org; Mon, 04 Jul 2022 15:16:01 -0400 Received: from w3.tutanota.de (unknown [192.168.1.164]) by w4.tutanota.de (Postfix) with ESMTP id 8ED681060164 for ; Mon, 4 Jul 2022 19:15:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1656962155; s=s1; d=vergauwen.me; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:Sender; bh=2DJcZKUKqK+kX2atRqy/MmhuaA137rXxie9pgmFUSUw=; b=ChcodIgD+7FvILIO9hJHa1gV58frHPppWqfVyH0n154sWWQ3pLDtK+pkOEdZZN6m tsFhZjCP5kjWciCJVYNfYs6Uzb2KiZRbpljddQhx8lmQ40iaqcPE5d7VmfpvL0Acp/K NNs+9JTex5voKjWF9boGc+giO1pPh1Vlpy9lwjdFzyfRsVxSe6mJoZyFu4v88YmhiwF XQa+NtZllXd+/Rk8n9Fn3q5tuXdN36AC8YdYsj5Ct48fZZxBFo21CpFnI9R9O39Z/UU UJJqb/kGCEi0iSJmZF/p68jbx5xQo3VDVyYLXiMjEOlrM61zVBJ/WOmEI9jI+Lg9F2m 8iHe80PY/Q== Date: Mon, 4 Jul 2022 21:15:55 +0200 (CEST) To: Emacs Orgmode Message-ID: Subject: [PATCH] ob-latex: Added support for including files with a relative path MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_1153940_1071979246.1656962155214" Received-SPF: pass client-ip=81.3.6.165; envelope-from=emacs@vergauwen.me; helo=w4.tutanota.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-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" Reply-to: emacs@vergauwen.me From: emacs--- via "General discussions about Org-mode." X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1656962215; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=2DJcZKUKqK+kX2atRqy/MmhuaA137rXxie9pgmFUSUw=; b=lszMPbcJUnB5qdsThogH1ooN58M0eEGwA3KYTNwGsF99OgU/FXV//4bi/pNfisVDaZ0/lG YOFKHi9qnA03tKqm42KuyqxU4bjUmrMA4geG9arlqs+B+SRbbAPvjiLvwBJo4V7/47HnOU AO/zt2x7F+ZVVgYCPjNGNh4QJ0FL13XoCQm8154+nqALoJFTC/ZPyzLzmnTW1MPLEMBQ/o UMxvKADvtdCaXFghyi1UTrXBziaOUc2embTUQFfhZpuS5N3g5rRoVgw4cKdcr2pfqbQR44 olb/LD2FIkIOxhn4mipCQJolfZbHBFOZyItuhJcjYiuu8FnbZowC8ET5zZQgLw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1656962215; a=rsa-sha256; cv=none; b=YAVVqgcqdB1hAPpY/N4jk6hIyrD2WdUa1Gm/hySjVNFcK/ogCvqukNUt4JoasvG9AIDjTy 92WEgmOJz3qIPlvxiGMDrKr0va9DJj8FJeGfiTIF7/0XaTKlBvgziq7J7DTESFtcZf+p3X mGGJslsR6T+7cqLvUbKMuSHqJEoVnSkzaXFbWMOAD9Q6Au3uZKh4IQ6CkUAlR9qz+Y4buY YInZ6MoY1cxyqZE1dQ7/+Z3dRuF6oUUUSN1oWvg6kdBSrDt5BSN+vQ9l7tK2taEK8WKEH8 idnScNN8/rMUbLg2lp/uUiIDXvbdVZP6UcUtzdt7nLpxru117ZGO8hwMIBVB8Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=vergauwen.me header.s=s1 header.b=ChcodIgD; dmarc=pass (policy=none) header.from=gnu.org; 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.55 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=vergauwen.me header.s=s1 header.b=ChcodIgD; dmarc=pass (policy=none) header.from=gnu.org; 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: B095BE240 X-Spam-Score: -4.55 X-Migadu-Scanner: scn0.migadu.com X-TUID: qYH0QeSCUU6+ ------=_Part_1153940_1071979246.1656962155214 Content-Type: multipart/alternative; boundary="----=_Part_1153941_353069195.1656962155214" ------=_Part_1153941_353069195.1656962155214 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Dear list,=C2=A0 in the attachment you find a proposed patch to support including external f= iles when exporting a latex source block. Currently this was only possible by us= ing a :header argument. The problem with this approach is that, files needed to b= e included with their absolute path. My proposed change adds support for a :inputs header argument, which expand= s te provided file paths to an absolute path before including them. Example:=C2=A0 #+HEADER: :file example.pdf #+HEADER: :inputs '("./input/preamble.tex") #+BEGIN_src latex \begin{tikzpicture} =C2=A0 \draw[->,custom-style] (-3,0) -- (-2,0) =C2=A0=C2=A0=C2=A0 arc[radius=3D0.5cm,start angle=3D-180,endangle=3D0] (-1,= 0) -- (1,0) =C2=A0=C2=A0=C2=A0 arc[radius=3D0.5cm,start angle=3D180,end angle=3D0] (2,0= ) -- (3,0); =C2=A0=C2=A0=C2=A0 \filldraw (-1.5,0) circle[radius=3D1mm]; =C2=A0=C2=A0=C2=A0 \filldraw (1.5,0)circle[radius=3D1mm]; \end{tikzpicture} #+END_src Expands to=C2=A0 \documentclass[article]... \input{absolute/path/to/input/preamble.tex} \begin{document} \begin{tikzpicture} =C2=A0 \draw[->,custom-style] (-3,0) -- (-2,0) =C2=A0=C2=A0=C2=A0 arc[radius=3D0.5cm,start angle=3D-180,endangle=3D0] (-1,= 0) -- (1,0) =C2=A0=C2=A0=C2=A0 arc[radius=3D0.5cm,start angle=3D180,end angle=3D0] (2,0= ) -- (3,0); =C2=A0=C2=A0=C2=A0 \filldraw (-1.5,0) circle[radius=3D1mm]; =C2=A0=C2=A0=C2=A0 \filldraw (1.5,0)circle[radius=3D1mm]; \end{tikzpicture} \end{document} Kind regards, Bob=C2=A0 ------=_Part_1153941_353069195.1656962155214 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Dear list, 

in the attachment you find a proposed patch to support including externa= l files
when exporting a latex source block. Cur= rently this was only possible by using a
:header= argument. The problem with this approach is that, files needed to be
included with their absolute path.


My propos= ed change adds support for a :inputs header argument, which expands te
<= /div>
provided file paths to an absolute path before inclu= ding them.


Example: 
#+HEADE= R: :file example.pdf
#+HEADER: :inputs '("./i= nput/preamble.tex")
#+BEGIN_src latex
\begin{tikzpicture}
  = \draw[->,custom-style] (-3,0) -- (-2,0)
 = ;   arc[radius=3D0.5cm,start angle=3D-180,endangle=3D0] (-1,0) --= (1,0)
    arc[radius=3D0.5cm,sta= rt angle=3D180,end angle=3D0] (2,0) -- (3,0);
&n= bsp;   \filldraw (-1.5,0) circle[radius=3D1mm];
    \filldraw (1.5,0)circle[radius=3D1mm];
\end{tikzpicture}
#+END_src<= br>

Expands to 
=

\documentclass[article]=
...
\input{absolute/p= ath/to/input/preamble.tex}
\begin{document}<= br>
\begin{tikzpicture}
&= nbsp; \draw[->,custom-style] (-3,0) -- (-2,0)
    arc[radius=3D0.5cm,start angle=3D-180,endangle=3D0] (-1= ,0) -- (1,0)
    arc[radius=3D0.5= cm,start angle=3D180,end angle=3D0] (2,0) -- (3,0);
    \filldraw (-1.5,0) circle[radius=3D1mm];
    \filldraw (1.5,0)circle[radius=3D1mm];
\end{tikzpicture}
\end= {document}

Kind regards,=
Bob 
------=_Part_1153941_353069195.1656962155214-- ------=_Part_1153940_1071979246.1656962155214 Content-Type: application/octet-stream; name=0001-lisp-ob-latex.el-Added-latex-inputs.patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-lisp-ob-latex.el-Added-latex-inputs.patch >From 42da47c55106e6bf55f46333c7c50daa48b1a67f Mon Sep 17 00:00:00 2001 From: Bob Vergauwen Date: Mon, 4 Jul 2022 20:46:25 +0200 Subject: [PATCH] lisp/ob-latex.el: Added latex inputs * lisp/ob-latex.el (org-babel-execute:latex): Added support for including external latex files. Using the :inputs header, external files can be specified to be included at the top of the produced tex file. All relative file paths are resolved before including the files. (org-babel-header-args:latex): Added the inputs as a possible header argument TINYCHANGE --- lisp/ob-latex.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lisp/ob-latex.el b/lisp/ob-latex.el index 54816bdc5..f0b466d6d 100644 --- a/lisp/ob-latex.el +++ b/lisp/ob-latex.el @@ -65,6 +65,7 @@ (pdfwidth . :any) (headers . :any) (packages . :any) + (inputs . :any) (buffer . ((yes no)))) "LaTeX-specific header arguments.") @@ -146,6 +147,10 @@ This function is called by `org-babel-execute-src-block'." (height (and fit (cdr (assq :pdfheight params)))) (width (and fit (cdr (assq :pdfwidth params)))) (headers (cdr (assq :headers params))) + (inputs (mapcar (lambda (file) + (concat "\\input{" (expand-file-name file) "}")) + (cdr (assq :inputs params)))) + (headers (append headers inputs)) (in-buffer (not (string= "no" (cdr (assq :buffer params))))) (org-latex-packages-alist (append (cdr (assq :packages params)) org-latex-packages-alist))) -- 2.30.1 (Apple Git-130) ------=_Part_1153940_1071979246.1656962155214--