From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id qGqVG2oBe2SPqAAASxT56A (envelope-from ) for ; Sat, 03 Jun 2023 11:01:30 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id qBNlG2oBe2Q0BAAAauVa8A (envelope-from ) for ; Sat, 03 Jun 2023 11:01:30 +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 EB211470B3 for ; Sat, 3 Jun 2023 11:01:29 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5N7e-0007As-UW; Sat, 03 Jun 2023 05:00:30 -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 1q5N7X-0007AQ-0O for emacs-orgmode@gnu.org; Sat, 03 Jun 2023 05:00:23 -0400 Received: from qs51p00im-qukt01080101.me.com ([17.57.155.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q5N7U-0005Mf-1c for emacs-orgmode@gnu.org; Sat, 03 Jun 2023 05:00:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai; t=1685782816; bh=uXbiIodyrwMt4oqpUO0IB4KBr7i+NpqiQYW2AGGmj9k=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=jlhVDM+Z8nDNaZhj5Ge1vxhhjVrVpnMpHMgrzRuWTk1+7hmtLjr4Ivor35h7AJnaB DUsxfmpNzjroSOIhYZIRYiALP8KaAiGqAkK01WES17n2yKkFHQNPb5zRn+3uxfbIcb OSDlpOfKo+50l6PDGcSCo7ExbUWDza+5c9UAHyPp5WB4pf+8JS49fnujYAVrOSMNLN OzJFoM9N1G4KUJCBYZJLhmJTMs/JNkhpA1nHh0UiO/5EUumg1/rYnuLvcOKRsAkDKu JCjFsbaW6NHQSriabWYNzIXDTP6l7j7Vggt7gSy7OH+A576s1i7YFdZuf5wxmEenJf X7kGi6hUIW0Hw== Received: from Rudolfs-MacBook-Air.local (qs51p00im-dlb-asmtp-mailmevip.me.com [17.57.155.28]) by qs51p00im-qukt01080101.me.com (Postfix) with ESMTPSA id E5F0A61801C0; Sat, 3 Jun 2023 09:00:15 +0000 (UTC) From: Rudolf =?utf-8?Q?Adamkovi=C4=8D?= To: Timothy Cc: emacs-orgmode@gnu.org Subject: Re: [Pre-PATCH] Overhaul of the LaTeX preview system In-Reply-To: <87edn0tkxn.fsf@tec.tecosaur.net> References: <87lek2up0w.fsf@tec.tecosaur.net> <87edn0tkxn.fsf@tec.tecosaur.net> Date: Sat, 03 Jun 2023 11:00:13 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: WvIlLkDFDatrUqDFSP6CkRIBN4Sa9yza X-Proofpoint-ORIG-GUID: WvIlLkDFDatrUqDFSP6CkRIBN4Sa9yza X-Proofpoint-Virus-Version: =?UTF-8?Q?vendor=3Dfsecure_engine=3D1.1.170-22c6f66c430a71ce266a39bfe25bc?= =?UTF-8?Q?2903e8d5c8f:6.0.425,18.0.572,17.0.605.474.0000000_definitions?= =?UTF-8?Q?=3D2022-01-11=5F01:2022-01-11=5F01,2020-02-14=5F11,2020-01-23?= =?UTF-8?Q?=5F02_signatures=3D0?= X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=509 suspectscore=0 mlxscore=0 malwarescore=0 bulkscore=0 phishscore=0 adultscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2306030083 Received-SPF: pass client-ip=17.57.155.18; envelope-from=salutis@me.com; helo=qs51p00im-qukt01080101.me.com X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 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_FROM=0.001, RAZOR2_CF_RANGE_51_100=1.886, RAZOR2_CHECK=0.922, RCVD_IN_DNSWL_LOW=-0.7, 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=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=1685782890; a=rsa-sha256; cv=none; b=pIpY+mS8KHyTxErBLbFOZQ9cb9/G858GMC0j1cQ6mLDJOHHSWQ0cpOI3wO1EZDV4YTgvNj H0i5vRvRougaWANlV1MoQafCRLW/v94naWdNjzjIajZYKJtUpUrdssIu5mLgwWK0RWsN8y ep+/AFty8asOYAMZ2HZRL0GuwtGIZekQAJUGHxuuJHS6ownf4i5Qf0UPDZ3ba9DLBoii2+ Ej3easucdt/EruEj3/jk4t6U8yVVLq34mAyNidWuxDbW2TNDTDdlqvPa0AskYPA43oFw/h Vc0Ls4ZWzrvFAQXVjK8kQ+BPyqmJ12wtiMFLQ2PFs2W9HtD/0Pd9auVTDLM+1A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=me.com header.s=1a1hai header.b=jlhVDM+Z; dmarc=pass (policy=quarantine) header.from=me.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=1685782890; 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=uXbiIodyrwMt4oqpUO0IB4KBr7i+NpqiQYW2AGGmj9k=; b=B6zjp7ivG0RkI8ls6WYwDNyjJahDq29liRctSU7+HxQ45qa76wkVm7ui3efM2p5pMyuvlk +xKnqiZNtcgPpQDUxaxD0/6Nifu9YVWs8+Eq/8L8sZWYpY5xLjo7ECzUXSJbNoYnHrSp/+ TQxwMEji59UMvSw3JsZuA9a/WX0eAflHtOU4oCx2yOVMF3xpdUCnazG830lV9ywqu8zXVy MKnH0Db51K7CZAMyT/Wz3qBWasYXNmh+39WuBXwZ38MmiRvZmugNGDuFLplki9/huTRjyO +QAPvj9qhBy6nElPZX0b1G7fYDnqxwMWg17CYhgXlD/rroBifqfdVoXT+cImoA== Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=me.com header.s=1a1hai header.b=jlhVDM+Z; dmarc=pass (policy=quarantine) header.from=me.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: -8.47 X-Spam-Score: -8.47 X-Migadu-Queue-Id: EB211470B3 X-TUID: cfhPKWQSkg81 Timothy writes: > Thanks for testing the branch :) Thank you for your reply. > We=E2=80=99re thinking of adding `--exact-bbox' to the default `dvisvgm' > flags, which it seems has a good chance of resolving this. It was > originally swapped for `--bbox=3Dpreview' (when using `dvisvgm' to get > dimension info), but now we do this via the LaTeX compilation stdout, > and so we can go back to `--exact-bbox'. This would be great. Please! > I tried this example on my computer, and it worked flawlessly (see > ). If you could give me a stacktrace, that > might help. OMG! OMG! OMG! So, this new system not only fixes the baseline problem, making LaTeX actually usable in HTML exports, but it also makes TikZ work?! No more fiddling with LaTeX Org Babel? No more per-image scaling headaches? Now, that is INCREDIBLE! Below, I re-create a MWE end-to-end. ******** CONFIGURATION ******** - OS: macOS 13.3.1 (22E261) ARM/M1 architecture native compilation - Org mode: https://git.tecosaur.net/tec/org-mode.git branch: origin/dev commit: a92c62287 - Emacs: official repository branch: origin/master commit: dc3b3548b7c compilation flags: make extraclean && ./autogen.sh && ./configure --with-json --with-xwidgets = --with-native-compilation=3Daot && make -j 8 bootstrap && make install - No '.emacs.d'. - In '.emacs', the following: ;; Make Emacs native compilation work on Apple/macOS jails. (when (eq window-system 'ns) (setenv "LIBRARY_PATH" (string-join '("/opt/homebrew/opt/gcc/lib/gcc/13" "/opt/homebrew/opt/libgccjit/lib/gcc/13" "/opt/homebrew/opt/gcc/lib/gcc/13/gcc/aarch64-apple-darwin22/13") ":"))) ;; Make Emacs find binaries on Apple/macOS jails. (when (eq window-system 'ns) (defun shell-get-environment-variable+ (variable) "Return the value of VARIABLE from login shell." (shell-command-to-string (format "$SHELL --login -c 'echo -n $%s'" variable))) ;; Set the path to executables. (let* ((path "PATH") (path-value (shell-get-environment-variable+ path))) (setenv path path-value) (setq exec-path (split-string path-value path-separator))) ;; Set the locale. (let* ((variable "LC_ALL") (variable-value (shell-get-environment-variable+ variable))) (setenv variable variable-value))) ;; Load the new Org. (add-to-list 'load-path "~/src/org-mode-tecosaur/lisp") ;; Make Org work without the arrow keys. (setq-default org-use-extra-keys t) ******** TEST DOCUMENT ******** Saved in '~/test.org': #+TITLE: Hello there #+OPTIONS: tex:dvisvgm #+LATEX_HEADER: \usepackage{tikz} \begin{equation*} 1 + 1 =3D 2 \end{equation*} \begin{tikzpicture} \filldraw (0, 0) circle[radius =3D 1cm]; \end{tikzpicture} ******** REPRODUCTION STEPS ******** 1. Open the test document. 2. Type C-c C-x C-l inside of the 'equation' environment. 3. See the preview, to verify basic LaTeX previews work. 4. Type C-c C-x C-l inside of the 'tikzpicture' environment. EXPECTED: See the expected TikZ preview, a circle. ACTUAL: - No TikZ preview. - "Wrong type argument: stringp, nil" in the echo area. ******** TRACE ******** The steps: 1. Type M-x toggle-debug-on-error RET. 2. Repeat the reproduction steps. 3. Expand all '...' in the trace. 4. Save the trace. Debugger entered--Lisp error: (wrong-type-argument stringp nil) file-exists-p(nil) org-latex-preview--svg-make-fg-currentColor((:string "\\color[rgb]{0,0,0.= 00392157}\\setcounter{equation}{0}%\n\\begin{tikzpicture}\n \\filldraw (0,= 0) circle[radius =3D 1cm];\n\\end{tikzpicture}\n" :overlay # :key "6f292c841630b664deb0178c18bdfc5ceb532272" :de= pth 0.04918392937239927 :height 5.714304984431469 :width 36.21927976341847 = :errors nil :path nil :error "Image file not produced.")) org-latex-preview--dvisvgm-filter(# "process= ing page 1\n WARNING: 50 PostScript specials ignored. The resulting SVG mi= ght look wrong.\n page is empty\n graphic size: 0pt x 0pt (0mm x 0mm)\n = output written to /var/folders/ky/8r5j3qz55hb94lpg1jr9vl1c0000gn/T/org-tex-= 4tn7FE-000000001.svg\n1 of 1 page converted in 0.153852 seconds\n" (:latex-= processor "pdflatex" :latex-header "% Intended LaTeX compiler: pdflatex\n\\= documentclass{article}\n\\usepackage[utf8]{inputenc}\n\\usepackage[T1]{font= enc}\n% Package hyperref omitted\n\\usepackage{xcolor}\n\n\\usepackage{tikz= }\n\n\n% Generated preamble omitted for snippets.\n\n\n\\makeatletter\n\\re= newcommand{\\theequation}{\\(\\diamond\\)\\ifnum\\value{equation}>1%\n\\,+\= \,\\@arabic{\\numexpr\\value{equation}-1\\relax}\\fi}\n\\makeatother" :prog= rams ("latex" "dvisvgm") :description "dvi > svg" :message "you need to ins= tall the programs: latex and dvisvgm." :image-input-type "dvi" :image-outpu= t-type "svg" :latex-compiler ("%l -interaction nonstopmode -output-director= y %o %f") :latex-precompiler ("%l -output-directory %o -ini -jobname=3D%b \= "&%L\" mylatexformat.ltx %f") :image-converter ("dvisvgm --page=3D1- --opti= mize --clipjoin --relative --no-fonts --bbox=3Dpreview -o %B-%%9p.svg %f") = :processor dvisvgm :fragments ((:string "\\color[rgb]{0,0,0.00392157}\\setc= ounter{equation}{0}%\n\\begin{tikzpicture}\n \\filldraw (0, 0) circle[radi= us =3D 1cm];\n\\end{tikzpicture}\n" :overlay # :key "6f292c841630b664deb0178c18bdfc5ceb532272" :depth 0.049183929= 37239927 :height 5.714304984431469 :width 36.21927976341847 :errors nil :pa= th nil :error "Image file not produced.")) :org-buffer # := texfile "/Users/salutis/org-tex-4tn7FE.tex" :place-preview-p t :fontsize 10= :tightpage (-32891 -32891 32891 32891))) org-async--filter(# "processing page 1\n WA= RNING: 50 PostScript specials ignored. The resulting SVG might look wrong.\= n page is empty\n graphic size: 0pt x 0pt (0mm x 0mm)\n output written t= o /var/folders/ky/8r5j3qz55hb94lpg1jr9vl1c0000gn/T/org-tex-4tn7FE-000000001= .svg\n1 of 1 page converted in 0.153852 seconds\n") Rudy --=20 "Mathematics takes us still further from what is human into the region of absolute necessity, to which not only the actual world, but every possible world, must conform." -- Bertrand Russell, 1902 Rudolf Adamkovi=C4=8D [he/him] Studenohorsk=C3=A1 25 84103 Bratislava Slovakia