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 ms5.migadu.com with LMTPS id 8Is2NLD2dGKVcAEAbAwnHQ (envelope-from ) for ; Fri, 06 May 2022 12:21:36 +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 UOvlM7D2dGLKyAAAauVa8A (envelope-from ) for ; Fri, 06 May 2022 12:21:36 +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 8C8FA10755 for ; Fri, 6 May 2022 12:21:36 +0200 (CEST) Received: from localhost ([::1]:50204 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nmv5b-0002aJ-3O for larch@yhetil.org; Fri, 06 May 2022 06:21:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48712) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nmv4r-0002Wq-SV for emacs-orgmode@gnu.org; Fri, 06 May 2022 06:20:50 -0400 Received: from mail-qk1-x72b.google.com ([2607:f8b0:4864:20::72b]:38714) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nmv4p-0001NM-VT for emacs-orgmode@gnu.org; Fri, 06 May 2022 06:20:49 -0400 Received: by mail-qk1-x72b.google.com with SMTP id a22so5473878qkl.5 for ; Fri, 06 May 2022 03:20:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=vbnfaggTJWvwpVBB8rlmcc794ZqL1F9+7D830P6M2RU=; b=llP+LXD/ug+y7XDmjV6dYfc0wl4FVnDC8NPXDg26EEXwtpdzRQQLF0XabSI7dzm7vR 6RawB++sfumbQmbrdwGyRwkqWEf9iTMx0UjJjFrJO9HgbIyX5mrNjIOItEB73D+wCFkh UKNsult6m6ZJu2SBZUN9Ib4uN26JfruAMmlUCm7bDGmsDyL0DJsiu5Ks4sIZdVNeomUq hrT11YFHIgg/whWjYld7K4obPppDj+7i3ysE04l0soeVanI//UsoUfoP3dN68GOc2JUw 9tgyIXPojrFBExDOfRQnurq89uLqQuydWvCl28H7tL/meLPwjVDjPfQCjl99ngd7pfJh Z11w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=vbnfaggTJWvwpVBB8rlmcc794ZqL1F9+7D830P6M2RU=; b=ZLP4xcv719G4Jawvyy9WpwZFeGWIMcQgyDqBNO30WOcYPV+O6iNkU3fR6kjjngZjJ8 to29TB2rmdoibSCL2WF9vb72yGqGC3lFeW5PM8GF3LJp433ChhRBvSi+XpZm5Qin+QF5 FKa2rbNkjy/N4f878zK+uxFykbq1GVpVv9ArxZJsbZ7xLcUl7wrLTRJzA43T7nC614a1 +CMYoSZ0TwPoINpPK1a8ahgxwxmdnfXVMZ6R5RcpKP4bU2e+BAovwMTuuCLHQAPnw+0z Kj877TPARcSO7j/RIdW81ib6Ez/4BRkC3ZKr4iqDD53wjVG2wxfEABZXs2vCU+BQitkM egHg== X-Gm-Message-State: AOAM530m3+O0W48RsINDISqsi60IhtbtJLVtO6sKsvRbZPmucHuKl4JZ uAC1bymFjqNh8NbnHOoqHV8= X-Google-Smtp-Source: ABdhPJzRX9aa+NApQw0gtjpDGQpfjA2SpjwqUkpuMnWg423YtYGc2DAZQrrRuzsvJEJd3/skzvnKqQ== X-Received: by 2002:ae9:f406:0:b0:69f:d209:b4fa with SMTP id y6-20020ae9f406000000b0069fd209b4famr1735479qkl.67.1651832447173; Fri, 06 May 2022 03:20:47 -0700 (PDT) Received: from localhost (22.b2.a86c.ip4.static.sl-reverse.com. [108.168.178.34]) by smtp.gmail.com with ESMTPSA id z26-20020ac86b9a000000b002f39b99f688sm2452335qts.34.2022.05.06.03.20.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 May 2022 03:20:46 -0700 (PDT) From: Ihor Radchenko To: "Y. E." , Nicolas Goaziou Cc: emacs-orgmode@gnu.org Subject: [PATCH] Re: [BUG] Set org-format-latex-options in .dir-locals.el [9.5.1 (release_9.5.1-11-g96d91b @ emacs-28.0.90/lisp/org/)] In-Reply-To: References: Date: Fri, 06 May 2022 18:21:29 +0800 Message-ID: <87sfpn6jx2.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::72b; envelope-from=yantar92@gmail.com; helo=mail-qk1-x72b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, 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" 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=1651832496; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=vbnfaggTJWvwpVBB8rlmcc794ZqL1F9+7D830P6M2RU=; b=irT5IjmhfI/2qbkzQSsTlG9mIF4m+dO2JK9omAcdhOlg2o5cRC2Z84i/g3e0hgNAmlesk5 wWQDNg+fNNu4eYGaK/1z95yWIkNURwPF1swCYUd4sHGadgXaV7e+yufPLLCxQBT/UPsffN 8UXoEo6s/rbl9zEb1DOw2Yp/tPHE4FQkyAdUupWRcP9sXxWbuJLcnwWRu9S6J93NHsBj3d YW2Xk27s3cpJlzwSIMoCiH3+KJKLgF6jJJoSm/A3VjhZA0xM6gfTCuy3NzAMwgFV3sUhw9 0JFrUy6u52XrYvr2TgbRG1+tTjY/hF0z4MQ3VY3Bp/foqtVn4Ye1kXFWBeUajA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1651832496; a=rsa-sha256; cv=none; b=alijK/ahFXA+tF0lm9awk6bvNzLk1sy7K55mWyqaB9nDHX1+lS/sxhnEG9KYpz0WAg60JZ pMB9FQV+Wl0FiSIWOboEUJKjMCBwfP94PgLnO1WnwLgb2UmeD87+diZAuvnHmqG11X6LXJ 8rzfuUX4J+pm4hD1Baf6+DdXD7pnhR1FGxnwPANLFtFuI3dZs55jPOYSpaaIK3/BBQKhDw zjzsre5N5ohZdLnUs5tvH8eV6nvGZgFQc/bJEsksda3CIyCfg93Ep0PoNxuGXWVBuxxr4a XXNcfS2Sh3ctwcq5QZTjgwBfMY6jSgsw/N1aCu74C9/8PZeDt5AaFIviBn9z0w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="llP+LXD/"; 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-Spam-Score: -5.80 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="llP+LXD/"; 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-Queue-Id: 8C8FA10755 X-Spam-Score: -5.80 X-Migadu-Scanner: scn0.migadu.com X-TUID: ikWp1zy3IoLT --=-=-= Content-Type: text/plain Y. E. via "General discussions about Org-mode." writes: > Hello, > > I tried configuring 'org-format-latex-options' per a org-mode > file/directory by adding the following configuration into the > .dir-locals.el file: > The file settings I use: > > #+STARTUP: content latexpreview > #+OPTIONS: tex:dvisvgm html-style:nil > #+HTML_HEAD: > > The LaTeX formulas are embedded into the text as shown here: > https://orgmode.org/manual/LaTeX-fragments.html > > Am I overlooking something? Nope. This is a bug. It happens because LaTeX fragments are processed in temporary buffer and all the buffer-local variables you set in the original org buffer are discarded. The fix is attached. Nicolas, this kind of error might be present in various places of export library. You may want to fix it in more places than what I propose in this patch. Best, Ihor --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org-html-format-latex-Preserve-buffer-local-settings.patch >From 37a37862a17c4b333164edffbac97f8a56052e88 Mon Sep 17 00:00:00 2001 Message-Id: <37a37862a17c4b333164edffbac97f8a56052e88.1651832231.git.yantar92@gmail.com> From: Ihor Radchenko Date: Fri, 6 May 2022 18:14:05 +0800 Subject: [PATCH] org-html-format-latex: Preserve buffer-local settings * lisp/ox-html.el (org-html-format-latex): Carry over buffer-local variables when create LaTeX images. Use `org-export-with-buffer-copy' instead of `with-temp-buffer'. Fixes https://orgmode.org/list/m2fsqr75md.fsf@ego.team --- lisp/ox-html.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index 81ef002a0..7f2087a46 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -2872,11 +2872,12 @@ (defun org-html-format-latex (latex-frag processing-type info) ;; temporary buffer so that dvipng/imagemagick can properly ;; turn the fragment into an image. (setq latex-frag (concat latex-header latex-frag)))) - (with-temp-buffer - (insert latex-frag) - (org-format-latex cache-relpath nil nil cache-dir nil - "Creating LaTeX Image..." nil processing-type) - (buffer-string)))) + (org-export-with-buffer-copy + (erase-buffer) + (insert latex-frag) + (org-format-latex cache-relpath nil nil cache-dir nil + "Creating LaTeX Image..." nil processing-type) + (buffer-string)))) (defun org-html--wrap-latex-environment (contents _ &optional caption label) "Wrap CONTENTS string within appropriate environment for equations. -- 2.35.1 --=-=-=--