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 ms9.migadu.com with LMTPS id wAbaJ/huJmQySAEASxT56A (envelope-from ) for ; Fri, 31 Mar 2023 07:26:16 +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 CNsOJ/huJmT4BAEAG6o9tA (envelope-from ) for ; Fri, 31 Mar 2023 07:26:16 +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 5BA7717A2C for ; Fri, 31 Mar 2023 07:26:15 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pi7GI-0006Gs-4W; Fri, 31 Mar 2023 01:25:18 -0400 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 1pi7GF-0006Ga-VO for emacs-orgmode@gnu.org; Fri, 31 Mar 2023 01:25:16 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pi7GD-0000j2-J9 for emacs-orgmode@gnu.org; Fri, 31 Mar 2023 01:25:15 -0400 Received: by mail-wm1-x335.google.com with SMTP id m6-20020a05600c3b0600b003ee6e324b19so13118356wms.1 for ; Thu, 30 Mar 2023 22:25:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680240311; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ey6p9riEJ3tMNefxLne28xU03mUC4SpIKnCj80V1GYo=; b=lO8M++P169XtykQx+KGbCryyn3fsgcPFd/WEIdoxbkbhAe5k/dMXIBuCm7CUwXAyOn x1yb26mS+wlkFg7Da1Xjg7omGRHrU5gesOfPAl6aSOsjou3Xdioru4WweYlBivWgn3Bp bk0k91a5XWwJRFBb2Z7O6csdQipEeLa2o/DutvMk5NO8RR9TDRHP8hOq8YnfUP4QWUta xP4RzTmlnL5RyBdZHsqxqqKiPcHOmxl671DHhdpl8QTW54nMsphjhDzmhi2UkUsax8J1 3ImyodPs8fEigmEapSkMaiu7l93WR6zTz32bHEMIAWyg1XHHpHvdPnIh7amxZiSmeWJi DZKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680240311; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ey6p9riEJ3tMNefxLne28xU03mUC4SpIKnCj80V1GYo=; b=l0lQRQK5kbAGjqKpUR+FniZZYFAgdzdOesgwvlAQVw1tQbqf8cWFgyYNmryqMqiwqh HYbTqkHbVz79rcCYdSbJCp/9vXTWmmk9pDhVTkx59A/+ECY/vwKxHLhsyybLp3rTFJ+w DiBfxRscW7bM6im2zU3HZVY2IlMk7bWQXllr/docSYP8m9dPtA1VkK5Eu5lWq0ISQ4u3 dOgVrBLqKuLKf8fqnfe1RbytKvXlJ6JrUn4A7eD4xVwUns/Xsmwegp9BOV+2cafAMNc5 xAML05/24ibK0rWlOQmgSVCmHrjX8pKiUHesgWCm5yus5TA10qpiunCnE70YxHJTpy94 +B0w== X-Gm-Message-State: AAQBX9db7IUnJ08WfuFgCKQ2LQJmFMe/w1LWbf+xdY3mwb7DMh/KRfCS DityMpSzVGjdgGfxYxKnIOgLSn1+TJk= X-Google-Smtp-Source: AKy350Z9jl2r2nKftDIRN4ARHJfehjUpevWqj/R5uYGpW+O8mDdb2DRkorLN9qXEp8J7bK16azHqqQ== X-Received: by 2002:a05:600c:2313:b0:3ef:f26b:a173 with SMTP id 19-20020a05600c231300b003eff26ba173mr6409193wmo.14.1680240311378; Thu, 30 Mar 2023 22:25:11 -0700 (PDT) Received: from pluto.localnet (aaubervilliers-157-1-6-252.w83-200.abo.wanadoo.fr. [83.200.45.252]) by smtp.gmail.com with ESMTPSA id u17-20020a7bcb11000000b003ef5db16176sm1372213wmj.32.2023.03.30.22.25.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Mar 2023 22:25:10 -0700 (PDT) From: chris To: emacs-orgmode@gnu.org Subject: Re: File generation from LaTeX src fails due to temporary PDF in wrong directory Date: Fri, 31 Mar 2023 07:25:08 +0200 Message-ID: <23027539.6Emhk5qWAg@pluto> In-Reply-To: <87y1neqyll.fsf@christianmoe.com> References: <45437000.fMDQidcC6G@pluto> <87y1neqyll.fsf@christianmoe.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=inkbottle007@gmail.com; helo=mail-wm1-x335.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1680240375; a=rsa-sha256; cv=none; b=OkzswmnpRMl6QHiXqn1WSVqfsy4uTcAPzW4R6OWkrk/x43zrpWzdwPIIBMiqVW2/toG/hU pd/h23jmZBlGmfX93xMCfhqLItxoR4oobY3sjclVxmmbiJBbINaBAx5rUXAq0rDdLOSPyJ vJBIBAoPb3VlrBnVwQDyRmwZ4joIx1XqtDT/I5oypK3fZyh/Mos6vzWafqMRTjJPyQhou3 1Kdyqx5AqLtdr497IDlFsbBQpW7uxvnKBW31X8cFwl8aYWjs0a1lxTyHsFtrTwbt9679Oe w4HgCsnvyFgGB1xqg6ey2Ude9PcjIzFal5inlLx06P6mNGSARXsGAnkB5YluTQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=lO8M++P1; dmarc=pass (policy=none) header.from=gmail.com; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1680240375; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=ey6p9riEJ3tMNefxLne28xU03mUC4SpIKnCj80V1GYo=; b=bo1plxvQQn7obm0M8xWmT0pdqLZLUgbOBJaLt8nal84QZsNE4UPkVj6K4GYBQXMH9wa5hy iPdjTJNjZo+qzvwWJQQnm2SaHQrHjt8FRkGM+D5dqACXQTpuudvCT9M3y68W23dh27vnty UzhRedtBtpUdIcHGE6X4IILKrZ52ojx8IDxeobLCB2yGShYSvV8H/oU8ToH4kRYwqCmbaV kkkzWKAH7oF5/iHDCENC/BfOC+cXqWx1OR7YEYOf9SA3oL41Yzgmr7UyKNS08Bm8em+yHl 4Z3CQAeZbIIcefmBJ8oCazJpeesXQzN0OVHj8iZsRL4PWmuTckXireR10qeE6A== Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=lO8M++P1; dmarc=pass (policy=none) header.from=gmail.com; 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-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -10.75 X-Spam-Score: -10.75 X-Migadu-Queue-Id: 5BA7717A2C X-TUID: ROYjoOhpr7Xn On Thursday, 30 March 2023 13:15:34 CEST Christian Moe wrote: > > chris writes: > > > On Wednesday, 29 March 2023 23:15:03 CEST Christian Moe wrote: > >> > >> Hi, > >> > >> Pardon the noise: It turned out to be a pretty obvious problem with my > >> setup that has now been resolved. > >> > >> I had modified org-latex-pdf-process to use xelatex, and for some reason > >> my setup lacked the =-output-directory %o= switch. I should probably > >> have thought of that first, but the omission has had no ill effects on > >> ordinary PDF export, so I didn't run into any problem before trying to > >> use Babel with LaTeX. > >> > >> Ihor and Pedro, thanks for checking. > >> > >> Chris, I don't know why your attempts fail, but I'll be trying similar > >> things over the next days, so maybe I'll come back to you. > >> > > > > For one thing I don't understand 90% of the options, that can explain a lot. > > Another point, the gibberish output I was speaking about are "similar" those > > of > > [[https://emacs.stackexchange.com/questions/68823/minimal-working-example-of-tikz-to-svg-in-orgmode]] > > Actually the svg image they get is an image containing the `tikz` instructions > > transformed as image. What I get is the svg instructions that should generate > > the image: an image showing a `svg` listing. > > I am seeing the same problem, and think I have a solution below, but > it's confusing and I'm wondering if other people have this working out > of the box somehow. > > The difference between what you are seeing, and what they are seeing in > the stackexchange thread, comes down to whether =:headers > '("\\usepackage{tikz}")= is specified. Without it, all they get is an > SVG of the glyphs in the arguments to the tikz commands. With it, we get > an SVG of the glyphs in the SVG for the image. So when the extension is > .svg, the intermediate PDF that is converted into SVG does not contain > the image, but a listing of the SVG, which has *already* been generated! > > The reason, I think, is that org-babel-latex-preamble includes this > definition: > > : \def\pgfsysdriver{pgfsys-tex4ht.def} > > So what happens, I think, is that tex4ht already generates SVG from the > TikZ code. When Org then uses org-babel-latex-pdf-svg-process to call an > external utility, by default inkscape, to convert the PDF to SVG, we are > converting not an image but a code listing already in SVG. > > It is not at all clear to me why tex4ht is invoked in the default > preamble. I wonder if it still serves a purpose. If it makes better SVG > from LaTeX than the other utilities, it would be nice to use it directly > somehow. But perhaps it is just a leftover from a stage in development > when htlatex was used to produce the SVG, before the two-part-process > ->PDF->SVG with org-babel-latex-pdf-svg-process was defined. If so it > should probably be changed. Here's the relevant thread, I think, for > people wanting to look into that: > > https://list.orgmode.org/873608ajfn.fsf@bzg.fr/t/ > > > Solution: > > Redefine org-babel-latex-preamble to remove > the offending line. > > (setq org-babel-latex-preamble > '(lambda (_) > "\\documentclass[preview]{standalone}")) > > With this setup, my example > > #+header: :fit yes :headers '("\\usepackage{tikz}") > #+begin_src latex :exports results :results raw file :file test-tikz-triangle.svg > \begin{tikzpicture} > \draw[draw=black, fill=blue!10] (0,4) -- (3,0) -- (-3,0) -- cycle; > \end{tikzpicture} > #+end_src > > exports correctly to an .svg file. Hmm, your fix works perfectly! And it's a `defcustom` variable so it's not even a hack. I guess that since you haven't selected specific method like: `#+header: :imagemagick yes`, the method used is `inkscape` (`ob-latex.el` file): ``` (defcustom org-babel-latex-pdf-svg-process "inkscape \ --pdf-poppler \ --export-area-drawing \ --export-text-to-path \ --export-plain-svg \ --export-filename=%O \ %f" "Command to convert a PDF file to an SVG file." :group 'org-babel :type 'string :package-version '(Org . "9.6")) ``` I don't know if you use `org-latex-preview` for `tikz` snippets? Maybe you don't because that doesn't export to `html`. I use `(setq org-preview-latex-default-process 'dvipng)`, and I guess it would be nice to add an new option in `(defcustom org-preview-latex-process-alist` to add `inkscape`. So with you solution, I guess when we export to `html`, the "normal" `latex` formulas are rendered by `mathjax`, which works very well, and the `tikz` diagrams are automatically exported as a `svg` image, while the code to produce them is not exported. I suppose you use those `latex` code block for exporting to `html` purpose? Thanks, Chris > > Yours, > Christian > >