From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.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 EB7yDKqNJmQEtQAASxT56A (envelope-from ) for ; Fri, 31 Mar 2023 09:37:14 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id yMkBDaqNJmRzaQEA9RJhRA (envelope-from ) for ; Fri, 31 Mar 2023 09:37:14 +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 D342F2BC08 for ; Fri, 31 Mar 2023 09:37:13 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pi9J1-0001R5-1f; Fri, 31 Mar 2023 03:36:15 -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 1pi9Iy-0001Na-L7 for emacs-orgmode@gnu.org; Fri, 31 Mar 2023 03:36:12 -0400 Received: from mailer-211-161.hitrost.net ([91.185.211.161]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pi9Iv-0005zm-W0 for emacs-orgmode@gnu.org; Fri, 31 Mar 2023 03:36:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=christianmoe.com; s=x; h=Content-Type:MIME-Version:Message-ID:Date: In-reply-to:Subject:To:From:References:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=7i0mailVvdOJ4Vs3okIH7SU2OaylgSpdy7BRvcD5GH4=; b=SG2NgGIX7LVF9dMfvTDdmgHcwg 5xtCbFgoeK/IosgRwk1dcK9pkFPgf2qDbU2lxd8NB4G/Nmq/eBpvulGUDY6iEw+nGnuKd7CKSQN+d Wuzhv5pwYCzvEsYb0Yr92CLRAgTy+oMSp187XiQwrvvdwuKB1cQai/5q33q1p3LSTMvhYLQiG/opu ql21ACO1fjGrVw74t1Oa2VZ158YG2shYAu/cD2TRQshOlhUvv1sGI9QAJCS6roN1yT5O8g4f+iIH+ LxalJ3LXxfVsl78QSFF11VN7Qg86LvPnVr57zhv3xJF8nsyb3se6kdOYY43TmQqM5e6YNm6xEAndX QOleBpAQ==; Received: from 92-63-16-127.dynamic.telemach.net ([92.63.16.127] helo=Tauriel) by b1.hitrost.net with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1pi9Iq-008LQs-1t; Fri, 31 Mar 2023 09:36:04 +0200 References: <45437000.fMDQidcC6G@pluto> <87y1neqyll.fsf@christianmoe.com> <23027539.6Emhk5qWAg@pluto> User-agent: mu4e 1.2.0; emacs 27.2 From: Christian Moe To: emacs-orgmode@gnu.org Subject: Re: File generation from LaTeX src fails due to temporary PDF in wrong directory In-reply-to: <23027539.6Emhk5qWAg@pluto> Date: Fri, 31 Mar 2023 09:36:03 +0200 Message-ID: <87ilehs78c.fsf@christianmoe.com> MIME-Version: 1.0 Content-Type: text/plain X-GeoIP: Country [IP], SI [92.63.16.127] X-Antivirus-Scanner: Clean mail though you should still use an Antivirus X-Authenticated-Id: mail@christianmoe.com Received-SPF: pass client-ip=91.185.211.161; envelope-from=mail@christianmoe.com; helo=mailer-211-161.hitrost.net X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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=1680248233; a=rsa-sha256; cv=none; b=NtQwLh5X1gK5QGs1Lq3s9qKYYRSoZVAcli6eorn4ASApfJ5KEpYGPFWU1rzvwQiCfq6psB 2+XFtc414er+5s2XIs/VGxF0WRt5M0oOPrXNogavHPVb1p1wPmfof3De1sVR36ZDujPxPB iyGYfnF99wjtnZDX7wpdEXXC7AR/2ksxIJ5GvtAYdiy8Cn0EMyY8yjwG3ltaIeWks0VAYQ TSeELsUMyBXiepMBTVrh6WGYQU+hz37QFB35MhKFajLPNjI+dBj4cgmRT957PPf7/vWZsT 1MNFVjlOM4YWKMUb0XSZ/bc0+DuBFIAJZrPX83p2CFCE/wD11ErR0XTUcmg7Qg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=christianmoe.com header.s=x header.b=SG2NgGIX; dmarc=none; 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=1680248233; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=7i0mailVvdOJ4Vs3okIH7SU2OaylgSpdy7BRvcD5GH4=; b=aKVaZV1Y3QKS4hrRxTKt6GI0FPIfTyNMSs4H0ProbeJHJOyDofmRsoUbBg6lSqeRLQUMV+ x9FGVrz7pgkrYI+t8B9LgsraZBgM1T37sZRviMQTE9STyxKud/zxNeUzl/s6LZsTNbE3CG LTVOk8Xtpeaw+u+etrhyCkyQQPTyyhOkQWQYZ8WRDyxy9j460PDRe4N8PR59j5gYk4u756 pLwHyEXJgnWI5o7oXWMH9A4yoHVzm83KWwaUSB65624sqImeLYZxH3LKWruk9GLbWEKaEg ONsu9jlXVG8C1ls/xvUkN4WvxEZQEFiBwu13UB5KZQi8GdnykzLkRt3gHFeR8g== X-Migadu-Spam-Score: -3.02 X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=christianmoe.com header.s=x header.b=SG2NgGIX; dmarc=none; 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-Spam-Score: -3.02 X-Migadu-Queue-Id: D342F2BC08 X-TUID: TBjcZJSz0WvJ chris writes: >> [ ... snip ... ] >> 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. Yes, I only thought about that afterwards. > 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 would have been, but I've got inkscape installed via Linux Mint apt repo and it appears to be just a bit too old to have the --pdf-poppler option. Right now, for testing, I'm just using the first thing I have at hand that works, which is pdftocairo: : (setq org-babel-latex-pdf-svg-process "pdftocairo -svg %f %O") I'll probably switch to inkscape for options like not exporting text to paths. I also considered dvisvgm, which I use for snippet preview, but I *think* that using xetex, I could not use dvisvgm for Babel blocks because the Babel latex-to-svg process expects a pdf to be produced, whereas xelatex only outputs dvi (actually an extended dvi format called xdv) if you use the -no-pdf option. Could be wrong. > 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`. I imagine that's possible. But on raw tikz snippets (not src blocks), this already works well for me with dvisvgm. To get it working with xetex I have customized the dvisvgm option in org-preview-latex-process-alist: ... (dvisvgm :programs ("xelatex" "dvisvgm") :description "xdv > svg" :message "you need to install the programs: xetex and dvisvgm." :image-input-type "xdv" :image-output-type "svg" :image-size-adjust (1.7 . 1.5) :latex-compiler ("xelatex -no-pdf -interaction nonstopmode -output-directory %o %f") :image-converter ("dvisvgm %f --no-fonts --exact-bbox --scale=%S --output=%O"))) ... > 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? Yes, that's my aim. Yours, Christian